add state arg to a few functions

[?]
Jul 13, 2022, 12:02 AM
5ZA3BRNYWKSGEBJ4JLA4UBC3LJPT5JBWYCU7PQYRSGX6MJMEWDIQC

Dependencies

  • [2] LNUHQOGH start passing in Editor_state explicitly
  • [3] LF7BWEG4 group all editor globals
  • [4] LXTTOB33 extract a couple of files
  • [5] 4KC7I3E2 make colors easier to edit
  • [6] 2L5MEZV3 experiment: new edit namespace

Change contents

  • replacement in search.lua at line 24
    [3.49703][3.49703:49731]()
    function Text.search_next()
    [3.49703]
    [3.49731]
    function Text.search_next(State)
  • replacement in search.lua at line 26
    [3.49756][3.82109:82231]()
    local pos = Editor_state.lines[Editor_state.cursor1.line].data:find(Editor_state.search_term, Editor_state.cursor1.pos)
    [3.49756]
    [3.49826]
    local pos = State.lines[State.cursor1.line].data:find(State.search_term, State.cursor1.pos)
  • replacement in search.lua at line 28
    [3.49840][3.82232:82267]()
    Editor_state.cursor1.pos = pos
    [3.49840]
    [3.49862]
    State.cursor1.pos = pos
  • replacement in search.lua at line 31
    [3.49889][3.82268:82399]()
    for i=Editor_state.cursor1.line+1,#Editor_state.lines do
    pos = Editor_state.lines[i].data:find(Editor_state.search_term)
    [3.49889]
    [3.49968]
    for i=State.cursor1.line+1,#State.lines do
    pos = State.lines[i].data:find(State.search_term)
  • replacement in search.lua at line 34
    [3.49986][3.82400:82477]()
    Editor_state.cursor1.line = i
    Editor_state.cursor1.pos = pos
    [3.49986]
    [3.50037]
    State.cursor1.line = i
    State.cursor1.pos = pos
  • replacement in search.lua at line 42
    [3.50115][3.82478:82591]()
    for i=1,Editor_state.cursor1.line-1 do
    pos = Editor_state.lines[i].data:find(Editor_state.search_term)
    [3.50115]
    [3.50189]
    for i=1,State.cursor1.line-1 do
    pos = State.lines[i].data:find(State.search_term)
  • replacement in search.lua at line 45
    [3.50207][3.82592:82669]()
    Editor_state.cursor1.line = i
    Editor_state.cursor1.pos = pos
    [3.50207]
    [3.50258]
    State.cursor1.line = i
    State.cursor1.pos = pos
  • replacement in search.lua at line 52
    [3.50317][3.82670:82966]()
    Editor_state.cursor1.line = Editor_state.search_backup.cursor.line
    Editor_state.cursor1.pos = Editor_state.search_backup.cursor.pos
    Editor_state.screen_top1.line = Editor_state.search_backup.screen_top.line
    Editor_state.screen_top1.pos = Editor_state.search_backup.screen_top.pos
    [3.50317]
    [3.50509]
    State.cursor1.line = State.search_backup.cursor.line
    State.cursor1.pos = State.search_backup.cursor.pos
    State.screen_top1.line = State.search_backup.screen_top.line
    State.screen_top1.pos = State.search_backup.screen_top.pos
  • replacement in search.lua at line 57
    [3.50515][3.82967:83327]()
    if Text.lt1(Editor_state.cursor1, Editor_state.screen_top1) or Text.lt1(Editor_state.screen_bottom1, Editor_state.cursor1) then
    Editor_state.screen_top1.line = Editor_state.cursor1.line
    local _, pos = Text.pos_at_start_of_cursor_screen_line(Editor_state.margin_left, App.screen.width-Editor_state.margin_right)
    Editor_state.screen_top1.pos = pos
    [3.50515]
    [3.50716]
    if Text.lt1(State.cursor1, State.screen_top1) or Text.lt1(State.screen_bottom1, State.cursor1) then
    State.screen_top1.line = State.cursor1.line
    local _, pos = Text.pos_at_start_of_cursor_screen_line(State, State.margin_left, App.screen.width-State.margin_right)
    State.screen_top1.pos = pos
  • replacement in search.lua at line 64
    [3.50727][3.50727:50759]()
    function Text.search_previous()
    [3.50727]
    [3.50759]
    function Text.search_previous(State)
  • replacement in search.lua at line 66
    [3.50784][3.83328:83452]()
    local pos = rfind(Editor_state.lines[Editor_state.cursor1.line].data, Editor_state.search_term, Editor_state.cursor1.pos)
    [3.50784]
    [3.50856]
    local pos = rfind(State.lines[State.cursor1.line].data, State.search_term, State.cursor1.pos)
  • replacement in search.lua at line 68
    [3.50870][3.83453:83488]()
    Editor_state.cursor1.pos = pos
    [3.50870]
    [3.50892]
    State.cursor1.pos = pos
  • replacement in search.lua at line 71
    [3.50919][3.83489:83607]()
    for i=Editor_state.cursor1.line-1,1,-1 do
    pos = rfind(Editor_state.lines[i].data, Editor_state.search_term)
    [3.50919]
    [3.50998]
    for i=State.cursor1.line-1,1,-1 do
    pos = rfind(State.lines[i].data, State.search_term)
  • replacement in search.lua at line 74
    [3.51016][3.83608:83685]()
    Editor_state.cursor1.line = i
    Editor_state.cursor1.pos = pos
    [3.51016]
    [3.51067]
    State.cursor1.line = i
    State.cursor1.pos = pos
  • replacement in search.lua at line 82
    [3.51145][3.83686:83822]()
    for i=#Editor_state.lines,Editor_state.cursor1.line+1,-1 do
    pos = rfind(Editor_state.lines[i].data, Editor_state.search_term)
    [3.51145]
    [3.51229]
    for i=#State.lines,State.cursor1.line+1,-1 do
    pos = rfind(State.lines[i].data, State.search_term)
  • replacement in search.lua at line 85
    [3.51247][3.83823:83900]()
    Editor_state.cursor1.line = i
    Editor_state.cursor1.pos = pos
    [3.51247]
    [3.51298]
    State.cursor1.line = i
    State.cursor1.pos = pos
  • replacement in search.lua at line 92
    [3.51357][3.83901:84197]()
    Editor_state.cursor1.line = Editor_state.search_backup.cursor.line
    Editor_state.cursor1.pos = Editor_state.search_backup.cursor.pos
    Editor_state.screen_top1.line = Editor_state.search_backup.screen_top.line
    Editor_state.screen_top1.pos = Editor_state.search_backup.screen_top.pos
    [3.51357]
    [3.51549]
    State.cursor1.line = State.search_backup.cursor.line
    State.cursor1.pos = State.search_backup.cursor.pos
    State.screen_top1.line = State.search_backup.screen_top.line
    State.screen_top1.pos = State.search_backup.screen_top.pos
  • replacement in search.lua at line 97
    [3.51555][3.84198:84558]()
    if Text.lt1(Editor_state.cursor1, Editor_state.screen_top1) or Text.lt1(Editor_state.screen_bottom1, Editor_state.cursor1) then
    Editor_state.screen_top1.line = Editor_state.cursor1.line
    local _, pos = Text.pos_at_start_of_cursor_screen_line(Editor_state.margin_left, App.screen.width-Editor_state.margin_right)
    Editor_state.screen_top1.pos = pos
    [3.51555]
    [3.51756]
    if Text.lt1(State.cursor1, State.screen_top1) or Text.lt1(State.screen_bottom1, State.cursor1) then
    State.screen_top1.line = State.cursor1.line
    local _, pos = Text.pos_at_start_of_cursor_screen_line(State, State.margin_left, App.screen.width-State.margin_right)
    State.screen_top1.pos = pos
  • replacement in edit.lua at line 282
    [2.6495][3.9952:9975](),[3.102442][3.9952:9975](),[3.9952][3.9952:9975]()
    Text.search_next()
    [2.6495]
    [2.6496]
    Text.search_next(State)
  • replacement in edit.lua at line 323
    [2.7537][3.11655:11680](),[3.103616][3.11655:11680](),[3.11655][3.11655:11680]()
    Text.search_next()
    [2.7537]
    [3.11680]
    Text.search_next(State)
  • replacement in edit.lua at line 325
    [3.11710][3.11710:11739]()
    Text.search_previous()
    [3.11710]
    [3.11739]
    Text.search_previous(State)