separate data structure for each line's cache data

[?]
Jul 18, 2022, 4:05 AM
ILOA5BYFTQKBSHLFMMZUVPQ2JXBFJD62ERQFBTDK2WSRXUN525VQC

Dependencies

  • [2] WLWNS6FB a bug I've never run into
  • [3] CNCYMM6A make test initializations a little more obvious
  • [4] LSYLEVBD drop some redundant args when clearing the cache
  • [5] FKNXK2OA switch to line index in a function
  • [6] EM276IH3 make a function oblivious to line data structure
  • [7] HGC5RGJP switch to line index in a function
  • [8] WZFMGVDT switch to line index in a function
  • [9] BW2IUB3K keep all text cache writes inside text.lua
  • [10] R53OF3ON one bug I've repeatedly run into while testing with Moby Dick
  • [11] 2H67P75X switch arg for a function
  • [12] OGUV4HSA remove some memory leaks from rendered fragments
  • [13] LERERVPH keep one screen line of overlap on pagedown
  • [14] HPVT467W initialize contains test state
  • [15] 2L5MEZV3 experiment: new edit namespace
  • [16] LXTTOB33 extract a couple of files
  • [17] EMRPLZPW drop an arg from a function
  • [18] K4OBZSHE add args to some functions
  • [19] UHB4GARJ left/right margin -> left/right coordinates
  • [20] 65XHTZEK regression: couldn't do many drawing operations because line.y was reset
  • [21] U52E2XZN fix a crash
  • [22] DLQMM265 scroll past first page
  • [23] H22OAXWE couple of TODOs
  • [24] ODLKHO7B switch to line index in a function
  • [25] XNFTJHC4 split keyboard handling between Text and Drawing
  • [26] CTJ3IZGS add args to some functions
  • [27] CCYSVZA2 bugfix: BSOD in #4.
  • [28] 2TQR4PSY add args to some functions
  • [29] M6TH7VSZ rip out notion of Line_width
  • [30] R5OKMVVC fix a regression in line wrapping
  • [31] GCEF4N3V stop repeatedly checking for line wrapping
  • [32] HYEAFRZ2 split mouse_pressed events between Text and Drawing
  • [33] P66MRF3U bugfix: don't append metadata when it already exists
  • [34] CPZGQT72 go through and fix similar issues
  • [35] 537TQ2QN some more logging
  • [36] WOXIYUTL bugfix: manage screen_top and cursor when resizing
  • [37] WLJCIXYM add state arg to a few functions
  • [38] SPSW74Y5 add state arg to Text.keychord_pressed
  • [39] H2DPLWMV snapshot: wrapping long lines at word boundaries
  • [40] C45WCXJ2 keep drawings within the line width slider as well
  • [41] 3ZSUBI57 drop some redundant args from Text.draw
  • [42] PESSMQBJ no, make sure to compute line width after screen dimensions
  • [43] Z5HLXU4P add state arg to a few functions
  • [44] 4RUI5X52 a few tests for pageup, and a bugfix
  • [45] HOSPP2AN crisp font rendering
  • [46] QCPXQ2E3 add state arg to a few functions
  • [47] QYIFOHW3 first test!
  • [48] MXA3RZYK deduce left/right from state where possible
  • [49] IMEJA43L snapshot
  • [50] YTSPVDZH first successful pagedown test, first bug found by test
  • [51] BULPIBEG beginnings of a module for the text editor
  • [52] 242L3OQX bugfix: ensure Cursor_line is always on a text line
  • [53] J6WEC2D6 .
  • [54] PFT5Y2ZY move
  • [55] ZPUQSPQP extract a few methods
  • [56] 5L7K4GBD clicking to the right of a wrapped line
  • [57] PR4KIAZD first stab at equally hacky cursor down support
  • [58] 52ZZ5TIE switch to line index in a function
  • [59] OYXDYPGS get rid of debug variables
  • [60] KZ5GAYRP this fixes the immediate regression
  • [61] CBPV5SSI stop handling nil screen_line_starting_pos everywhere
  • [62] LF7BWEG4 group all editor globals
  • [63] CVGE3SIG I feel confident now that page-down is working.
  • [64] IWYLK45K clicking to the right of a line within line width
  • [65] PLKNHYZ4 extract a function
  • [66] 4VKEE43Z bugfix
  • [67] DGK5BPVI bugfix: UTF-8 in compute_fragments
  • [68] GK47BBCY start passing left/right margins everywhere
  • [69] UV4EWOLY add args to some functions
  • [70] MYC7XR5Q bugfix: lines that aren't drawn from the start
  • [71] 3OKKTUT4 up and down arrow now moving by screen line where possible
  • [72] WY3JD6W6 bugfix
  • [73] A2NV3WVO scrolling with up arrow
  • [74] 5DOTWNVM right margin
  • [75] GJLOKCYK bugfix: clicking past end of screen line
  • [76] SVJZZDC3 snapshot - no, that's all wrong
  • [77] NDHQN23G done passing left/right margins everywhere
  • [78] YLKLDF4R .
  • [79] DHI6IJCN selecting text and deleting selections
  • [80] JY4VK7L2 rename
  • [81] BOFNXP5G clicking now moves the cursor even on long, wrapped lines
  • [82] 5FW7YOFT highlight selection while dragging
  • [83] 2RXZ3PGO beginning of a new approach to scroll+wrap
  • [84] 73OCE2MC after much struggle, a brute-force undo
  • [85] LAW2O3NW extract variable Margin_left
  • [86] 4KC7I3E2 make colors easier to edit
  • [*] VJ77YABH more efficient undo/redo
  • [*] LNUHQOGH start passing in Editor_state explicitly
  • [*] DSLD74DK lots more tests
  • [*] S2MISTTM add state arg to a few functions
  • [*] OTIBCAUJ love2d scaffold
  • [*] WJBZZQE4 fold together two largely similar cases
  • [*] K2X6G75Z start writing some tests for drawings

