move
[?]
Aug 15, 2022, 11:07 PM
OYVFFWBK5IL7IPAF5HGFONJ2NEBRR3GTISPFROG7HJDEZYJAM7VQCDependencies
- [2]
EAEGCJV5rename - [3]
7QQXO4YYbugfix: handle drawings when updating screen top - [4]
M6TH7VSZrip out notion of Line_width - [5]
R53OF3ONone bug I've repeatedly run into while testing with Moby Dick - [6]
AYE2VEGJextract a couple of methods - [7]
QCPXQ2E3add state arg to a few functions - [8]
3OKKTUT4up and down arrow now moving by screen line where possible - [9]
CBPV5SSIstop handling nil screen_line_starting_pos everywhere - [10]
LAW2O3NWextract variable Margin_left - [11]
LF7BWEG4group all editor globals - [12]
KZ5GAYRPthis fixes the immediate regression - [13]
HOSPP2ANcrisp font rendering - [14]
2ENZW7TVselect text using mouse drag - [15]
2RXZ3PGObeginning of a new approach to scroll+wrap - [16]
GCEF4N3Vstop repeatedly checking for line wrapping - [17]
HGC5RGJPswitch to line index in a function - [18]
MXA3RZYKdeduce left/right from state where possible - [19]
BULPIBEGbeginnings of a module for the text editor - [20]
UV4EWOLYadd args to some functions - [21]
P66MRF3Ubugfix: don't append metadata when it already exists - [22]
ILOA5BYFseparate data structure for each line's cache data - [23]
NDHQN23Gdone passing left/right margins everywhere - [24]
ODLKHO7Bswitch to line index in a function - [25]
TGHAJBESuse line cache for drawings as well - [26]
2H67P75Xswitch arg for a function - [27]
4CTZOJPCstop pretending globals are local - [28]
4VKEE43Zbugfix - [*]
X3F7ECSLadd state arg to some functions - [*]
5DOC2CBMextract a function
Change contents
- edit in text.lua at line 83[30.1551][31.256]
endfunction Text.populate_screen_line_starting_pos(State, line_index)local line = State.lines[line_index]if line.mode ~= 'text' then return endlocal line_cache = State.line_cache[line_index]if line_cache.screen_line_starting_pos thenreturnend-- duplicate some logic from Text.drawif line_cache.fragments == nil thenText.compute_fragments(State, line_index)endline_cache.screen_line_starting_pos = {1}local x = State.leftlocal pos = 1for _, f in ipairs(line_cache.fragments) dolocal frag, frag_text = f.data, f.text-- render fragmentlocal frag_width = App.width(frag_text)if x + frag_width > State.right thenx = State.lefttable.insert(line_cache.screen_line_starting_pos, pos)endx = x + frag_widthlocal frag_len = utf8.len(frag)pos = pos + frag_lenend - edit in text.lua at line 942[4.630]→[4.1960:1966](∅→∅),[2.1229]→[4.1960:1966](∅→∅),[4.1498]→[4.1960:1966](∅→∅),[4.4957]→[4.1960:1966](∅→∅),[4.6840]→[4.1960:1966](∅→∅),[4.77528]→[4.1960:1966](∅→∅),[4.1960]→[4.1960:1966](∅→∅),[4.1966]→[4.8443:8448](∅→∅),[4.8443]→[4.8443:8448](∅→∅),[4.8448]→[4.606:712](∅→∅),[4.712]→[3.3:44](∅→∅),[3.44]→[4.1499:1549](∅→∅),[4.712]→[4.1499:1549](∅→∅),[4.1549]→[4.6896:6942](∅→∅),[4.6896]→[4.6896:6942](∅→∅),[4.6942]→[4.110:168](∅→∅),[4.110]→[4.110:168](∅→∅),[4.168]→[4.6943:6981](∅→∅),[4.6981]→[4.780:826](∅→∅),[4.2315]→[4.780:826](∅→∅),[4.715]→[4.2360:2366](∅→∅),[4.771]→[4.2360:2366](∅→∅),[4.826]→[4.2360:2366](∅→∅),[4.1878]→[4.2360:2366](∅→∅),[4.2360]→[4.2360:2366](∅→∅),[4.2366]→[4.6982:7026](∅→∅),[4.7026]→[4.772:795](∅→∅),[4.129]→[4.772:795](∅→∅),[4.795]→[4.2381:2397](∅→∅),[4.814]→[4.2381:2397](∅→∅),[4.2566]→[4.2381:2397](∅→∅),[4.2381]→[4.2381:2397](∅→∅),[4.2397]→[4.7027:7073](∅→∅),[4.7073]→[4.2437:2480](∅→∅),[4.2437]→[4.2437:2480](∅→∅),[4.2503]→[4.2503:2526](∅→∅),[4.2526]→[4.3942:3986](∅→∅),[4.3986]→[4.796:858](∅→∅),[4.858]→[4.7074:7135](∅→∅),[4.249]→[4.2818:2910](∅→∅),[4.1997]→[4.2818:2910](∅→∅),[4.7135]→[4.2818:2910](∅→∅),[4.2818]→[4.2818:2910](∅→∅)
endendfunction Text.populate_screen_line_starting_pos(State, line_index)local line = State.lines[line_index]if line.mode ~= 'text' then return endlocal line_cache = State.line_cache[line_index]if line_cache.screen_line_starting_pos thenreturnend-- duplicate some logic from Text.drawif line_cache.fragments == nil thenText.compute_fragments(State, line_index)endline_cache.screen_line_starting_pos = {1}local x = State.leftlocal pos = 1for _, f in ipairs(line_cache.fragments) dolocal frag, frag_text = f.data, f.text-- render fragmentlocal frag_width = App.width(frag_text)if x + frag_width > State.right thenx = State.lefttable.insert(line_cache.screen_line_starting_pos, pos)endx = x + frag_widthlocal frag_len = utf8.len(frag)pos = pos + frag_len