another piece of support for line wrapping in cursor up

[?]
May 20, 2022, 10:19 PM
C42QQZSFFGU6DZ73MCPGYZJQ675YTMEOJAPQLHKRJLWQH5GMWHMQC

Dependencies

  • [2] MGT5FTJ3 first stab at supporting wrapping in cursor up
  • [3] XNFTJHC4 split keyboard handling between Text and Drawing
  • [*] BULPIBEG beginnings of a module for the text editor
  • [*] BJ5X5O4A let's prevent the text cursor from ever getting on a drawing

Change contents

  • replacement in text.lua at line 230
    [2.477][2.477:556]()
    Cursor_pos = Text.nearest_cursor_pos(Lines[Cursor_line].data, old_x)
    [2.477]
    [2.556]
    if Lines[Cursor_line].screen_line_starting_pos == nil then
    Cursor_pos = Text.nearest_cursor_pos(Lines[Cursor_line].data, old_x)
    break
    end
    local screen_line_starting_pos = Lines[Cursor_line].screen_line_starting_pos
    screen_line_starting_pos = screen_line_starting_pos[#screen_line_starting_pos]
    Top_screen_line_starting_pos = screen_line_starting_pos
    local s = string.sub(Lines[Cursor_line].data, screen_line_starting_pos)
    Cursor_pos = screen_line_starting_pos + Text.nearest_cursor_pos(s, old_x) - 1
  • edit in manual_tests at line 26
    [2.1511]
    [2.1511]
    if previous line (above top of screen) wrapped, it scrolls up by only one screen line