bugfix

[?]
May 25, 2022, 9:31 PM
WY3JD6W6EANKQC4SRRIAM2Q3QZNVOGN3MIMBL3M55S4ZZSJFSF2AC

Dependencies

  • [2] 4RUI5X52 a few tests for pageup, and a bugfix
  • [*] BULPIBEG beginnings of a module for the text editor
  • [*] PFT5Y2ZY move
  • [*] 2RXZ3PGO beginning of a new approach to scroll+wrap

Change contents

  • edit in text.lua at line 660
    [2.4097]
    [5.1]
    function test_position_cursor_on_recently_edited_wrapping_line()
    -- draw a line wrapping over 2 screen lines
    io.write('\ntest_position_cursor_on_recently_edited_wrapping_line')
    App.screen.init{width=120, height=200}
    Lines = load_array{'abc def ghi jkl mno pqr ', 'xyz'}
    Line_width = 100
    Cursor1 = {line=1, pos=25}
    Screen_top1 = {line=1, pos=1}
    Screen_bottom1 = {}
    Zoom = 1
    App.draw()
    local screen_top_margin = 15 -- pixels
    local line_height = 15 -- pixels
    local y = screen_top_margin
    -- I don't understand why 120px fits so much on a fake screen, but whatever..
    App.screen.check(y, 'abc def ghi ', 'F - test_position_cursor_on_recently_edited_wrapping_line/baseline1/screen:1')
    y = y + line_height
    App.screen.check(y, 'jkl mno pqr ', 'F - test_position_cursor_on_recently_edited_wrapping_line/baseline1/screen:2')
    y = y + line_height
    App.screen.check(y, 'xyz', 'F - test_position_cursor_on_recently_edited_wrapping_line/baseline1/screen:3')
    -- add to the line until it's wrapping over 3 screen lines
    App.run_after_textinput('s')
    App.run_after_textinput('t')
    App.run_after_textinput('u')
    check_eq(Cursor1.pos, 28, 'F - test_move_cursor_using_mouse/cursor:pos')
    y = screen_top_margin
    App.screen.check(y, 'abc def ghi ', 'F - test_position_cursor_on_recently_edited_wrapping_line/baseline2/screen:1')
    y = y + line_height
    App.screen.check(y, 'jkl mno pqr ', 'F - test_position_cursor_on_recently_edited_wrapping_line/baseline2/screen:2')
    y = y + line_height
    App.screen.check(y, 'stu', 'F - test_position_cursor_on_recently_edited_wrapping_line/baseline2/screen:3')
    -- try to move the cursor earlier in the third screen line by clicking the mouse
    local screen_top_margin = 15 -- pixels
    local screen_left_margin = 25 -- pixels
    App.run_after_mousepress(screen_left_margin+8,screen_top_margin+15*2+5, '1')
    -- cursor should move
    check_eq(Cursor1.line, 1, 'F - test_move_cursor_using_mouse/cursor:line')
    check_eq(Cursor1.pos, 26, 'F - test_move_cursor_using_mouse/cursor:pos')
    end
  • edit in text.lua at line 754
    [6.733]
    [6.733]
    Lines[Cursor1.line].screen_line_starting_pos = nil