Merge upstream into main

[?]
Jul 13, 2022, 6:16 AM
MSDHRXWUFZFE6DZTRMJLLCKZYW4RDMNYK367X5NFKKNP55EJJ7VAC

Dependencies

  • [2] ZLEPKWDJ fork: capture frontend for a note-taking system
  • [3] UHB4GARJ left/right margin -> left/right coordinates
  • [4] VIU2FBNV make sure to save right when quitting
  • [5] BPWFKBXT new test: dragging and dropping a file on lines.love
  • [6] XSLCFVFH .
  • [7] 5MR22SGZ bugfix: enable resize when loading settings
  • [8] AM42E4Y6 avoid redundant writes on exit
  • [9] DWZK32YD include CWD when saving filename
  • [10] 2L5MEZV3 experiment: new edit namespace
  • [11] LF7BWEG4 group all editor globals
  • [12] MHOUX5JF experiment: turn off JIT
  • [13] O6T3TPXD bugfix: position cursor up top when loading file
  • [14] WQOSZSUE warn on unused commandline args
  • [15] ZZ2B5RPQ extract variables for drawing padding
  • [16] K464QQR4 more defensive resize handling
  • [17] 7M7LS7I2 start saving some settings to disk on quit
  • [18] IZZVOCLB confirm that we have access to all of the love API
  • [19] W4UVZETR 2 regressions:
  • [20] OTIBCAUJ love2d scaffold
  • [21] PWHZPJJM always show current filename in window title
  • [22] VHQCNMAR several more modules
  • [23] 2RXZ3PGO beginning of a new approach to scroll+wrap
  • [24] QCQHLMST always have a filename
  • [25] YGCT2D2O start loading settings as applicable
  • [26] LNUHQOGH start passing in Editor_state explicitly
  • [27] R6GUSTBY default font size and line-height
  • [28] HPVT467W initialize contains test state
  • [29] AVTNUQYR basic test-enabled framework
  • [30] 6LJZN727 handle chords
  • [31] MGOQ5XAV start uppercasing globals
  • [32] 5T2E3PDV couple of bugfixes to file-handling
  • [33] HOSPP2AN crisp font rendering
  • [34] VO3GEIRW use app name in window title
  • [35] YT5P6TO6 bugfix: save previous file when dropping a new one on
  • [36] AD34IX2Z couple more tests
  • [37] Z4KNS42N to open a file without a terminal, drag it on!
  • [38] PGZJ6NAT ensure Filename is writable when opened outside a terminal
  • [39] CE4LZV4T drop last couple of manual tests
  • [40] AVQ5MC5D finish uppercasing all globals
  • [41] 4CTZOJPC stop pretending globals are local
  • [42] PTDO2SOT add state arg to schedule_save
  • [43] BJ5X5O4A let's prevent the text cursor from ever getting on a drawing
  • [44] YPHKZVWM extract a new variable
  • [45] LAW2O3NW extract variable Margin_left
  • [46] S7ZZA3YE ugh, handle absolute as well as relative paths
  • [47] PX7DDEMO autosave slightly less aggressively
  • [48] 73OCE2MC after much struggle, a brute-force undo
  • [49] V5TP27FP ctrl-+ and ctrl-- to adjust font size
  • [50] UYRAO73Y enable pressing and holding backspace
  • [51] YKRF5V3Z starting to load/save
  • [52] 2KRK3OBV don't rely on defaults

