add state arg to a few functions

[?]
Jul 13, 2022, 12:14 AM
WLJCIXYMSTCNSYCFOEBQNDLBZ5D2Z3WTF4E4WYL5CFGIJ434FKNQC

Dependencies

  • [2] S2MISTTM add state arg to a few functions
  • [3] F65ADDGL add state arg to a few functions
  • [4] ZHLO7K3M add args to some functions
  • [5] 2TQR4PSY add args to some functions
  • [6] LF7BWEG4 group all editor globals
  • [7] LNUHQOGH start passing in Editor_state explicitly
  • [8] ZPUQSPQP extract a few methods
  • [9] QCQTMUZ7 add args to some functions
  • [10] WOXIYUTL bugfix: manage screen_top and cursor when resizing
  • [11] CUIV2LE5 some typos
  • [12] PIEDOKYQ bugfix
  • [13] 2H67P75X switch arg for a function
  • [14] 62PZGSUC optimization: moving cursor to next word
  • [15] SVJZZDC3 snapshot - no, that's all wrong
  • [16] YJJ4X4JG bugfix: avoid scrolling on 'end'
  • [17] Z5HLXU4P add state arg to a few functions
  • [18] KOYAJWE4 extract a couple more methods
  • [19] 2L5MEZV3 experiment: new edit namespace
  • [20] 4J2L6JMR bugfix: deleting a selection spanning pages
  • [21] HTWAM4NZ bugfix: scrolling in left/right movements
  • [22] UV4EWOLY add args to some functions
  • [23] LXTTOB33 extract a couple of files
  • [24] KECEMMMR extract couple of functions
  • [*] BULPIBEG beginnings of a module for the text editor

Change contents

  • replacement in text.lua at line 406
    [4.4029][4.3:109](),[4.67900][4.3:109](),[4.232][4.3:109]()
    local screen_line_index,screen_line_starting_pos = Text.pos_at_start_of_cursor_screen_line(left, right)
    [4.4029]
    [4.295]
    local screen_line_index,screen_line_starting_pos = Text.pos_at_start_of_cursor_screen_line(State, left, right)
  • replacement in text.lua at line 483
    [4.3993][4.110:219]()
    local screen_line_index, screen_line_starting_pos = Text.pos_at_start_of_cursor_screen_line(left, right)
    [4.3993]
    [4.6767]
    local screen_line_index, screen_line_starting_pos = Text.pos_at_start_of_cursor_screen_line(State, left, right)
  • replacement in text.lua at line 508
    [4.7851][4.220:292](),[4.72225][4.220:292](),[4.6343][4.220:292]()
    local _,botpos = Text.pos_at_start_of_cursor_screen_line(left, right)
    [4.7851]
    [4.7852]
    local _,botpos = Text.pos_at_start_of_cursor_screen_line(State, left, right)
  • replacement in text.lua at line 510
    [4.7909][4.3:46](),[4.72290][4.3:46](),[4.6455][4.3:46]()
    if Text.cursor_past_screen_bottom() then
    [4.7909]
    [4.379]
    if Text.cursor_past_screen_bottom(State) then
  • replacement in text.lua at line 559
    [4.42][4.42:85]()
    if Text.cursor_past_screen_bottom() then
    [4.42]
    [4.434]
    if Text.cursor_past_screen_bottom(State) then
  • replacement in text.lua at line 597
    [3.780][4.159:202](),[4.159][4.159:202]()
    if Text.cursor_past_screen_bottom() then
    [3.780]
    [4.489]
    if Text.cursor_past_screen_bottom(State) then
  • replacement in text.lua at line 619
    [4.1332][4.293:355](),[4.355][4.74171:74496]()
    function Text.pos_at_start_of_cursor_screen_line(left, right)
    Text.populate_screen_line_starting_pos(Editor_state.lines[Editor_state.cursor1.line], left, right)
    for i=#Editor_state.lines[Editor_state.cursor1.line].screen_line_starting_pos,1,-1 do
    local spos = Editor_state.lines[Editor_state.cursor1.line].screen_line_starting_pos[i]
    if spos <= Editor_state.cursor1.pos then
    [4.1332]
    [4.1621]
    function Text.pos_at_start_of_cursor_screen_line(State, left, right)
    Text.populate_screen_line_starting_pos(State.lines[State.cursor1.line], left, right)
    for i=#State.lines[State.cursor1.line].screen_line_starting_pos,1,-1 do
    local spos = State.lines[State.cursor1.line].screen_line_starting_pos[i]
    if spos <= State.cursor1.pos then
  • replacement in text.lua at line 976
    [4.895][4.91:136]()
    if Text.cursor_past_screen_bottom() then
    [4.895]
    [4.956]
    if Text.cursor_past_screen_bottom(Editor_state) then
  • replacement in text.lua at line 988
    [4.192][4.192:234]()
    function Text.cursor_past_screen_bottom()
    [4.192]
    [4.234]
    function Text.cursor_past_screen_bottom(State)
  • replacement in text.lua at line 990
    [4.247][4.78365:78444]()
    return Editor_state.cursor_y >= App.screen.height - Editor_state.line_height
    [4.247]
    [4.300]
    return State.cursor_y >= App.screen.height - State.line_height
  • replacement in text.lua at line 993
    [4.419][4.356:432](),[4.432][4.78445:78574]()
    --? local _,botpos = Text.pos_at_start_of_cursor_screen_line(left, right)
    --? local botline1 = {line=Editor_state.cursor1.line, pos=botpos}
    --? return Text.lt1(Editor_state.screen_bottom1, botline1)
    [4.419]
    [4.1156]
    --? local _,botpos = Text.pos_at_start_of_cursor_screen_line(State, left, right)
    --? local botline1 = {line=State.cursor1.line, pos=botpos}
    --? return Text.lt1(State.screen_bottom1, botline1)
  • replacement in select.lua at line 136
    [2.2509][2.2509:2592]()
    _,State.screen_top1.pos = Text.pos_at_start_of_cursor_screen_line(left, right)
    [2.2509]
    [4.1160]
    _,State.screen_top1.pos = Text.pos_at_start_of_cursor_screen_line(State, left, right)
  • replacement in edit.lua at line 394
    [4.14227][4.14227:14272](),[4.14272][4.8813:8913]()
    if Text.cursor_past_screen_bottom() then
    Text.snap_cursor_to_bottom_of_screen(State.margin_left, App.screen.height-State.margin_right)
    [4.14227]
    [4.14360]
    if Text.cursor_past_screen_bottom(State) then
    Text.snap_cursor_to_bottom_of_screen(State, State.margin_left, App.screen.height-State.margin_right)