several bugfixes in saving/loading cursor position

[?]
Jun 8, 2023, 8:02 AM
SW7BSBMJZLUDRMHO2HMCHQW6PPGCEBL4JSDTAHVYPCZLBEKY54XQC

Dependencies

  • [2] NFI42KGX more correct absolute path detection
  • [3] ZQDQLLCL bugfix
  • [4] 5RDWSYK2 consistently use App names for methods everywhere
  • [5] AF253GHL bugfix
  • [6] EWJZ6XHB better formatting
  • [7] 2L5MEZV3 experiment: new edit namespace
  • [8] CQYKYJJU remember window positions across restart/ctrl+e
  • [9] QZ2SXLHF some debug prints
  • [10] ZJOSQFN6 bugfix: path munging on Windows
  • [11] 7VGDIPLC more robust state validation
  • [12] KKMFQDR4 editing source code from within the app
  • [*] BJ5X5O4A let's prevent the text cursor from ever getting on a drawing

Change contents

  • replacement in run.lua at line 22
    [7.178636][7.178636:178655]()
    if #arg > 0 then
    [7.178636]
    [7.178655]
    if #arg > 0 and Editor_state.filename ~= absolutize(arg[1]) then
  • edit in run.lua at line 156
    [4.653][7.198:204](),[7.198][7.198:204](),[7.204][7.182570:182611](),[7.182570][7.182570:182611](),[7.182611][2.652:793]()
    end
    local filename = Editor_state.filename
    if is_relative_path(filename) then
    filename = love.filesystem.getWorkingDirectory()..'/'..filename -- '/' should work even on Windows
  • replacement in run.lua at line 161
    [7.182904][7.182904:182927]()
    filename=filename,
    [7.182904]
    [7.182927]
    filename=absolutize(Editor_state.filename),
  • edit in run.lua at line 166
    [7.183005]
    [3.16]
    function absolutize(path)
    if is_relative_path(path) then
    return love.filesystem.getWorkingDirectory()..'/'..path -- '/' should work even on Windows
    end
    return path
    end
  • replacement in edit.lua at line 112
    [7.286][7.286:331]()
    or edit.invalid1(State, State.cursor1)
    [7.286]
    [7.331]
    or edit.invalid_cursor1(State)
  • edit in edit.lua at line 125
    [5.258]
    [7.648]
    end
    -- cursor loc in particular differs from other locs in one way:
    -- pos might occur just after end of line
    function edit.invalid_cursor1(State)
    local cursor1 = State.cursor1
    if cursor1.line > #State.lines then return true end
    local l = State.lines[cursor1.line]
    if l.mode ~= 'text' then return false end -- pos is irrelevant to validity for a drawing line
    return cursor1.pos > #State.lines[cursor1.line].data + 1
  • edit in Manual_tests.md at line 8
    [6.151]
    [6.151]
    - run with a filename on commandline, scroll around, quit; restart without a filename; window opens running the text editor in same position+dimensions
    - run with a filename on commandline, scroll around, quit; restart with same filename; window opens running the text editor in same position+dimensions
    - run with a filename on commandline, scroll around, quit; restart with new filename; window opens new filename with cursor up top
    - run editor, scroll around, move cursor to end of some line, quit; restart with new filename; window opens running the text editor in same position+dimensions