add state arg to a few functions

[?]
Jul 13, 2022, 12:10 AM
F65ADDGLR2PNXVSM2XBHM3OSLQC2OTRR3GQBI7DJWIKPJCJ5CSOAC

Dependencies

  • [2] Z5HLXU4P add state arg to a few functions
  • [3] QCQTMUZ7 add args to some functions
  • [4] 5OALPNN3 add args to some functions
  • [5] KECEMMMR extract couple of functions
  • [6] ZPUQSPQP extract a few methods
  • [7] ZHLO7K3M add args to some functions
  • [8] 2CH77LZC add args to some functions
  • [9] LF7BWEG4 group all editor globals
  • [10] 2LC3BM2N support other whitespace chars in word movements
  • [11] 62PZGSUC optimization: moving cursor to next word
  • [12] V3EABA35 skip multiple consecutive whitespace
  • [13] HTWAM4NZ bugfix: scrolling in left/right movements
  • [*] BULPIBEG beginnings of a module for the text editor

Change contents

  • replacement in text.lua at line 524
    [3.1006][3.1325:1352](),[3.4978][3.1325:1352]()
    Text.left(left, right)
    [3.1006]
    [3.1007]
    Text.left(State, left, right)
  • replacement in text.lua at line 528
    [3.1059][3.1059:1086]()
    Text.left(left, right)
    [3.1059]
    [2.8080]
    Text.left(State, left, right)
  • replacement in text.lua at line 548
    [3.1347][3.1347:1379]()
    Text.right_without_scroll()
    [3.1347]
    [3.1379]
    Text.right_without_scroll(State)
  • replacement in text.lua at line 551
    [3.5295][3.3:35]()
    Text.right_without_scroll()
    [3.5295]
    [2.8452]
    Text.right_without_scroll(State)
  • replacement in text.lua at line 573
    [3.47][3.1392:1424](),[3.1424][3.73056:73224]()
    function Text.left(left, right)
    assert(Editor_state.lines[Editor_state.cursor1.line].mode == 'text')
    if Editor_state.cursor1.pos > 1 then
    Editor_state.cursor1.pos = Editor_state.cursor1.pos-1
    [3.47]
    [3.171]
    function Text.left(State, left, right)
    assert(State.lines[State.cursor1.line].mode == 'text')
    if State.cursor1.pos > 1 then
    State.cursor1.pos = State.cursor1.pos-1
  • replacement in text.lua at line 578
    [3.178][3.73225:73279]()
    local new_cursor_line = Editor_state.cursor1.line
    [3.178]
    [3.219]
    local new_cursor_line = State.cursor1.line
  • replacement in text.lua at line 581
    [3.294][3.73280:73497]()
    if Editor_state.lines[new_cursor_line].mode == 'text' then
    Editor_state.cursor1.line = new_cursor_line
    Editor_state.cursor1.pos = utf8.len(Editor_state.lines[Editor_state.cursor1.line].data) + 1
    [3.294]
    [3.446]
    if State.lines[new_cursor_line].mode == 'text' then
    State.cursor1.line = new_cursor_line
    State.cursor1.pos = utf8.len(State.lines[State.cursor1.line].data) + 1
  • replacement in text.lua at line 588
    [3.6556][3.73498:73630]()
    if Text.lt1(Editor_state.cursor1, Editor_state.screen_top1) then
    local top2 = Text.to2(Editor_state.screen_top1, left, right)
    [3.6556]
    [3.150]
    if Text.lt1(State.cursor1, State.screen_top1) then
    local top2 = Text.to2(State.screen_top1, left, right)
  • replacement in text.lua at line 591
    [3.206][3.73631:73677]()
    Editor_state.screen_top1 = Text.to1(top2)
    [3.206]
    [3.568]
    State.screen_top1 = Text.to1(top2)
  • replacement in text.lua at line 595
    [3.579][3.1425:1458](),[3.1458][3.129:159](),[3.601][3.129:159]()
    function Text.right(left, right)
    Text.right_without_scroll()
    [3.579]
    [3.159]
    function Text.right(State, left, right)
    Text.right_without_scroll(State)
  • replacement in text.lua at line 602
    [3.256][3.256:293](),[3.293][3.73678:73906]()
    function Text.right_without_scroll()
    assert(Editor_state.lines[Editor_state.cursor1.line].mode == 'text')
    if Editor_state.cursor1.pos <= utf8.len(Editor_state.lines[Editor_state.cursor1.line].data) then
    Editor_state.cursor1.pos = Editor_state.cursor1.pos+1
    [3.256]
    [3.738]
    function Text.right_without_scroll(State)
    assert(State.lines[State.cursor1.line].mode == 'text')
    if State.cursor1.pos <= utf8.len(State.lines[State.cursor1.line].data) then
    State.cursor1.pos = State.cursor1.pos+1
  • replacement in text.lua at line 607
    [3.745][3.73907:74015]()
    local new_cursor_line = Editor_state.cursor1.line
    while new_cursor_line <= #Editor_state.lines-1 do
    [3.745]
    [3.827]
    local new_cursor_line = State.cursor1.line
    while new_cursor_line <= #State.lines-1 do
  • replacement in text.lua at line 610
    [3.869][3.74016:74170]()
    if Editor_state.lines[new_cursor_line].mode == 'text' then
    Editor_state.cursor1.line = new_cursor_line
    Editor_state.cursor1.pos = 1
    [3.869]
    [3.984]
    if State.lines[new_cursor_line].mode == 'text' then
    State.cursor1.line = new_cursor_line
    State.cursor1.pos = 1