Change contents

  • edit in main_tests.lua at line 12
    [4.631][4.84826:85118](),[4.631][4.84826:85118](),[4.64][3.17142:17201](),[4.64][3.17142:17201](),[4.234][4.85186:85266](),[4.234][4.85186:85266](),[4.85266][4.167:197](),[4.85266][4.167:197](),[4.99][3.17202:17261](),[4.99][3.17202:17261]()
    check_eq(#Editor_state.lines, 3, 'F - test_drop_file/#lines')
    check_eq(Editor_state.lines[1].data, 'abc', 'F - test_drop_file/lines:1')
    check_eq(Editor_state.lines[2].data, 'def', 'F - test_drop_file/lines:2')
    check_eq(Editor_state.lines[3].data, 'ghi', 'F - test_drop_file/lines:3')
    App.screen.init{width=Editor_state.left+300, height=300}
    Editor_state.lines = load_array{'abc', 'def'}
    Editor_state.filename = 'foo'
    schedule_save(Editor_state)
    App.screen.init{width=Editor_state.left+300, height=300}
  • edit in main.lua at line 17
    [4.4][2.8:147](),[4.4][2.8:147]()
    Directory = love.filesystem.getUserDirectory()..'/pensieve'
    Filename = love.filesystem.getUserDirectory()..'/lines.txt' -- just for tests
  • edit in main.lua at line 40
    [2.168][2.168:303](),[4.63][4.85310:85546](),[4.63][4.85310:85546](),[4.319][4.85547:85585](),[4.319][4.85547:85585](),[4.383][4.85586:85823](),[4.383][4.85586:85823](),[4.540][4.85824:85864](),[4.540][4.85824:85864](),[4.466][4.85865:85928](),[4.466][4.85865:85928]()
    Filename = Directory..os.date('/%Y/%m/%d/%H-%M-%S')
    os.execute('mkdir -p '..dirname(Filename))
    assert(not file_exists(Filename))
    Editor_state.filename = arg[1]
    Editor_state.lines = load_from_disk(Editor_state.filename)
    Editor_state.screen_top1 = {line=1, pos=1}
    Editor_state.cursor1 = {line=1, pos=1}
    for i,line in ipairs(Editor_state.lines) do
    Editor_state.cursor1.line = i
    Editor_state.lines = load_from_disk(Editor_state.filename)
    if Editor_state.cursor1.line > #Editor_state.lines or Editor_state.lines[Editor_state.cursor1.line].mode ~= 'text' then
    for i,line in ipairs(Editor_state.lines) do
    Editor_state.cursor1.line = i
    love.window.setTitle('lines.love - '..Editor_state.filename)
  • resolve order conflict in main.lua at line 40
    [2.168]
  • edit in main.lua at line 40
    [0.9]
    [4.8]
    Editor_state.filename = Editor_state.directory..os.date('/%Y/%m/%d/%H-%M-%S')
    os.execute('mkdir -p '..dirname(Editor_state.filename))
    assert(not file_exists(Editor_state.filename))
  • replacement in main.lua at line 44
    [4.9][2.304:356]()
    love.window.setTitle('capture.love - '..Filename)
    [4.9]
    [4.8]
    love.window.setTitle('capture.love - '..Editor_state.filename)
  • edit in main.lua at line 66
    [3.17444][4.85929:85973](),[4.517][4.85929:85973]()
    Editor_state.filename = settings.filename
  • edit in main.lua at line 70
    [3.17700][4.85974:86064](),[4.983][4.85974:86064]()
    Editor_state.screen_top1 = settings.screen_top
    Editor_state.cursor1 = settings.cursor
  • edit in main.lua at line 105
    [4.1059][4.86541:86634](),[4.1059][4.86541:86634](),[4.8235][4.86635:86680](),[4.8235][4.86635:86680](),[4.88][4.86681:86725](),[4.88][4.86681:86725](),[4.16][4.86726:86772](),[4.16][4.86726:86772](),[4.532][4.86773:86809](),[4.532][4.86773:86809](),[4.568][4.86810:86891](),[4.568][4.86810:86891]()
    if Editor_state.next_save then
    save_to_disk(Editor_state.lines, Editor_state.filename)
    Editor_state.filename = file:getFilename()
    Editor_state.lines = load_from_file(file)
    for i,line in ipairs(Editor_state.lines) do
    Editor_state.cursor1.line = i
    love.window.setTitle('Text with Editor_state.lines - '..Editor_state.filename)
  • edit in main.lua at line 127
    [4.135][4.86892:86933](),[4.86933][4.36:181](),[4.36][4.36:181]()
    local filename = Editor_state.filename
    if filename:sub(1,1) ~= '/' then
    filename = love.filesystem.getWorkingDirectory()..'/'..filename -- '/' should work even on Windows
    end
  • replacement in main.lua at line 131
    [4.86976][4.182:205](),[4.37][4.182:205](),[4.205][4.86977:87047]()
    filename=filename,
    screen_top=Editor_state.screen_top1, cursor=Editor_state.cursor1}
    [4.86976]
    [4.339]
    }
  • edit in file.lua at line 2
    [4.15167][2.363:364](),[4.15167][2.363:364]()
  • resurrect zombie in file.lua at line 2
    [2.364][2.364:529](),[2.364][2.364:529]()
    function file_exists(filename)
    local infile = App.open_for_reading(filename)
    if infile then
    infile:close()
    return true
    else
    return false
    end
    end
  • edit in file.lua at line 11
    [2.529]
    [4.15168]
  • replacement in edit.lua at line 106
    [4.3616][4.97595:97660]()
    filename = love.filesystem.getUserDirectory()..'/lines.txt',
    [4.3616]
    [4.97660]
    directory = love.filesystem.getUserDirectory()..'/pensieve',
    filename = love.filesystem.getUserDirectory()..'/lines.txt', -- just for tests