Change contents

  • edit in undo.lua at line 98
    [88.852]
    [10.2322]
    function patch_placeholders(line_cache, from, to)
    assert(from.start_line == to.start_line)
    for i=from.end_line,from.start_line,-1 do
    table.remove(line_cache, i)
    end
    assert(#to.lines == to.end_line-to.start_line+1)
    for i=1,#to.lines do
    table.insert(line_cache, to.start_line+i-1, {})
    end
    end
  • edit in text_tests.lua at line 8
    [10.1140]
    [89.2]
    Text.redraw_all(Editor_state)
  • edit in text_tests.lua at line 22
    [10.1660]
    [89.29]
    Text.redraw_all(Editor_state)
  • edit in text_tests.lua at line 36
    [10.2028]
    [90.1159]
    Text.redraw_all(Editor_state)
  • edit in text_tests.lua at line 50
    [10.2355]
    [89.56]
    Text.redraw_all(Editor_state)
  • edit in text_tests.lua at line 63
    [10.2517]
    [10.2603]
    Text.redraw_all(Editor_state)
  • edit in text_tests.lua at line 75
    [10.2764]
    [10.2764]
    Text.redraw_all(Editor_state)
  • edit in text_tests.lua at line 87
    [10.2994]
    [10.2994]
    Text.redraw_all(Editor_state)
  • edit in text_tests.lua at line 99
    [10.3234]
    [10.3234]
    Text.redraw_all(Editor_state)
  • edit in text_tests.lua at line 112
    [10.3600]
    [10.3600]
    Text.redraw_all(Editor_state)
  • edit in text_tests.lua at line 125
    [10.3953]
    [10.3953]
    Text.redraw_all(Editor_state)
  • edit in text_tests.lua at line 137
    [10.4201]
    [10.4201]
    Text.redraw_all(Editor_state)
  • edit in text_tests.lua at line 149
    [10.4489]
    [10.4489]
    Text.redraw_all(Editor_state)
  • edit in text_tests.lua at line 161
    [10.4774]
    [10.4774]
    Text.redraw_all(Editor_state)
  • edit in text_tests.lua at line 173
    [10.5055]
    [10.5055]
    Text.redraw_all(Editor_state)
  • edit in text_tests.lua at line 185
    [10.5358]
    [10.5358]
    Text.redraw_all(Editor_state)
  • edit in text_tests.lua at line 198
    [10.5724]
    [10.5724]
    Text.redraw_all(Editor_state)
  • edit in text_tests.lua at line 210
    [10.5972]
    [10.5972]
    Text.redraw_all(Editor_state)
  • edit in text_tests.lua at line 222
    [10.6248]
    [10.6248]
    Text.redraw_all(Editor_state)
  • edit in text_tests.lua at line 234
    [10.6533]
    [10.6533]
    Text.redraw_all(Editor_state)
  • edit in text_tests.lua at line 246
    [10.6832]
    [10.6832]
    Text.redraw_all(Editor_state)
  • edit in text_tests.lua at line 260
    [10.7193]
    [10.7279]
    Text.redraw_all(Editor_state)
  • edit in text_tests.lua at line 278
    [10.7733]
    [10.7819]
    Text.redraw_all(Editor_state)
  • edit in text_tests.lua at line 294
    [10.8174]
    [10.8260]
    Text.redraw_all(Editor_state)
  • edit in text_tests.lua at line 312
    [10.8548]
    [10.8634]
    Text.redraw_all(Editor_state)
  • edit in text_tests.lua at line 330
    [10.8921]
    [10.9007]
    Text.redraw_all(Editor_state)
  • edit in text_tests.lua at line 349
    [10.9296]
    [10.9382]
    Text.redraw_all(Editor_state)
  • edit in text_tests.lua at line 368
    [10.9710]
    [10.9796]
    Text.redraw_all(Editor_state)
  • replacement in text_tests.lua at line 386
    [10.41][10.153:190](),[3.1317][10.153:190](),[10.3364][10.153:190](),[10.153][10.153:190]()
    -- 12345678901234
    [3.1317]
    [10.10027]
    -- 12345678901234
  • edit in text_tests.lua at line 388
    [10.10079]
    [10.10165]
    Text.redraw_all(Editor_state)
  • replacement in text_tests.lua at line 410
    [10.81][10.259:296](),[3.1364][10.259:296](),[10.3499][10.259:296](),[10.259][10.259:296]()
    -- 12345678901234
    [3.1364]
    [10.10572]
    -- 12345678901234
  • edit in text_tests.lua at line 412
    [10.10624]
    [10.10710]
    Text.redraw_all(Editor_state)
  • replacement in text_tests.lua at line 432
    [10.121][10.1053:1090](),[3.1411][10.1053:1090](),[10.3634][10.1053:1090](),[10.1053][10.1053:1090]()
    -- 12345678901234
    [3.1411]
    [10.11159]
    -- 12345678901234
  • edit in text_tests.lua at line 434
    [10.11211]
    [10.11297]
    Text.redraw_all(Editor_state)
  • replacement in text_tests.lua at line 457
    [10.161][10.216:253](),[3.1458][10.216:253](),[10.3769][10.216:253](),[10.216][10.216:253]()
    -- 12345678901234
    [3.1458]
    [10.11707]
    -- 12345678901234
  • edit in text_tests.lua at line 459
    [10.11797]
    [10.11883]
    Text.redraw_all(Editor_state)
  • replacement in text_tests.lua at line 482
    [10.202][10.248:335](),[3.1505][10.248:335](),[10.3904][10.248:335](),[10.248][10.248:335]()
    -- 0 1 2
    -- 123456789012345678901
    [3.1505]
    [10.12305]
    -- 0 1 2
    -- 123456789012345678901
  • edit in text_tests.lua at line 485
    [10.12387]
    [10.12473]
    Text.redraw_all(Editor_state)
  • edit in text_tests.lua at line 505
    [10.12811]
    [10.12897]
    Text.redraw_all(Editor_state)
  • edit in text_tests.lua at line 528
    [10.13377]
    [10.13463]
    Text.redraw_all(Editor_state)
  • edit in text_tests.lua at line 547
    [10.13882]
    [10.13968]
    Text.redraw_all(Editor_state)
  • edit in text_tests.lua at line 565
    [10.14257]
    [10.14343]
    Text.redraw_all(Editor_state)
  • edit in text_tests.lua at line 588
    [10.14744]
    [10.14830]
    Text.redraw_all(Editor_state)
  • edit in text_tests.lua at line 607
    [10.15118]
    [10.15204]
    Text.redraw_all(Editor_state)
  • edit in text_tests.lua at line 626
    [10.15485]
    [10.15571]
    Text.redraw_all(Editor_state)
  • edit in text_tests.lua at line 647
    [10.15886]
    [10.15972]
    Text.redraw_all(Editor_state)
  • edit in text_tests.lua at line 672
    [10.16484]
    [10.16570]
    Text.redraw_all(Editor_state)
  • edit in text_tests.lua at line 695
    [10.16927]
    [10.17013]
    Text.redraw_all(Editor_state)
  • edit in text_tests.lua at line 725
    [10.17693]
    [10.17779]
    Text.redraw_all(Editor_state)
  • edit in text_tests.lua at line 743
    [10.18411]
    [10.18497]
    Text.redraw_all(Editor_state)
  • edit in text_tests.lua at line 773
    [10.19148]
    [10.19234]
    Text.redraw_all(Editor_state)
  • edit in text_tests.lua at line 791
    [10.19959]
    [10.20045]
    Text.redraw_all(Editor_state)
  • edit in text_tests.lua at line 812
    [10.20887]
    [10.20973]
    Text.redraw_all(Editor_state)
  • edit in text_tests.lua at line 837
    [10.22029]
    [10.22115]
    Text.redraw_all(Editor_state)
    Text.redraw_all(Editor_state)
  • edit in text_tests.lua at line 869
    [10.23485]
    [10.23571]
    Text.redraw_all(Editor_state)
  • edit in text_tests.lua at line 886
    [10.23856]
    [10.23942]
    Text.redraw_all(Editor_state)
  • replacement in text_tests.lua at line 913
    [10.24493][10.7349:7514](),[10.7349][10.7349:7514]()
    '```lines', '```', -- height 25
    'def', -- height 15
    'ghi'} -- height 15
    [10.24493]
    [10.24580]
    '```lines', '```', -- height 25
    'def', -- height 15
    'ghi'} -- height 15
    Text.redraw_all(Editor_state)
  • edit in text_tests.lua at line 942
    [10.25218]
    [10.25304]
    Text.redraw_all(Editor_state)
  • edit in text_tests.lua at line 973
    [10.26242]
    [10.26328]
    Text.redraw_all(Editor_state)
  • edit in text_tests.lua at line 1001
    [10.26974]
    [10.27060]
    Text.redraw_all(Editor_state)
  • edit in text_tests.lua at line 1032
    [10.27633]
    [10.27719]
    Text.redraw_all(Editor_state)
  • edit in text_tests.lua at line 1061
    [10.28383]
    [10.28469]
    Text.redraw_all(Editor_state)
  • edit in text_tests.lua at line 1091
    [10.29257]
    [10.29343]
    Text.redraw_all(Editor_state)
  • edit in text_tests.lua at line 1120
    [10.30215]
    [10.30301]
    Text.redraw_all(Editor_state)
  • edit in text_tests.lua at line 1155
    [10.31474]
    [10.31560]
    Text.redraw_all(Editor_state)
  • edit in text_tests.lua at line 1185
    [10.32129]
    [10.32215]
    Text.redraw_all(Editor_state)
  • edit in text_tests.lua at line 1214
    [10.32871]
    [10.32957]
    Text.redraw_all(Editor_state)
  • edit in text_tests.lua at line 1243
    [10.33805]
    [10.33891]
    Text.redraw_all(Editor_state)
  • edit in text_tests.lua at line 1274
    [10.34719]
    [10.34805]
    Text.redraw_all(Editor_state)
  • edit in text_tests.lua at line 1302
    [10.35390]
    [10.35476]
    Text.redraw_all(Editor_state)
  • edit in text_tests.lua at line 1328
    [10.36010]
    [10.36096]
    Text.redraw_all(Editor_state)
  • edit in text_tests.lua at line 1358
    [10.36943]
    [10.37029]
    Text.redraw_all(Editor_state)
  • edit in text_tests.lua at line 1386
    [10.37775]
    [10.37861]
    Text.redraw_all(Editor_state)
  • edit in text_tests.lua at line 1416
    [10.38619]
    [10.38705]
    Text.redraw_all(Editor_state)
  • edit in text_tests.lua at line 1440
    [10.39419]
    [10.39505]
    Text.redraw_all(Editor_state)
  • edit in text_tests.lua at line 1460
    [10.40196]
    [10.40282]
    Text.redraw_all(Editor_state)
  • edit in text_tests.lua at line 1492
    [10.41047]
    [10.41133]
    Text.redraw_all(Editor_state)
  • edit in text_tests.lua at line 1522
    [10.41978]
    [10.42064]
    Text.redraw_all(Editor_state)
  • edit in text_tests.lua at line 1553
    [10.42848]
    [10.42934]
    Text.redraw_all(Editor_state)
  • edit in text_tests.lua at line 1583
    [10.43755]
    [10.43841]
    Text.redraw_all(Editor_state)
  • edit in text_tests.lua at line 1614
    [10.44540]
    [10.44626]
    Text.redraw_all(Editor_state)
  • edit in text_tests.lua at line 1649
    [10.45404]
    [10.45490]
    Text.redraw_all(Editor_state)
  • edit in text_tests.lua at line 1679
    [10.46130]
    [10.46216]
    Text.redraw_all(Editor_state)
  • edit in text_tests.lua at line 1709
    [10.47034]
    [10.47120]
    Text.redraw_all(Editor_state)
  • edit in text_tests.lua at line 1726
    [10.47386]
    [10.47472]
    Text.redraw_all(Editor_state)
  • edit in text_tests.lua at line 1746
    [10.48048]
    [10.48134]
    Text.redraw_all(Editor_state)
  • edit in text_tests.lua at line 1764
    [3.3992][3.3992:4038]()
    Editor_state = edit.initialize_test_state()
  • edit in text_tests.lua at line 1765
    [10.48742]
    [10.48828]
    Text.redraw_all(Editor_state)
  • edit in text_tests.lua at line 1784
    [3.4085][3.4085:4131]()
    Editor_state = edit.initialize_test_state()
  • edit in text_tests.lua at line 1785
    [10.49522]
    [10.49608]
    Text.redraw_all(Editor_state)
  • edit in text_tests.lua at line 1804
    [3.4178][3.4178:4224]()
    Editor_state = edit.initialize_test_state()
  • edit in text_tests.lua at line 1805
    [10.50285]
    [10.50371]
    Text.redraw_all(Editor_state)
  • edit in text_tests.lua at line 1824
    [10.50970]
    [10.51056]
    Text.redraw_all(Editor_state)
  • edit in text_tests.lua at line 1860
    [10.52146]
    [10.52232]
    Text.redraw_all(Editor_state)
  • edit in text_tests.lua at line 1899
    [10.53489]
    [10.53575]
    Text.redraw_all(Editor_state)
  • replacement in text.lua at line 15
    [10.81][9.215:260]()
    line.starty = y
    line.startpos = startpos
    [10.81]
    [10.1747]
    local line_cache = State.text_line_cache[line_index]
    line_cache.starty = y
    line_cache.startpos = startpos
  • replacement in text.lua at line 22
    [10.141][10.1818:1850](),[10.1818][10.1818:1850]()
    if line.fragments == nil then
    [10.141]
    [7.3]
    if line_cache.fragments == nil then
  • replacement in text.lua at line 27
    [10.19][10.1901:1941](),[10.39][10.1901:1941](),[10.64][10.1901:1941](),[10.75][10.1901:1941](),[10.1901][10.1901:1941]()
    for _, f in ipairs(line.fragments) do
    [10.19]
    [10.1941]
    for _, f in ipairs(line_cache.fragments) do
  • replacement in text.lua at line 99
    [10.46][10.51:73](),[10.141][10.51:73](),[7.186][10.51:73](),[10.1209][10.51:73](),[10.3803][10.51:73](),[10.6702][10.51:73](),[10.51][10.51:73]()
    line.fragments = {}
    [7.186]
    [7.187]
    local line_cache = State.text_line_cache[line_index]
    line_cache.fragments = {}
  • replacement in text.lua at line 125
    [10.1082][10.1082:1152]()
    table.insert(line.fragments, {data=frag1, text=frag1_text})
    [10.1082]
    [10.1161]
    table.insert(line_cache.fragments, {data=frag1, text=frag1_text})
  • replacement in text.lua at line 135
    [10.1485][10.1485:1549]()
    table.insert(line.fragments, {data=frag, text=frag_text})
    [10.1485]
    [10.1549]
    table.insert(line_cache.fragments, {data=frag, text=frag_text})
  • edit in text.lua at line 210
    [10.2145]
    [10.2728]
    table.remove(State.text_line_cache, State.cursor1.line-1)
  • edit in text.lua at line 216
    [10.2405]
    [10.2948]
    table.remove(State.text_line_cache, State.cursor1.line)
  • replacement in text.lua at line 254
    [10.3907][10.3907:4029](),[10.3469][10.3743:3754](),[10.4029][10.3743:3754](),[10.61894][10.3743:3754](),[10.3743][10.3743:3754]()
    if State.lines[State.cursor1.line+1].mode == 'drawing' then
    table.remove(State.lines, State.cursor1.line+1)
    else
    [10.3907]
    [10.3754]
    if State.lines[State.cursor1.line+1].mode == 'text' then
  • edit in text.lua at line 257
    [10.4154][10.4154:4210]()
    table.remove(State.lines, State.cursor1.line+1)
  • edit in text.lua at line 258
    [10.3914]
    [10.3914]
    table.remove(State.lines, State.cursor1.line+1)
    table.remove(State.text_line_cache, State.cursor1.line+1)
  • edit in text.lua at line 352
    [10.2281]
    [10.2281]
    table.insert(State.text_line_cache, State.cursor1.line+1, {})
  • edit in text.lua at line 355
    [4.242][4.242:302]()
    Text.clear_screen_line_cache(State, State.cursor1.line+1)
  • replacement in text.lua at line 424
    [10.937][10.4276:4374]()
    local screen_line_starting_pos = State.lines[State.cursor1.line].screen_line_starting_pos
    [10.937]
    [10.1023]
    local screen_line_starting_pos = State.text_line_cache[State.cursor1.line].screen_line_starting_pos
  • replacement in text.lua at line 446
    [10.1956][10.5098:5211]()
    new_screen_line_starting_pos = State.lines[State.cursor1.line].screen_line_starting_pos[screen_line_index-1]
    [10.1956]
    [10.2057]
    new_screen_line_starting_pos = State.text_line_cache[State.cursor1.line].screen_line_starting_pos[screen_line_index-1]
  • replacement in text.lua at line 489
    [10.233][10.6767:6880](),[10.1605][10.6767:6880](),[10.219][10.6767:6880]()
    new_screen_line_starting_pos = State.lines[State.cursor1.line].screen_line_starting_pos[screen_line_index+1]
    [10.1605]
    [10.4192]
    new_screen_line_starting_pos = State.text_line_cache[State.cursor1.line].screen_line_starting_pos[screen_line_index+1]
  • replacement in text.lua at line 626
    [10.351][10.617:768](),[10.2442][10.617:768](),[10.617][10.617:768]()
    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]
    [10.351]
    [10.768]
    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]
  • replacement in text.lua at line 637
    [10.420][10.1960:2040](),[10.2591][10.1960:2040](),[10.1960][10.1960:2040]()
    local screen_lines = State.lines[State.cursor1.line].screen_line_starting_pos
    [10.420]
    [10.2040]
    local screen_lines = State.text_line_cache[State.cursor1.line].screen_line_starting_pos
  • edit in text.lua at line 656
    [10.2737]
    [10.402]
    table.insert(State.text_line_cache, {})
  • replacement in text.lua at line 703
    [10.36][10.1014:1085](),[10.48][10.1014:1085](),[10.88][10.1014:1085](),[10.2924][10.1014:1085](),[10.3927][10.1014:1085](),[10.47][10.1014:1085]()
    if line.starty == nil then return false end -- outside current page
    [10.88]
    [10.2925]
    local line_cache = State.text_line_cache[line_index]
    if line_cache.starty == nil then return false end -- outside current page
  • replacement in text.lua at line 706
    [10.85][10.1086:1129](),[10.2967][10.1086:1129](),[10.2385][10.1086:1129]()
    if y < line.starty then return false end
    [10.2967]
    [10.421]
    if y < line_cache.starty then return false end
  • replacement in text.lua at line 708
    [10.481][6.3:156]()
    return y < line.starty + State.line_height*(#line.screen_line_starting_pos - Text.screen_line_index(line.screen_line_starting_pos, line.startpos) + 1)
    [10.481]
    [10.95]
    return y < line_cache.starty + State.line_height*(#line_cache.screen_line_starting_pos - Text.screen_line_index(line_cache.screen_line_starting_pos, line_cache.startpos) + 1)
  • replacement in text.lua at line 714
    [10.59][10.3:35](),[5.98][10.3:35](),[10.1358][10.3:35](),[10.1810][10.3:35](),[10.3091][10.3:35](),[10.4120][10.3:35](),[10.4536][10.3:35](),[10.628][10.3:35]()
    if line.fragments == nil then
    [5.98]
    [7.733]
    local line_cache = State.text_line_cache[line_index]
    if line_cache.fragments == nil then
  • replacement in text.lua at line 718
    [10.86][10.1253:1281]()
    assert(my >= line.starty)
    [10.86]
    [10.863]
    assert(my >= line_cache.starty)
  • replacement in text.lua at line 720
    [10.904][10.1282:1306](),[10.1306][6.157:260](),[6.260][10.1384:1554](),[10.1384][10.1384:1554]()
    local y = line.starty
    local start_screen_line_index = Text.screen_line_index(line.screen_line_starting_pos, line.startpos)
    for screen_line_index = start_screen_line_index,#line.screen_line_starting_pos do
    local screen_line_starting_pos = line.screen_line_starting_pos[screen_line_index]
    [10.904]
    [10.1554]
    local y = line_cache.starty
    local start_screen_line_index = Text.screen_line_index(line_cache.screen_line_starting_pos, line_cache.startpos)
    for screen_line_index = start_screen_line_index,#line_cache.screen_line_starting_pos do
    local screen_line_starting_pos = line_cache.screen_line_starting_pos[screen_line_index]
  • replacement in text.lua at line 731
    [10.352][8.3:138]()
    if screen_line_index < #line.screen_line_starting_pos and mx > Text.screen_line_width(State, line_index, screen_line_index) then
    [10.352]
    [10.1479]
    if screen_line_index < #line_cache.screen_line_starting_pos and mx > Text.screen_line_width(State, line_index, screen_line_index) then
  • replacement in text.lua at line 733
    [10.1535][10.1876:1944]()
    return line.screen_line_starting_pos[screen_line_index+1]-1
    [10.1535]
    [10.528]
    return line_cache.screen_line_starting_pos[screen_line_index+1]-1
  • replacement in text.lua at line 746
    [8.232][10.1093:1146](),[10.1093][10.1093:1146]()
    local start_pos = line.screen_line_starting_pos[i]
    [8.232]
    [10.1146]
    local line_cache = State.text_line_cache[line_index]
    local start_pos = line_cache.screen_line_starting_pos[i]
  • replacement in text.lua at line 750
    [10.1223][10.1223:1328]()
    if i < #line.screen_line_starting_pos then
    local past_end_pos = line.screen_line_starting_pos[i+1]
    [10.1223]
    [10.1328]
    if i < #line_cache.screen_line_starting_pos then
    local past_end_pos = line_cache.screen_line_starting_pos[i+1]
  • replacement in text.lua at line 854
    [10.541][10.4336:4469](),[10.3516][10.4336:4469](),[10.4336][10.4336:4469]()
    for i=#State.lines[pos1.line].screen_line_starting_pos,1,-1 do
    local spos = State.lines[pos1.line].screen_line_starting_pos[i]
    [10.541]
    [10.352]
    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]
  • replacement in text.lua at line 869
    [10.8326][10.4502:4607]()
    result.pos = State.lines[pos2.line].screen_line_starting_pos[pos2.screen_line] + pos2.screen_pos - 1
    [10.8326]
    [10.8421]
    result.pos = State.text_line_cache[pos2.line].screen_line_starting_pos[pos2.screen_line] + pos2.screen_pos - 1
  • replacement in text.lua at line 918
    [10.605][10.4849:4957](),[10.3660][10.4849:4957](),[10.4849][10.4849:4957]()
    return {line=pos2.line-1, screen_line=#State.lines[pos2.line-1].screen_line_starting_pos, screen_pos=1}
    [10.605]
    [10.1960]
    return {line=pos2.line-1, screen_line=#State.text_line_cache[pos2.line-1].screen_line_starting_pos, screen_pos=1}
  • replacement in text.lua at line 924
    [10.604][10.70:110](),[10.712][10.70:110](),[10.796][10.70:110](),[10.2283][10.70:110]()
    if line.screen_line_starting_pos then
    [10.712]
    [10.110]
    local line_cache = State.text_line_cache[line_index]
    if line_cache.screen_line_starting_pos then
  • replacement in text.lua at line 929
    [10.168][10.2283:2315](),[10.2283][10.2283:2315]()
    if line.fragments == nil then
    [10.168]
    [7.780]
    if line_cache.fragments == nil then
  • replacement in text.lua at line 932
    [10.2366][10.91:129]()
    line.screen_line_starting_pos = {1}
    [10.2366]
    [10.772]
    line_cache.screen_line_starting_pos = {1}
  • replacement in text.lua at line 935
    [10.2397][10.2397:2437]()
    for _, f in ipairs(line.fragments) do
    [10.2397]
    [10.2437]
    for _, f in ipairs(line_cache.fragments) do
  • replacement in text.lua at line 941
    [10.858][10.194:249](),[10.865][10.194:249](),[10.2589][10.194:249](),[10.194][10.194:249]()
    table.insert(line.screen_line_starting_pos, pos)
    [10.858]
    [10.2818]
    table.insert(line_cache.screen_line_starting_pos, pos)
  • replacement in text.lua at line 955
    [10.652][10.221:314](),[10.926][10.221:314](),[10.3783][10.221:314](),[10.221][10.221:314]()
    for i=2,#line.screen_line_starting_pos do
    local pos = line.screen_line_starting_pos[i]
    [10.5176]
    [10.5177]
    local line_cache = State.text_line_cache[State.screen_top1.line]
    for i=2,#line_cache.screen_line_starting_pos do
    local pos = line_cache.screen_line_starting_pos[i]
  • replacement in text.lua at line 963
    [10.462][10.462:516]()
    local prev = line.screen_line_starting_pos[i-1]
    [10.462]
    [10.5260]
    local prev = line_cache.screen_line_starting_pos[i-1]
  • replacement in text.lua at line 1000
    [10.732][4.303:351](),[4.351][10.1828:1874](),[10.5951][10.1828:1874](),[10.78621][10.1828:1874](),[10.4058][10.1828:1874](),[10.1874][4.352:404]()
    for line_index,line in ipairs(State.lines) do
    line.starty = nil
    line.startpos = nil
    Text.clear_screen_line_cache(State, line_index)
    [10.732]
    [10.2910]
    State.text_line_cache = {}
    for i=1,#State.lines do
    State.text_line_cache[i] = {}
  • replacement in text.lua at line 1007
    [4.462][4.462:561]()
    State.lines[line_index].fragments = nil
    State.lines[line_index].screen_line_starting_pos = nil
    [4.462]
    [10.438]
    State.text_line_cache[line_index].fragments = nil
    State.text_line_cache[line_index].screen_line_starting_pos = nil
  • edit in select.lua at line 152
    [91.2984]
    [10.47774]
    table.remove(State.text_line_cache, i)
  • edit in main.lua at line 42
    [10.85408]
    [10.85408]
    Text.redraw_all(Editor_state)
  • edit in main.lua at line 53
    [10.85649]
    [10.85649]
    Text.redraw_all(Editor_state)
  • edit in edit.lua at line 41
    [10.94636][10.94636:94715](),[10.94715][10.119:300](),[10.300][10.94715:94918](),[10.94715][10.94715:94918]()
    -- some cached data that's blown away and recomputed when data changes:
    -- startpos, the index of data the line starts rendering from (if currently on screen), can only be >1 for topmost line on screen
    -- starty, the y coord in pixels
    -- fragments: snippets of rendered love.graphics.Text, guaranteed to not wrap
    -- screen_line_starting_pos: optional array of grapheme indices if it wraps over more than one screen line
  • replacement in edit.lua at line 57
    [10.95767][10.95767:95805]()
    lines = {{mode='text', data=''}},
    [10.95767]
    [10.1993]
    lines = {{mode='text', data=''}}, -- array of lines
  • replacement in edit.lua at line 61
    [10.95916][10.95916:96009]()
    --
    -- Therefore, any potential location for the cursor can be described in two ways:
    [10.95916]
    [10.96009]
    -- rendering wrapped text lines needs some additional short-lived data per line:
    -- startpos, the index of data the line starts rendering from, can only be >1 for topmost line on screen
    -- starty, the y coord in pixels the line starts rendering from
    -- fragments: snippets of rendered love.graphics.Text, guaranteed to not straddle screen lines
    -- screen_line_starting_pos: optional array of grapheme indices if it wraps over more than one screen line
    text_line_cache = {},
    -- Given wrapping, any potential location for the text cursor can be described in two ways:
  • edit in edit.lua at line 124
    [89.2826]
    [89.2826]
    assert(#State.lines == #State.text_line_cache)
  • edit in edit.lua at line 147
    [93.609]
    [93.609]
    table.insert(State.text_line_cache, line_index, {})
  • edit in edit.lua at line 350
    [89.8139]
    [2.15]
    patch_placeholders(State.text_line_cache, event.after, event.before)
  • edit in drawing_tests.lua at line 11
    [10.106007]
    [89.9644]
    Text.redraw_all(Editor_state)
  • edit in drawing_tests.lua at line 32
    [10.106265]
    [10.106265]
    Text.redraw_all(Editor_state)
  • edit in drawing_tests.lua at line 59
    [10.107100]
    [10.107100]
    Text.redraw_all(Editor_state)
  • edit in drawing_tests.lua at line 78
    [10.107305]
    [10.107305]
    Text.redraw_all(Editor_state)
  • edit in drawing_tests.lua at line 107
    [10.108303]
    [10.108303]
    Text.redraw_all(Editor_state)
  • edit in drawing_tests.lua at line 137
    [10.109415]
    [10.109415]
    Text.redraw_all(Editor_state)
  • edit in drawing_tests.lua at line 160
    [10.110374]
    [10.110374]
    Text.redraw_all(Editor_state)
  • edit in drawing_tests.lua at line 177
    [10.110830]
    [10.110830]
    Text.redraw_all(Editor_state)
  • edit in drawing_tests.lua at line 206
    [10.111965]
    [10.111965]
    Text.redraw_all(Editor_state)
  • edit in drawing_tests.lua at line 238
    [10.113028]
    [89.9860]
    Text.redraw_all(Editor_state)
  • edit in drawing_tests.lua at line 277
    [10.114146]
    [89.9887]
    Text.redraw_all(Editor_state)
  • edit in drawing_tests.lua at line 322
    [10.115386]
    [89.9914]
    Text.redraw_all(Editor_state)
  • edit in drawing_tests.lua at line 359
    [10.116581]
    [89.9941]
    Text.redraw_all(Editor_state)
  • edit in drawing_tests.lua at line 404
    [10.117835]
    [10.117835]
    Text.redraw_all(Editor_state)
  • edit in drawing_tests.lua at line 437
    [10.118480]
    [10.118480]
    Text.redraw_all(Editor_state)
  • edit in drawing_tests.lua at line 449
    [10.118741]
    [10.118741]
    Text.redraw_all(Editor_state)
  • edit in drawing_tests.lua at line 469
    [10.119131]
    [10.119131]
    Text.redraw_all(Editor_state)
  • edit in drawing_tests.lua at line 496
    [10.119696]
    [10.119696]
    Text.redraw_all(Editor_state)
  • edit in drawing_tests.lua at line 509
    [10.119957]
    [10.119957]
    Text.redraw_all(Editor_state)
  • edit in drawing_tests.lua at line 536
    [10.120698]
    [10.120698]
    Text.redraw_all(Editor_state)
  • edit in drawing_tests.lua at line 557
    [10.121440]
    [10.121440]
    Text.redraw_all(Editor_state)
  • edit in drawing_tests.lua at line 567
    [10.121689]
    [10.121689]
    Text.redraw_all(Editor_state)
  • edit in drawing_tests.lua at line 592
    [10.122534]
    [10.122534]
    Text.redraw_all(Editor_state)
  • edit in drawing_tests.lua at line 624
    [10.123352]
    [10.123352]
    Text.redraw_all(Editor_state)
  • edit in drawing_tests.lua at line 653
    [10.124094]
    [10.124094]
    Text.redraw_all(Editor_state)
  • edit in drawing_tests.lua at line 691
    [10.124869]
    [10.124869]
    Text.redraw_all(Editor_state)
  • edit in drawing_tests.lua at line 703
    [10.125130]
    [10.125130]
    Text.redraw_all(Editor_state)
  • edit in drawing_tests.lua at line 742
    [10.125956]
    [10.125956]
    Text.redraw_all(Editor_state)
  • edit in drawing_tests.lua at line 755
    [10.126217]
    [10.126217]
    Text.redraw_all(Editor_state)
  • edit in drawing_tests.lua at line 783
    [10.127083]
    [10.127083]
    Text.redraw_all(Editor_state)