bugfix in source editor

akkartik
Jun 10, 2024, 3:35 AM
JYB3RFWHD6IXYGHJ77BEILJ5QNRPPH77DITIH4PKZM4D4OZSHRVQC

Dependencies

  • [2] 656FM555 bugfix: clear selection when clicking above or below lines
  • [3] G54H3YG2 get rid of all bifold text
  • [4] ORRSP7FV deduce test names on failures
  • [5] KMSL74GA support selections in the source editor
  • [6] OI4FPFIN support drawings in the source editor
  • [7] 5SM6DRHK port inscript's bugfix to source editor
  • [8] KKMFQDR4 editing source code from within the app
  • [*] KYNGDE2C consistent names in a few more places

Change contents

  • replacement in source_text_tests.lua at line 19
    [3.2352][3.2352:2392]()
    App.screen.init{width=120, height=60}
    [3.2307]
    [3.2392]
    App.screen.init{width=800, height=600}
  • edit in source_text.lua at line 686
    [3.3828]
    [3.3828]
    assert(State.lines[loc1.line].mode == 'text')
  • edit in source_text.lua at line 700
    [3.4251]
    [3.125621]
    function Text.final_text_loc_on_screen(State)
    if State.lines[State.screen_bottom1.line].mode == 'text' then
    return {
    line=State.screen_bottom1.line,
    pos=Text.pos_at_end_of_screen_line(State, State.screen_bottom1),
    }
    end
    local loc2 = Text.to2(State, State.screen_bottom1)
    while true do
    if State.lines[loc2.line].mode == 'text' then break end
    assert(loc2.line > 1 or loc2.screen_line > 1 and loc2.screen_pos > 1) -- elsewhere we're making sure there's always at least one text line on screen
    loc2 = Text.previous_screen_line(State, loc2)
    end
    local result = Text.to1(State, loc2)
    result.pos = Text.pos_at_end_of_screen_line(State, result)
    return result
    end
  • edit in source_edit.lua at line 71
    [3.154462]
    [3.6171]
    --
    -- On lines that are drawings, pos will be nil.
  • replacement in source_edit.lua at line 74
    [3.6260][3.6260:6314]()
    cursor1 = {line=1, pos=1}, -- position of cursor
    [3.6260]
    [3.6314]
    cursor1 = {line=1, pos=1}, -- position of cursor; must be on a text line
  • edit in source_edit.lua at line 195
    [3.20733]
    [3.20733]
    for _,line_cache in ipairs(State.line_cache) do line_cache.starty = nil end
  • replacement in source_edit.lua at line 302
    [3.5391][3.5391:5527]()
    State.selection1 = {
    line=State.screen_bottom1.line,
    pos=Text.pos_at_end_of_screen_line(State, State.screen_bottom1),
    }
    [3.5391]
    [3.157693]
    State.selection1 = Text.final_text_loc_on_screen(State)
  • replacement in source_edit.lua at line 340
    [2.2277][2.2277:2408]()
    State.cursor1.line, State.cursor1.pos = State.screen_bottom1.line, Text.pos_at_end_of_screen_line(State, State.screen_bottom1)
    [2.2277]
    [2.2408]
    State.cursor1 = Text.final_text_loc_on_screen(State)
  • edit in source_edit.lua at line 603
    [10.176]
    [3.165173]
    edit.draw(State)