RWO6MEPSCLRGHZNFSCQDIWIBUZBB3KAY6I4GFVM2JMPND7DVDU2AC 3U5FNDXMM4VZROTQJFGSHF6M7ZOACL62HBCMY2PAKB5NHVPAKYBAC NCSQ5FPI5NSJR3UDSXBUHUXJ2HPEVTYEVALFYAXCPO5FKRLRY7EQC TY2AE7AIMJICIH3MYOPQZRXCUOY3XOVCYYNP3BKKFPRRKICCQHXQC YIDJVKHDBS5DUXDV5TLW7K7QWFVUBFQJBQG5FDWCJWK3QRT7GNOAC R5QXEHUIZLELJGGCZAE7ATNS3CLRJ7JFRENMGH4XXH24C5WABZDQC JOPVPUSAMMU6RFVDQR4NJC4GNNUFB7GPKVH7OS5FKCYS5QZ53VLQC AIMA4HLDQ6GI74ESXMOJJ5UVHKZWPNED26G6SXX76G6ORQLYS5PAC 3QNOKBFMKBGXBVJIRHR2444JRRMBTABHE4674NR3DT67RRM2X6GAC WOQELCJJ7FPYJEKT57NJ3FJARPNWMHLITDTCUICFYU4YWXDSASYQC 3QWK3GSA5KTVQJKXQ65OGZA2AORHFALLBXWP2A4MN6YDE7VV4PUAC AVTNUQYRBW7IX2YQ3KDLVQ23RGW3BAKTAE7P73ASBYNKOHMQMH5AC KHPSHJN4BMTJ3CHUFQQZU7ZIQDOQDF3L5HV3TRT5OJMYICJAEB5QC FJAM6Z3SJ4WITRPEEBOPIIU4CQAT33EC26CB2WXVZHGSWI56FQEAC D6DV2L5CX6YGDXHI3SQKYEOBNTKUOBB6M5OJTPSECRQJHRIAGSYAC HKV72RZVJEOF5GCHCRKEBGC3FQN7AYETY7LKEJUXVIQAB4QPEPYQC local infile = App.open_for_reading(App.save_dir..filename)if not infile theninfile = App.open_for_reading(App.source_dir..filename)end-- the source editor supports only files in the save dir backed by the source dirlocal infile = App.open_for_reading(App.save_dir..State.filename)if not infile theninfile = App.open_for_reading(App.source_dir..State.filename)endlocal 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) doState.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 endfunction load_from_disk(State)if infile theninfile:close()return trueelsereturn falseendend
App.set_clipboard(s)App.set_clipboard(s)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)})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)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
App.open_for_reading =function(filename)local result = nativefs.newFile(filename)local ok, err = result:open('r')if ok thenreturn resultelsereturn ok, errendApp.open_for_writing =function(filename)local result = nativefs.newFile(filename)local ok, err = result:open('w')if ok thenreturn resultelsereturn ok, errendApp.files = nativefs.getDirectoryItemsApp.source_dir = love.filesystem.getSource()..'/'App.current_dir = nativefs.getWorkingDirectory()..'/'App.save_dir = love.filesystem.getSaveDirectory()..'/'App.get_time = love.timer.getTimeApp.get_clipboard = love.system.getClipboardTextApp.set_clipboard = love.system.setClipboardText