get rid of some ridiculous code
[?]
Aug 18, 2022, 8:04 PM
2LEXWUW3EQUVE6IZTQROWRU6GDKZER35TGVDL3HFYYSEMA2RZEHACDependencies
- [2]
TGHAJBESuse line cache for drawings as well - [3]
ILOA5BYFseparate data structure for each line's cache data - [4]
Z5HLXU4Padd state arg to a few functions - [5]
ZPUQSPQPextract a few methods - [6]
MP2TBKU6bugfix: crash in Text.up() after return - [7]
LF7BWEG4group all editor globals - [8]
CPZGQT72go through and fix similar issues - [9]
V5MJRFOZbugfix: down arrow doesn't scroll up unnecessarily - [*]
BULPIBEGbeginnings of a module for the text editor
Change contents
- edit in text.lua at line 445[3.1155]→[3.1155:1264](∅→∅),[3.1264]→[3.4375:4655](∅→∅),[3.4655]→[3.1508:1520](∅→∅),[3.68617]→[3.1508:1520](∅→∅),[3.1508]→[3.1508:1520](∅→∅)
--? print('previous screen line starts at pos '..tostring(screen_line_starting_pos)..' of its line')if State.screen_top1.line > State.cursor1.line thenState.screen_top1.line = State.cursor1.lineState.screen_top1.pos = screen_line_starting_pos--? print('pos of top of screen is also '..tostring(State.screen_top1.pos)..' of the same line')end - edit in text.lua at line 451[3.1714]→[3.4991:5097](∅→∅),[3.5097]→[3.1796:1804](∅→∅),[3.69129]→[3.1796:1804](∅→∅),[3.1796]→[3.1796:1804](∅→∅)
if State.cursor1.line < State.screen_top1.line thenState.screen_top1.line = State.cursor1.lineend - edit in text.lua at line 453
--? print('cursor is NOT at first screen line of its line') - edit in text.lua at line 455[2.569]→[3.2057:2203](∅→∅),[3.4751]→[3.2057:2203](∅→∅),[3.5211]→[3.2057:2203](∅→∅),[3.69257]→[3.2057:2203](∅→∅),[3.2057]→[3.2057:2203](∅→∅),[3.2203]→[3.5212:5472](∅→∅),[3.5472]→[3.2433:2441](∅→∅),[3.69553]→[3.2433:2441](∅→∅),[3.2433]→[3.2433:2441](∅→∅)
--? print('switching pos of screen line at cursor from '..tostring(screen_line_starting_pos)..' to '..tostring(new_screen_line_starting_pos))if State.screen_top1.line == State.cursor1.line and State.screen_top1.pos == screen_line_starting_pos thenState.screen_top1.pos = new_screen_line_starting_pos--? print('also setting pos of top of screen to '..tostring(State.screen_top1.pos))end - edit in text.lua at line 460
if Text.lt1(State.cursor1, State.screen_top1) thenlocal top2 = Text.to2(State, State.screen_top1)top2 = Text.previous_screen_line(State, top2)State.screen_top1 = Text.to1(State, top2)end