HWTLXESCGV3A63XI62ZV4NXRE2AXTZS32P5QBWYGMSCTQDZTISPQC JDZVBFEIBB5JVB7PJJMKFO4Z52NCEKFFFQ4B4QECCBRPEJ4EPGDQC ONHKBLLCD5NDO3HSSUMAMGJ7HDT53JYVV56DI42AEYI3W63GKACQC O5TGYJZQ2NDBC53BP2NDEKKKCIBSJYEIQVJRK6CQFHBPHB6GGHWAC R5QXEHUIZLELJGGCZAE7ATNS3CLRJ7JFRENMGH4XXH24C5WABZDQC KKMFQDR43ZWVCDRHQLWWX3FCWCFA3ZSXYOBRJNPHUQZR2XPKWULAC ED4Z6ORCADLWJPSZNKQVUF63NBKLQVE7UFMBTQAQA5O47X4NLFIAC FPY4LO2WZNXUYCZ6MOQBSPGCC3M3PE7YX2TJIFRNEQLJ4ACWUPVAC JOPVPUSAMMU6RFVDQR4NJC4GNNUFB7GPKVH7OS5FKCYS5QZ53VLQC local outfile = App.open_for_writing(App.save_dir..State.filename)if outfile == nil thenerror('failed to write to "'..State.filename..'"')endfor _,line in ipairs(State.lines) do-- the source editor supports only files in the save dir backed by the source dirfunction load_from_disk(State)local infile = App.open_for_reading(App.save_dir..State.filename)if not infile theninfile = App.open_for_reading(App.source_dir..State.filename)endState.lines = load_from_file(infile)if infile then infile:close() endendfunction load_from_file(infile)local result = {}if infile thenlocal infile_next_line = infile:lines() -- works with both Lua files and LÖVE Files (https://www.love2d.org/wiki/File)while true dolocal line = infile_next_line()if line == nil then break endlocal infile = App.open_for_reading(App.save_dir..filename)if not infile theninfile = App.open_for_reading(App.source_dir..filename)endif infile theninfile:close()return trueelsereturn falseendend
local clipboard_data = App.get_clipboard()for _,code in utf8.codes(clipboard_data) dolocal c = utf8.char(code)if c == '\n' thenText.insert_return(State)elseText.insert_at_cursor(State, c)endendif Text.cursor_out_of_screen(State) thenText.snap_cursor_to_bottom_of_screen(State, State.left, State.right)endschedule_save(State)record_undo_event(State, {before=before, after=snapshot(State, before_line, State.cursor1.line)})App.set_clipboard(s)endschedule_save(State)elseif chord == 'C-v' thenfor _,line_cache in ipairs(State.line_cache) do line_cache.starty = nil end -- just in case we scroll-- We don't have a good sense of when to scroll, so we'll be conservative-- and sometimes scroll when we didn't quite need to.local before_line = State.cursor1.linelocal before = snapshot(State, before_line)App.set_clipboard(s)endelseif chord == 'C-x' thenfor _,line_cache in ipairs(State.line_cache) do line_cache.starty = nil end -- just in case we scrolllocal s = Text.cut_selection(State, State.left, State.right)if s then