check for scroll when just typing

[?]
Jun 5, 2022, 3:29 PM
NZKYPBSKYJ7NQU7ABRHLYZ2P2P5V2UF76OLRURGTGRUB54R4SPBQC

Dependencies

  • [2] LXTTOB33 extract a couple of files
  • [3] CUIV2LE5 some typos
  • [*] BULPIBEG beginnings of a module for the text editor
  • [*] WY3JD6W6 bugfix
  • [*] 2RXZ3PGO beginning of a new approach to scroll+wrap
  • [*] XNFTJHC4 split keyboard handling between Text and Drawing

Change contents

  • edit in text_tests.lua at line 81
    [2.2727]
    [2.2727]
    App.draw()
  • edit in text_tests.lua at line 86
    [2.2851][2.2851:2913]()
    App.run_after_textinput('k')
    App.run_after_textinput('l')
  • edit in text_tests.lua at line 729
    [2.31401]
    [2.31401]
    function test_typing_on_bottom_line_scrolls_down()
    io.write('\ntest_typing_on_bottom_line_scrolls_down')
    -- display a few lines with cursor on bottom line
    App.screen.init{width=25+30, height=60}
    Lines = load_array{'abc', 'def', 'ghi', 'jkl'}
    Line_width = App.screen.width
    Cursor1 = {line=3, pos=4}
    Screen_top1 = {line=1, pos=1}
    Screen_bottom1 = {}
    App.draw()
    local y = Margin_top
    App.screen.check(y, 'abc', 'F - test_typing_on_bottom_line_scrolls_down/baseline/screen:1')
    y = y + Line_height
    App.screen.check(y, 'def', 'F - test_typing_on_bottom_line_scrolls_down/baseline/screen:2')
    y = y + Line_height
    App.screen.check(y, 'ghi', 'F - test_typing_on_bottom_line_scrolls_down/baseline/screen:3')
    -- after typing something the line wraps and the screen scrolls down
    App.run_after_textinput('j')
    App.run_after_textinput('k')
    App.run_after_textinput('l')
    check_eq(Screen_top1.line, 2, 'F - test_typing_on_bottom_line_scrolls_down/screen_top')
    check_eq(Cursor1.line, 3, 'F - test_typing_on_bottom_line_scrolls_down/cursor:line')
    check_eq(Cursor1.pos, 7, 'F - test_typing_on_bottom_line_scrolls_down/cursor:pos')
    y = Margin_top
    App.screen.check(y, 'def', 'F - test_typing_on_bottom_line_scrolls_down/screen:1')
    y = y + Line_height
    App.screen.check(y, 'ghijk', 'F - test_typing_on_bottom_line_scrolls_down/screen:2')
    y = y + Line_height
    App.screen.check(y, 'l', 'F - test_typing_on_bottom_line_scrolls_down/screen:3')
    end
  • edit in text_tests.lua at line 957
    [2.40830]
    [2.40830]
    App.draw()
  • edit in text.lua at line 158
    [6.2105]
    [7.733]
    local scroll_down = Text.le1(Screen_bottom1, Cursor1)
  • edit in text.lua at line 160
    [7.763]
    [8.513]
    if scroll_down then
    Text.populate_screen_line_starting_pos(Cursor1.line)
    Text.snap_cursor_to_bottom_of_screen()
    end