no more Text allocations

[?]
Apr 1, 2023, 11:38 PM
H4R5BHVYKFKF2JOFITQ45VEVW32BOWIMHWFOQ35KAUS6QUI7G5QQC

Dependencies

  • [2] XUGDTYW2 stop confusingly reading a global
  • [3] OYVFFWBK move
  • [4] LWPRYDLW set color for each fragment
  • [5] UN7GKYV5 support hyperlinks in the source editor
  • [6] 537TQ2QN some more logging
  • [7] 2CK5QI7W make love event names consistent
  • [8] AYE2VEGJ extract a couple of methods
  • [9] 6WDBV52Z move a var closer to its use
  • [10] JRGTJ2IW quite the frustrating bugfix
  • [11] LDFXFRUO bring a few things in sync between run and source
  • [12] HOSPP2AN crisp font rendering
  • [13] IMEJA43L snapshot
  • [14] FZBXBUFF bugfix: search
  • [15] M6TH7VSZ rip out notion of Line_width
  • [16] CNCYMM6A make test initializations a little more obvious
  • [17] KKMFQDR4 editing source code from within the app
  • [18] 2L4DL7PG go through App in a couple more places
  • [19] TXHMMX25 move caching behavior inside compute_fragments
  • [20] H2DPLWMV snapshot: wrapping long lines at word boundaries
  • [21] 3QWK3GSA support mouse clicks in file navigator
  • [22] A2NV3WVO scrolling with up arrow
  • [23] KMSL74GA support selections in the source editor
  • [24] 2L5MEZV3 experiment: new edit namespace
  • [25] CVGE3SIG I feel confident now that page-down is working.
  • [26] WLHI7KD3 new globals: draw partial screen line up top
  • [27] JY4VK7L2 rename
  • [28] JLU2RMC4 allow Text.nearest_pos_less_than to return 0
  • [29] JMUD7T3O get rid of ugly side-effects in tests
  • [30] PX7DDEMO autosave slightly less aggressively
  • [31] UPCIYZEU drop an unnecessary level of indent
  • [32] OI4FPFIN support drawings in the source editor
  • [33] HKV72RZV bugfix: save modified files in save directory
  • [34] ILOA5BYF separate data structure for each line's cache data
  • [35] PFT5Y2ZY move
  • [36] QYIFOHW3 first test!
  • [37] G54H3YG2 get rid of all bifold text
  • [38] KURLAXXI clean up some prints
  • [39] 2ZRC7FUL .
  • [40] ISOFHXB2 App.width can no longer take a Text
  • [41] DHI6IJCN selecting text and deleting selections
  • [42] HGC5RGJP switch to line index in a function
  • [43] OYXDYPGS get rid of debug variables
  • [44] 5L7K4GBD clicking to the right of a wrapped line
  • [45] HALS7E5U more clearly skip prints before screen top
  • [46] AVTNUQYR basic test-enabled framework
  • [47] ZDAJXYIX remove some unnecessary work
  • [48] 4KC7I3E2 make colors easier to edit
  • [49] LAW2O3NW extract variable Margin_left
  • [50] 5DOC2CBM extract a function
  • [51] X3F7ECSL add state arg to some functions
  • [52] R3KXFRZN get rid of to_text
  • [53] Z4XRNDTR find text
  • [54] NDHQN23G done passing left/right margins everywhere
  • [*] BULPIBEG beginnings of a module for the text editor
  • [*] 3QNOKBFM beginnings of a test harness

