Merge lines.love
[?]
Aug 31, 2023, 5:45 AM
HWTLXESCGV3A63XI62ZV4NXRE2AXTZS32P5QBWYGMSCTQDZTISPQCDependencies
- [2]
JDZVBFEIMerge lines.love - [3]
ONHKBLLCMerge lines.love - [4]
O5TGYJZQbugfix in source editor - [5]
OI4FPFINsupport drawings in the source editor - [6]
3PSFWAILMerge lines.love - [7]
K74U4BAUMerge lines.love - [8]
G54H3YG2get rid of all bifold text - [9]
2TQUKHBCMerge lines.love - [10]
SGMA5JLEsave the list of tests in repo - [11]
LWPFEZBIMerge lines.love - [12]
2L5MEZV3experiment: new edit namespace - [13]
MD3W5IRAnew fork: rip out drawing support - [14]
FS2ITYYHrecord a known issue - [15]
2344TV56Merge lines.love - [16]
ED4Z6ORCcleaner API for file-system access - [17]
K2X6G75Zstart writing some tests for drawings - [18]
TVCPXAAUrename - [19]
4SR3Z4Y3document the version of LÖVE I've been using - [20]
BLWAYPKVextract a module - [21]
3QNOKBFMbeginnings of a test harness - [22]
KMSL74GAsupport selections in the source editor - [23]
LXTTOB33extract a couple of files - [24]
XX7G2FFJintermingle freehand line drawings with text - [25]
2CTN2IEFMerge lines.love - [26]
CE4LZV4Tdrop last couple of manual tests - [27]
AVTNUQYRbasic test-enabled framework - [28]
ZLJYLPOTMerge lines.love - [29]
KWHC65JIMerge lines.love - [30]
FPY4LO2Wmake a few names consistent with snake_case - [31]
BULPIBEGbeginnings of a module for the text editor - [32]
KKMFQDR4editing source code from within the app - [33]
R5QXEHUIsomebody stop me - [34]
JOPVPUSAediting source code from within the app - [35]
T4FRZSYLdelete an ancient, unused file - [36]
ORKN6EOBMerge lines.love - [37]
TLOAPLBJadd a license - [38]
N2NUGNN4include a brief reference enabling many useful apps - [39]
OGUV4HSAremove some memory leaks from rendered fragments - [40]
66X36NZNa little more prose describing manual_tests - [41]
B6DS4GZCMerge lines.love - [42]
BJ5X5O4Alet's prevent the text cursor from ever getting on a drawing - [43]
RU4HIK43Merge lines.love - [44]
RSZD5A7Gforgot to add json.lua - [45]
D2GCFTTTclean up repl functionality - [46]
VXORMHMEdelete experimental REPL - [47]
VHUNJHXBMerge lines.love - [48]
73OCE2MCafter much struggle, a brute-force undo - [49]
VP5KC4XZMerge lines.love - [50]
BH7BT36Lctrl+a: select entire buffer - [51]
OTIBCAUJlove2d scaffold - [52]
SCOXD4EOMerge lines.love - [53]
VHQCNMARseveral more modules - [54]
4YDBYBA4clean up memory leak experiments - [55]
6LJZN727handle chords
Change contents
- file deletion: source_file.lua source_file.lua
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 - file deletion: source_edit.lua source_edit.lua
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 - replacement in source_file.lua at line 4
local infile = App.open_for_reading(filename)local infile = App.open_for_reading(App.save_dir..filename)if not infile theninfile = App.open_for_reading(App.source_dir..filename)end - edit in source_file.lua at line 16
-- the source editor supports only files in the save dir backed by the source dir - replacement in source_file.lua at line 18
local infile = App.open_for_reading(State.filename)local infile = App.open_for_reading(App.save_dir..State.filename)if not infile theninfile = App.open_for_reading(App.source_dir..State.filename)end - replacement in source_file.lua at line 47
local outfile = App.open_for_writing(State.filename)local outfile = App.open_for_writing(App.save_dir..State.filename) - replacement in source_edit.lua at line 451
App.setClipboardText(s)App.set_clipboard(s) - replacement in source_edit.lua at line 457
App.setClipboardText(s)App.set_clipboard(s) - replacement in source_edit.lua at line 466
local clipboard_data = App.getClipboardText()local clipboard_data = App.get_clipboard()