another bugfix in scrolling while inserting text

[?]
Jun 5, 2022, 5:08 PM
QKAMUWSB6GWKEGLXFKALGCIU7HBTZ4YGLIR7TLA6ZZCUK7WNCNUQC

Dependencies

  • [2] NZKYPBSK check for scroll when just typing
  • [3] WY3JD6W6 bugfix
  • [4] CUIV2LE5 some typos
  • [5] VJ77YABH more efficient undo/redo
  • [6] 73OCE2MC after much struggle, a brute-force undo
  • [7] 2RXZ3PGO beginning of a new approach to scroll+wrap
  • [8] KOTI3MFG bugfix in previous commit
  • [9] LXTTOB33 extract a couple of files
  • [10] ZLJGZYQG select text with shift + mouseclick
  • [11] XNFTJHC4 split keyboard handling between Text and Drawing
  • [*] BULPIBEG beginnings of a module for the text editor
  • [*] OTIBCAUJ love2d scaffold
  • [*] DLQMM265 scroll past first page
  • [*] HOSPP2AN crisp font rendering

Change contents

  • replacement in text_tests.lua at line 135
    [3.4452][3.4452:4504]()
    -- display a few lines with cursor on bottom line
    [3.4452]
    [3.4504]
    -- display a few lines
  • replacement in text_tests.lua at line 149
    [3.5032][3.5032:5089]()
    -- after hitting the enter key the screen scrolls down
    [3.5032]
    [3.5089]
    -- paste some text including a newline, check that new line is created
  • edit in text_tests.lua at line 739
    [3.31401]
    [2.16]
    function test_inserting_text_on_final_line_avoids_scrolling_down_when_not_at_bottom()
    io.write('\ntest_inserting_text_on_final_line_avoids_scrolling_down_when_not_at_bottom')
    -- display just an empty bottom line on screen
    App.screen.init{width=25+30, height=60}
    Lines = load_array{'abc', ''}
    Line_width = App.screen.width
    Cursor1 = {line=2, pos=1}
    Screen_top1 = {line=2, pos=1}
    Screen_bottom1 = {}
    App.draw()
    -- after hitting the inserting_text key the screen does not scroll down
    App.run_after_textinput('a')
    check_eq(Screen_top1.line, 2, 'F - test_inserting_text_on_final_line_avoids_scrolling_down_when_not_at_bottom/screen_top')
    check_eq(Cursor1.line, 2, 'F - test_inserting_text_on_final_line_avoids_scrolling_down_when_not_at_bottom/cursor:line')
    check_eq(Cursor1.pos, 2, 'F - test_inserting_text_on_final_line_avoids_scrolling_down_when_not_at_bottom/cursor:pos')
    local y = Margin_top
    App.screen.check(y, 'a', 'F - test_inserting_text_on_final_line_avoids_scrolling_down_when_not_at_bottom/screen:1')
    end
  • edit in text.lua at line 159
    [3.2105][2.1505:1561]()
    local scroll_down = Text.le1(Screen_bottom1, Cursor1)
  • replacement in text.lua at line 160
    [3.763][2.1562:1584]()
    if scroll_down then
    [3.763]
    [2.1584]
    if Cursor_y >= App.screen.height - Line_height then
  • edit in main.lua at line 169
    [15.1391]
    [16.4221]
    Screen_bottom1.pos = Screen_top1.pos