HESBC35LBCNFWDFRAO6Z4EJ67BCBHCRETCPEJCV2BDPHUJJFY3WQC 2KPJVPKBIHNRL5XGZZGGKDMK5OAENP7YUXBQMQSHBNUVLIWA4IFQC N7LKWLNBOJU4JM23NOZRR4TQNRYMVJBXD6GAFZIKKMMEGGGXXGPQC 7VGDIPLCFDG3PVE4JH3WDKZ4A7PG5UYW7TLFFFOWN2JEUZYYTFJQC IX5YTLSVVGQSTXUNGYK526DJ4YWIXO2JRBCOFCANBJJO3ZM2S7ZAC R5QXEHUIZLELJGGCZAE7ATNS3CLRJ7JFRENMGH4XXH24C5WABZDQC KKMFQDR43ZWVCDRHQLWWX3FCWCFA3ZSXYOBRJNPHUQZR2XPKWULAC OI4FPFINEROK6GNDEMOBTGSPYIULCLRGGT5W3H7VLM7VFH22GMWQC 3QTDBKMDXSWEGADRCZJVLI4NKZQYDSKUUD4JJU7VC3GWK3QI5F2AC A23MMLJHXQOVDZHJCPCCP4SIFXTB7HXJMCCDAM2I7Q7BAIXMAYBAC JOPVPUSAMMU6RFVDQR4NJC4GNNUFB7GPKVH7OS5FKCYS5QZ53VLQC QEXZHD2VPCM4TAPP7PR2K2PIR4BVES5IZWC3T6ZRNJWKWOXFILNQC 2L5MEZV344TOZLVY3432RHJFIRVXFD6O3GWLL5O4CV66BGAFTURQC MD3W5IRAC6UQALQE4LJC52VQNDO3I3HXF3XE2XHDABXBYJBUVAXQC 5STHSG4UB2SC4EZWOQHPQM43BLC4X2EJTNSSYRF35XEYVMTOID5AC function edit.check_locs(State)-- if State is inconsistent (i.e. file changed by some other program),-- throw away all cursor state entirelyif edit.invalid1(State, State.screen_top1)or edit.invalid1(State, State.cursor1)or not edit.cursor_on_text(State)or not Text.le1(State.screen_top1, State.cursor1) thenState.screen_top1 = {line=1, pos=1}edit.put_cursor_on_first_text_line(State)endendfunction edit.invalid1(State, loc1)return loc1.line > #State.linesor loc1.pos > #State.lines[loc1.line].dataendfunction edit.cursor_on_text(State)return State.cursor1.line <= #State.linesand State.lines[State.cursor1.line].mode == 'text'endfunction edit.put_cursor_on_first_text_line(State)State.cursor1 = {line=i, pos=1}breakendendendfor i,line in ipairs(State.lines) doif line.mode == 'text' then
edit.check_locs(Editor_state)love.window.setTitle('lines.love - '..Editor_state.filename)endfunction run.draw()edit.draw(Editor_state)endfunction run.update(dt)Cursor_time = Cursor_time + dtedit.update(Editor_state, dt)endfunction run.quit()edit.quit(Editor_state)endfunction run.settings()edit.check_locs(Editor_state)love.window.setTitle('lines.love - '..Editor_state.filename)if #arg > 1 thenprint('ignoring commandline args after '..arg[1])endif rawget(_G, 'jit') thenjit.off()jit.flush()endendfunction run.load_settings()love.graphics.setFont(love.graphics.newFont(Settings.font_height))
function edit.fixup_cursor(State)
function edit.check_locs(State)-- if State is inconsistent (i.e. file changed by some other program),-- throw away all cursor state entirelyif edit.invalid1(State, State.screen_top1)or edit.invalid1(State, State.cursor1)or not edit.cursor_on_text(State)or not Text.le1(State.screen_top1, State.cursor1) thenState.screen_top1 = {line=1, pos=1}edit.put_cursor_on_first_text_line(State)endendfunction edit.invalid1(State, loc1)return loc1.line > #State.linesor loc1.pos > #State.lines[loc1.line].dataendfunction edit.cursor_on_text(State)return State.cursor1.line <= #State.linesand State.lines[State.cursor1.line].mode == 'text'endfunction edit.put_cursor_on_first_text_line(State)