use line cache for drawings as well

[?]
Jul 20, 2022, 11:34 PM
TGHAJBESCIEGWUE2D3FGLNOIAYT4D2IRGZKRXRMTUFW7QZETC7OAC

Dependencies

  • [2] ILOA5BYF separate data structure for each line's cache data
  • [3] UV4EWOLY add args to some functions
  • [4] ODLKHO7B switch to line index in a function
  • [5] BW2IUB3K keep all text cache writes inside text.lua
  • [6] BULPIBEG beginnings of a module for the text editor
  • [7] WOXIYUTL bugfix: manage screen_top and cursor when resizing
  • [8] HYEAFRZ2 split mouse_pressed events between Text and Drawing
  • [9] H2DPLWMV snapshot: wrapping long lines at word boundaries
  • [10] XNFTJHC4 split keyboard handling between Text and Drawing
  • [11] U52E2XZN fix a crash
  • [12] 2H67P75X switch arg for a function
  • [13] LNUHQOGH start passing in Editor_state explicitly
  • [14] MYC7XR5Q bugfix: lines that aren't drawn from the start
  • [15] GN3IF4WF bugfix: pasting newlines
  • [16] 3OKKTUT4 up and down arrow now moving by screen line where possible
  • [17] R53OF3ON one bug I've repeatedly run into while testing with Moby Dick
  • [18] S2MISTTM add state arg to a few functions
  • [19] 3ZSUBI57 drop some redundant args from Text.draw
  • [20] WLWNS6FB a bug I've never run into
  • [21] WJBZZQE4 fold together two largely similar cases
  • [22] PTDO2SOT add state arg to schedule_save
  • [23] MTJEVRJR add state arg to a few functions
  • [24] QCPXQ2E3 add state arg to a few functions
  • [25] 52ZZ5TIE switch to line index in a function
  • [26] HGC5RGJP switch to line index in a function
  • [27] KURLAXXI clean up some prints
  • [28] IWYLK45K clicking to the right of a line within line width
  • [29] 5FW7YOFT highlight selection while dragging
  • [30] P66MRF3U bugfix: don't append metadata when it already exists
  • [31] SPSW74Y5 add state arg to Text.keychord_pressed
  • [32] Z5HLXU4P add state arg to a few functions
  • [33] LF7BWEG4 group all editor globals
  • [34] LSYLEVBD drop some redundant args when clearing the cache
  • [35] 242L3OQX bugfix: ensure Cursor_line is always on a text line
  • [36] KZ5GAYRP this fixes the immediate regression
  • [37] ZPUQSPQP extract a few methods
  • [38] HOSPP2AN crisp font rendering
  • [39] PLKNHYZ4 extract a function
  • [40] PR4KIAZD first stab at equally hacky cursor down support
  • [41] 2L5MEZV3 experiment: new edit namespace
  • [42] 4KC7I3E2 make colors easier to edit
  • [43] WZFMGVDT switch to line index in a function
  • [44] PFT5Y2ZY move
  • [45] 2RXZ3PGO beginning of a new approach to scroll+wrap
  • [46] WLJCIXYM add state arg to a few functions
  • [47] FKNXK2OA switch to line index in a function
  • [48] LXTTOB33 extract a couple of files
  • [49] MXA3RZYK deduce left/right from state where possible

