generalize a function

[?]
Aug 18, 2022, 5:22 PM
GNQC72UXBU6KYXW6MXLNRGTLXV2VPQXMVCLYMJT6POTFXSF5ASJAC

Dependencies

  • [2] ZW3JGTEO drop some obsolete args
  • [3] SVJZZDC3 snapshot - no, that's all wrong
  • [4] ZPUQSPQP extract a few methods
  • [5] 4J2L6JMR bugfix: deleting a selection spanning pages
  • [6] ILOA5BYF separate data structure for each line's cache data
  • [7] ELJNEPW2 simplify cursor-on-screen check
  • [8] MXA3RZYK deduce left/right from state where possible
  • [9] 2EKE4XLL simplify
  • [10] 2TQR4PSY add args to some functions
  • [11] KOYAJWE4 extract a couple more methods
  • [12] LF7BWEG4 group all editor globals
  • [13] UHB4GARJ left/right margin -> left/right coordinates
  • [14] XNFTJHC4 split keyboard handling between Text and Drawing
  • [15] ODLKHO7B switch to line index in a function
  • [16] S2MISTTM add state arg to a few functions
  • [17] NHNP76LG swap return values
  • [18] LXTTOB33 extract a couple of files
  • [19] YJJ4X4JG bugfix: avoid scrolling on 'end'
  • [20] 5ZA3BRNY add state arg to a few functions
  • [21] WOXIYUTL bugfix: manage screen_top and cursor when resizing
  • [22] HTWAM4NZ bugfix: scrolling in left/right movements
  • [23] Z5HLXU4P add state arg to a few functions
  • [24] TGHAJBES use line cache for drawings as well
  • [25] WLJCIXYM add state arg to a few functions
  • [*] BULPIBEG beginnings of a module for the text editor

Change contents

  • replacement in text.lua at line 429
    [3.4029][3.3:104]()
    local screen_line_starting_pos, screen_line_index = Text.pos_at_start_of_cursor_screen_line(State)
    [3.4029]
    [3.295]
    local screen_line_starting_pos, screen_line_index = Text.pos_at_start_of_screen_line(State, State.cursor1)
  • replacement in text.lua at line 503
    [3.3993][3.105:208]()
    local screen_line_starting_pos, screen_line_index = Text.pos_at_start_of_cursor_screen_line(State)
    [3.3993]
    [3.570]
    local screen_line_starting_pos, screen_line_index = Text.pos_at_start_of_screen_line(State, State.cursor1)
  • replacement in text.lua at line 528
    [3.7851][3.209:273]()
    local botpos = Text.pos_at_start_of_cursor_screen_line(State)
    [3.7851]
    [3.7852]
    local botpos = Text.pos_at_start_of_screen_line(State, State.cursor1)
  • replacement in text.lua at line 639
    [3.1332][3.2287:2343](),[3.2343][3.283:351](),[3.351][3.689:850](),[3.850][3.768:806](),[3.5047][3.768:806](),[3.768][3.768:806]()
    function Text.pos_at_start_of_cursor_screen_line(State)
    Text.populate_screen_line_starting_pos(State, State.cursor1.line)
    for i=#State.line_cache[State.cursor1.line].screen_line_starting_pos,1,-1 do
    local spos = State.line_cache[State.cursor1.line].screen_line_starting_pos[i]
    if spos <= State.cursor1.pos then
    [3.1332]
    [3.274]
    function Text.pos_at_start_of_screen_line(State, loc1)
    Text.populate_screen_line_starting_pos(State, loc1.line)
    local line_cache = State.line_cache[loc1.line]
    for i=#line_cache.screen_line_starting_pos,1,-1 do
    local spos = line_cache.screen_line_starting_pos[i]
    if spos <= loc1.pos then
  • replacement in text.lua at line 988
    [3.419][3.295:363]()
    --? local botpos = Text.pos_at_start_of_cursor_screen_line(State)
    [3.419]
    [3.1062]
    --? local botpos = Text.pos_at_start_of_screen_line(State, State.cursor1)
  • replacement in select.lua at line 133
    [3.2509][3.366:441]()
    State.screen_top1.pos = Text.pos_at_start_of_cursor_screen_line(State)
    [3.2509]
    [3.1160]
    State.screen_top1.pos = Text.pos_at_start_of_screen_line(State, State.cursor1)
  • replacement in search.lua at line 65
    [3.880][2.6:69]()
    local pos = Text.pos_at_start_of_cursor_screen_line(State)
    [3.880]
    [3.1002]
    local pos = Text.pos_at_start_of_screen_line(State, State.cursor1)
  • replacement in search.lua at line 113
    [3.1925][2.70:133]()
    local pos = Text.pos_at_start_of_cursor_screen_line(State)
    [3.1925]
    [3.2047]
    local pos = Text.pos_at_start_of_screen_line(State, State.cursor1)