Merge text.love

[?]
Aug 31, 2023, 5:55 AM
JCRUUD2SRLBSGPWZVXWOSZYJCW32JNBJKRC7PMBUHGUI6YX63W3QC

Dependencies

  • [2] 4HR3G5ZD Merge text.love
  • [3] X43ZIKR3 Merge text.love
  • [4] KRLRRLVG Merge text.love
  • [5] HWTLXESC Merge lines.love
  • [6] OTIBCAUJ love2d scaffold
  • [7] RSZD5A7G forgot to add json.lua
  • [8] BJ5X5O4A let's prevent the text cursor from ever getting on a drawing
  • [9] BLWAYPKV extract a module
  • [10] ONHKBLLC Merge lines.love
  • [11] T4FRZSYL delete an ancient, unused file
  • [12] 3PSFWAIL Merge lines.love
  • [13] 3G723RV5 Merge text.love
  • [14] QD4LOFQR Merge text.love
  • [15] 2CFLXLIE Merge text.love
  • [16] SGMA5JLE save the list of tests in repo
  • [17] 2CTN2IEF Merge lines.love
  • [18] LWPFEZBI Merge lines.love
  • [19] B6DS4GZC Merge lines.love
  • [20] TVCPXAAU rename
  • [21] JCXL74WV bring back everything from commit a68647ae22
  • [22] PJ5PQAQE record support for multiple versions
  • [23] 7CLGG7J2 test: autosave after any shape
  • [24] IGBTDA6Y Merge text.love
  • [25] FM5LDKGT Merge text.love
  • [26] H4R5BHVY no more Text allocations
  • [27] JMUD7T3O get rid of ugly side-effects in tests
  • [28] K2X6G75Z start writing some tests for drawings
  • [29] 3QNOKBFM beginnings of a test harness
  • [30] 4YDBYBA4 clean up memory leak experiments
  • [31] K74U4BAU Merge lines.love
  • [32] AD34IX2Z couple more tests
  • [33] VHQCNMAR several more modules
  • [34] 4KC7I3E2 make colors easier to edit
  • [35] VHUNJHXB Merge lines.love
  • [36] 2L5MEZV3 experiment: new edit namespace
  • [37] 66X36NZN a little more prose describing manual_tests
  • [38] UAYCSFSK Merge text.love
  • [39] ED4Z6ORC cleaner API for file-system access
  • [40] 2TQUKHBC Merge lines.love
  • [41] FS2ITYYH record a known issue
  • [42] KKMFQDR4 editing source code from within the app
  • [43] AVTNUQYR basic test-enabled framework
  • [44] 73OCE2MC after much struggle, a brute-force undo
  • [45] AT3LVCMP Merge text.love
  • [46] MD3W5IRA new fork: rip out drawing support
  • [47] XX7G2FFJ intermingle freehand line drawings with text
  • [48] R3KXFRZN get rid of to_text
  • [49] 2344TV56 Merge lines.love
  • [50] N2NUGNN4 include a brief reference enabling many useful apps
  • [51] HKV72RZV bugfix: save modified files in save directory
  • [52] CUFW4EJL reorganize app.lua and its comments
  • [53] FPY4LO2W make a few names consistent with snake_case
  • [54] KWHC65JI Merge lines.love
  • [55] R5QXEHUI somebody stop me
  • [56] BULPIBEG beginnings of a module for the text editor
  • [57] KMSL74GA support selections in the source editor
  • [58] VXORMHME delete experimental REPL
  • [59] JFFUF5AL override mouse state lookups in tests
  • [60] Q6RXCILQ Merge text.love
  • [61] 3QWK3GSA support mouse clicks in file navigator
  • [62] RU4HIK43 Merge lines.love
  • [63] PX7DDEMO autosave slightly less aggressively
  • [64] 2JLMNZZI Merge text.love
  • [65] 36Z442IV back to commit 8123959e52f without code editing
  • [66] 7IDHIAYI rename modifier_down to key_down
  • [67] LXTTOB33 extract a couple of files
  • [68] VP5KC4XZ Merge lines.love
  • [69] VXRYVZ74 Merge text.love
  • [70] SCOXD4EO Merge lines.love
  • [71] UGXRAL54 Merge text.love
  • [72] JOPVPUSA editing source code from within the app
  • [73] TLOAPLBJ add a license
  • [74] 6LJZN727 handle chords
  • [75] CE4LZV4T drop last couple of manual tests
  • [76] OGUV4HSA remove some memory leaks from rendered fragments
  • [77] 4SR3Z4Y3 document the version of LÖVE I've been using
  • [78] ZLJYLPOT Merge lines.love
  • [79] ORKN6EOB Merge lines.love
  • [80] D2GCFTTT clean up repl functionality