Change contents

  • replacement in text.lua at line 14
    [3.81][2.3708:3763]()
    local line_cache = State.text_line_cache[line_index]
    [3.81]
    [2.3763]
    local line_cache = State.line_cache[line_index]
  • replacement in text.lua at line 91
    [3.186][2.3907:3962]()
    local line_cache = State.text_line_cache[line_index]
    [3.186]
    [2.3962]
    local line_cache = State.line_cache[line_index]
  • replacement in text.lua at line 199
    [3.2145][2.4139:4205]()
    table.remove(State.text_line_cache, State.cursor1.line-1)
    [3.2145]
    [3.2728]
    table.remove(State.line_cache, State.cursor1.line-1)
  • replacement in text.lua at line 205
    [3.2405][2.4206:4270]()
    table.remove(State.text_line_cache, State.cursor1.line)
    [3.2405]
    [3.2948]
    table.remove(State.line_cache, State.cursor1.line)
  • replacement in text.lua at line 248
    [2.4389][2.4389:4453]()
    table.remove(State.text_line_cache, State.cursor1.line+1)
    [2.4389]
    [3.3914]
    table.remove(State.line_cache, State.cursor1.line+1)
  • replacement in text.lua at line 341
    [3.2281][2.4454:4518]()
    table.insert(State.text_line_cache, State.cursor1.line+1, {})
    [3.2281]
    [3.2281]
    table.insert(State.line_cache, State.cursor1.line+1, {})
  • replacement in text.lua at line 413
    [3.937][2.4519:4627]()
    local screen_line_starting_pos = State.text_line_cache[State.cursor1.line].screen_line_starting_pos
    [3.937]
    [3.1023]
    local screen_line_starting_pos = State.line_cache[State.cursor1.line].screen_line_starting_pos
  • replacement in text.lua at line 435
    [3.1956][2.4628:4751]()
    new_screen_line_starting_pos = State.text_line_cache[State.cursor1.line].screen_line_starting_pos[screen_line_index-1]
    [3.1956]
    [3.2057]
    new_screen_line_starting_pos = State.line_cache[State.cursor1.line].screen_line_starting_pos[screen_line_index-1]
  • replacement in text.lua at line 478
    [3.1605][2.4752:4875]()
    new_screen_line_starting_pos = State.text_line_cache[State.cursor1.line].screen_line_starting_pos[screen_line_index+1]
    [3.1605]
    [3.4192]
    new_screen_line_starting_pos = State.line_cache[State.cursor1.line].screen_line_starting_pos[screen_line_index+1]
  • replacement in text.lua at line 615
    [3.351][2.4876:5047]()
    for i=#State.text_line_cache[State.cursor1.line].screen_line_starting_pos,1,-1 do
    local spos = State.text_line_cache[State.cursor1.line].screen_line_starting_pos[i]
    [3.351]
    [3.768]
    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]
  • replacement in text.lua at line 626
    [3.420][2.5048:5138]()
    local screen_lines = State.text_line_cache[State.cursor1.line].screen_line_starting_pos
    [3.420]
    [3.2040]
    local screen_lines = State.line_cache[State.cursor1.line].screen_line_starting_pos
  • replacement in text.lua at line 645
    [3.2737][2.5139:5183]()
    table.insert(State.text_line_cache, {})
    [3.2737]
    [3.402]
    table.insert(State.line_cache, {})
  • replacement in text.lua at line 692
    [3.88][2.5184:5239]()
    local line_cache = State.text_line_cache[line_index]
    [3.88]
    [2.5239]
    local line_cache = State.line_cache[line_index]
  • replacement in text.lua at line 703
    [3.98][2.5545:5600]()
    local line_cache = State.text_line_cache[line_index]
    [3.98]
    [2.5600]
    local line_cache = State.line_cache[line_index]
  • replacement in text.lua at line 735
    [3.232][2.6219:6274]()
    local line_cache = State.text_line_cache[line_index]
    [3.232]
    [2.6274]
    local line_cache = State.line_cache[line_index]
  • replacement in text.lua at line 852
    [3.541][2.6452:6605]()
    for i=#State.text_line_cache[pos1.line].screen_line_starting_pos,1,-1 do
    local spos = State.text_line_cache[pos1.line].screen_line_starting_pos[i]
    [3.541]
    [3.352]
    for i=#State.line_cache[pos1.line].screen_line_starting_pos,1,-1 do
    local spos = State.line_cache[pos1.line].screen_line_starting_pos[i]
  • replacement in text.lua at line 867
    [3.8326][2.6606:6721]()
    result.pos = State.text_line_cache[pos2.line].screen_line_starting_pos[pos2.screen_line] + pos2.screen_pos - 1
    [3.8326]
    [3.8421]
    result.pos = State.line_cache[pos2.line].screen_line_starting_pos[pos2.screen_line] + pos2.screen_pos - 1
  • replacement in text.lua at line 916
    [3.605][2.6722:6840]()
    return {line=pos2.line-1, screen_line=#State.text_line_cache[pos2.line-1].screen_line_starting_pos, screen_pos=1}
    [3.605]
    [3.1960]
    return {line=pos2.line-1, screen_line=#State.line_cache[pos2.line-1].screen_line_starting_pos, screen_pos=1}
  • replacement in text.lua at line 922
    [3.712][2.6841:6896]()
    local line_cache = State.text_line_cache[line_index]
    [3.712]
    [2.6896]
    local line_cache = State.line_cache[line_index]
  • replacement in text.lua at line 953
    [3.5176][2.7136:7203]()
    local line_cache = State.text_line_cache[State.screen_top1.line]
    [3.5176]
    [2.7203]
    local line_cache = State.line_cache[State.screen_top1.line]
  • replacement in text.lua at line 998
    [3.732][2.7370:7399]()
    State.text_line_cache = {}
    [3.732]
    [2.7399]
    State.line_cache = {}
  • replacement in text.lua at line 1000
    [2.7425][2.7425:7459]()
    State.text_line_cache[i] = {}
    [2.7425]
    [3.2910]
    State.line_cache[i] = {}
  • replacement in text.lua at line 1005
    [3.462][2.7460:7579]()
    State.text_line_cache[line_index].fragments = nil
    State.text_line_cache[line_index].screen_line_starting_pos = nil
    [3.462]
    [3.438]
    State.line_cache[line_index].fragments = nil
    State.line_cache[line_index].screen_line_starting_pos = nil
  • replacement in select.lua at line 152
    [3.2984][2.7582:7625]()
    table.remove(State.text_line_cache, i)
    [3.2984]
    [3.47774]
    table.remove(State.line_cache, i)
  • replacement in edit.lua at line 67
    [2.8245][2.8245:8271]()
    text_line_cache = {},
    [2.8245]
    [2.8271]
    line_cache = {},
  • replacement in edit.lua at line 124
    [3.2826][2.8369:8418]()
    assert(#State.lines == #State.text_line_cache)
    [3.2826]
    [3.2826]
    assert(#State.lines == #State.line_cache)
  • replacement in edit.lua at line 147
    [3.609][2.8419:8494]()
    table.insert(State.text_line_cache, line_index, {})
    [3.609]
    [3.609]
    table.insert(State.line_cache, line_index, {})
  • replacement in edit.lua at line 350
    [3.8139][2.8495:8570]()
    patch_placeholders(State.text_line_cache, event.after, event.before)
    [3.8139]
    [3.15]
    patch_placeholders(State.line_cache, event.after, event.before)