Change contents

  • replacement in text.lua at line 18
    [4.29][6.1941:1984](),[6.3906][6.1941:1984](),[6.1941][6.1941:1984](),[6.46][6.1:37](),[6.62][6.1:37](),[6.37][6.3:73]()
    local frag, frag_text = f.data, f.text
    local frag_len = utf8.len(frag)
    --? print('text.draw:', frag, 'at', line_index,pos, 'after', x,y)
    [4.29]
    [2.48]
    local frag_len = utf8.len(f.data)
    --? print('text.draw:', f.data, 'at', line_index,pos, 'after', x,y)
  • replacement in text.lua at line 22
    [6.95][6.95:129]()
    --? print('skipping', frag)
    [6.95]
    [6.129]
    --? print('skipping', f.data)
  • replacement in text.lua at line 39
    [6.54][6.296:334]()
    App.screen.draw(frag_text, x,y)
    [6.1066]
    [6.259]
    App.screen.print(f.data, x,y)
  • replacement in text.lua at line 50
    [6.869][6.869:949]()
    Text.draw_cursor(State, x+Text.x(frag, State.cursor1.pos-pos+1), y)
    [6.869]
    [6.530]
    Text.draw_cursor(State, x+Text.x(f.data, State.cursor1.pos-pos+1), y)
  • edit in text.lua at line 90
    [3.528][3.528:571]()
    local frag, frag_text = f.data, f.text
  • replacement in text.lua at line 97
    [3.792][3.792:853]()
    local frag_len = utf8.len(frag)
    pos = pos + frag_len
    [3.792]
    [3.853]
    pos = pos + utf8.len(f.data)
  • edit in text.lua at line 113
    [6.168][6.682:747]()
    local frag_text = App.newText(love.graphics.getFont(), frag)
  • edit in text.lua at line 127
    [6.729][6.729:800]()
    local frag1_text = App.newText(love.graphics.getFont(), frag1)
  • replacement in text.lua at line 130
    [6.982][6.982:1056]()
    table.insert(line_cache.fragments, {data=frag1, text=frag1_text})
    [6.982]
    [6.1056]
    table.insert(line_cache.fragments, {data=frag1})
  • edit in text.lua at line 132
    [6.1097][6.1097:1160]()
    frag_text = App.newText(love.graphics.getFont(), frag)
  • replacement in text.lua at line 138
    [6.618][6.4068:4138](),[6.1485][6.4068:4138]()
    table.insert(line_cache.fragments, {data=frag, text=frag_text})
    [6.618]
    [6.1549]
    table.insert(line_cache.fragments, {data=frag})
  • replacement in source_text.lua at line 20
    [6.87502][6.87502:87674]()
    local frag, frag_text = f.data, f.text
    select_color(frag)
    local frag_len = utf8.len(frag)
    --? print('text.draw:', frag, 'at', line_index,pos, 'after', x,y)
    [6.87502]
    [6.87674]
    select_color(f.data)
    local frag_len = utf8.len(f.data)
    --? print('text.draw:', f.data, 'at', line_index,pos, 'after', x,y)
  • replacement in source_text.lua at line 25
    [6.87725][6.87725:87759]()
    --? print('skipping', frag)
    [6.87725]
    [6.87759]
    --? print('skipping', f.data)
  • replacement in source_text.lua at line 43
    [5.84][5.84:172]()
    local trimmed_word = rtrim(frag) -- compute_fragments puts whitespace at the end
    [5.84]
    [5.172]
    local trimmed_word = rtrim(f.data) -- compute_fragments puts whitespace at the end
  • replacement in source_text.lua at line 55
    [5.779][6.88189:88227](),[6.88189][6.88189:88227]()
    App.screen.draw(frag_text, x,y)
    [5.779]
    [6.88227]
    App.screen.print(f.data, x,y)
  • replacement in source_text.lua at line 66
    [6.88889][6.88889:88969]()
    Text.draw_cursor(State, x+Text.x(frag, State.cursor1.pos-pos+1), y)
    [6.88889]
    [6.88969]
    Text.draw_cursor(State, x+Text.x(f.data, State.cursor1.pos-pos+1), y)
  • edit in source_text.lua at line 106
    [6.91812][6.91812:91855]()
    local frag, frag_text = f.data, f.text
  • replacement in source_text.lua at line 113
    [6.92076][6.92076:92137]()
    local frag_len = utf8.len(frag)
    pos = pos + frag_len
    [6.92076]
    [6.92137]
    pos = pos + utf8.len(f.data)
  • edit in source_text.lua at line 129
    [6.92548][6.92548:92613]()
    local frag_text = App.newText(love.graphics.getFont(), frag)
  • edit in source_text.lua at line 143
    [6.93539][6.93539:93610]()
    local frag1_text = App.newText(love.graphics.getFont(), frag1)
  • replacement in source_text.lua at line 146
    [6.93792][6.93792:93866]()
    table.insert(line_cache.fragments, {data=frag1, text=frag1_text})
    [6.93792]
    [6.93866]
    table.insert(line_cache.fragments, {data=frag1})
  • edit in source_text.lua at line 148
    [6.93907][6.93907:93970]()
    frag_text = App.newText(love.graphics.getFont(), frag)
  • replacement in source_text.lua at line 154
    [6.94166][6.94166:94236]()
    table.insert(line_cache.fragments, {data=frag, text=frag_text})
    [6.94166]
    [6.94236]
    table.insert(line_cache.fragments, {data=frag})
  • edit in source_edit.lua at line 91
    [6.154866][6.154866:154954]()
    em = App.newText(love.graphics.getFont(), 'm'), -- widest possible character width
  • edit in edit.lua at line 90
    [6.5282][6.5282:5370]()
    em = App.newText(love.graphics.getFont(), 'm'), -- widest possible character width
  • edit in app.lua at line 213
    [6.1618][6.6426:6717](),[6.6426][6.6426:6717](),[6.6717][6.266:271]()
    -- LÖVE's Text primitive retains no trace of the string it was created from,
    -- so we'll wrap it for our tests.
    --
    -- This implies that we need to hook any operations we need on Text objects.
    function App.newText(font, s)
    return {type='text', data=s, text=love.graphics.newText(font, s)}
    end
  • edit in app.lua at line 418
    [6.8029][6.8029:8067]()
    App.newText = love.graphics.newText