Change contents

  • file deletion: source_file.lua (----------)source_file.lua (----------)
    [6.2][6.152462:152501](),[6.2][6.152462:152501](),[6.152501][6.150304:150304]()
    local outfile = App.open_for_writing(App.save_dir..State.filename)
    if outfile == nil then
    error('failed to write to "'..State.filename..'"')
    end
    for _,line in ipairs(State.lines) do
    local infile = App.open_for_reading(App.save_dir..State.filename)
    if not infile then
    infile = App.open_for_reading(App.source_dir..State.filename)
    end
    State.lines = load_from_file(infile)
    if infile then infile:close() end
    end
    function load_from_file(infile)
    local result = {}
    if infile then
    local infile_next_line = infile:lines() -- works with both Lua files and LÖVE Files (https://www.love2d.org/wiki/File)
    while true do
    local line = infile_next_line()
    if line == nil then break end
    -- the source editor supports only files in the save dir backed by the source dir
    function load_from_disk(State)
    local infile = App.open_for_reading(App.save_dir..filename)
    if not infile then
    infile = App.open_for_reading(App.source_dir..filename)
    end
    if infile then
    infile:close()
    return true
    else
    return false
    end
    end
  • file deletion: source_edit.lua (----------)source_edit.lua (----------)
    [6.2][6.165788:165827](),[6.2][6.165788:165827](),[6.165827][6.152503:152503]()
    local clipboard_data = App.get_clipboard()
    for _,code in utf8.codes(clipboard_data) do
    local c = utf8.char(code)
    if c == '\n' then
    Text.insert_return(State)
    else
    Text.insert_at_cursor(State, c)
    end
    end
    if Text.cursor_out_of_screen(State) then
    Text.snap_cursor_to_bottom_of_screen(State, State.left, State.right)
    end
    schedule_save(State)
    record_undo_event(State, {before=before, after=snapshot(State, before_line, State.cursor1.line)})
    App.set_clipboard(s)
    end
    schedule_save(State)
    elseif chord == 'C-v' then
    for _,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.line
    local before = snapshot(State, before_line)
    App.set_clipboard(s)
    end
    elseif chord == 'C-x' then
    for _,line_cache in ipairs(State.line_cache) do line_cache.starty = nil end -- just in case we scroll
    local s = Text.cut_selection(State, State.left, State.right)
    if s then
  • resurrect zombie in app.lua at line 171
    [6.2154][4.28:33](),[6.2154][4.28:33]()
    end
  • edit in app.lua at line 173
    [4.33][6.2155:2230](),[6.387][6.2155:2230](),[6.387][6.2155:2230]()
    -- If you access the time using App.getTime instead of love.timer.getTime,
  • resurrect zombie in app.lua at line 173
    [6.387][6.462:538](),[6.387][6.462:538]()
    -- If you access the time using App.get_time instead of love.timer.getTime,
  • resolve order conflict in app.lua at line 173
    [4.33]
    [6.462]
  • resurrect zombie in app.lua at line 174
    [6.538][6.2230:2332](),[6.2230][6.2230:2332](),[6.2230][6.2230:2332]()
    -- tests will be able to move the time back and forwards as needed using
    -- App.wait_fake_time below.
  • edit in app.lua at line 384
    [6.8162][6.8570:8726](),[6.8162][6.8570:8726]()
    App.open_for_reading = function(filename) return io.open(filename, 'r') end
    App.open_for_writing = function(filename) return io.open(filename, 'w') end
  • resurrect zombie in app.lua at line 384
    [6.8029][6.16028:16250](),[6.8029][6.16028:16250](),[6.636][6.16251:16483](),[6.636][6.16251:16483](),[6.907][6.16484:16700](),[6.907][6.16484:16700](),[6.16700][6.880:1018](),[6.913][6.880:1018](),[6.913][6.880:1018]()
    App.open_for_reading =
    function(filename)
    local result = nativefs.newFile(filename)
    local ok, err = result:open('r')
    if ok then
    return result
    else
    return ok, err
    end
    App.open_for_writing =
    function(filename)
    local result = nativefs.newFile(filename)
    local ok, err = result:open('w')
    if ok then
    return result
    else
    return ok, err
    end
    App.files = nativefs.getDirectoryItems
    App.source_dir = love.filesystem.getSource()..'/'
    App.current_dir = nativefs.getWorkingDirectory()..'/'
    App.save_dir = love.filesystem.getSaveDirectory()..'/'
    App.get_time = love.timer.getTime
    App.get_clipboard = love.system.getClipboardText
    App.set_clipboard = love.system.setClipboardText
  • edit in app.lua at line 392
    [6.16250]
    [6.16251]
    end
  • edit in app.lua at line 402
    [6.16483]
    [6.16484]
    end