bugfix: backspace from start of final line
[?]
Aug 11, 2022, 5:38 AM
62JEPVQ34SOTQI6VQNLGLKS5O4KFU52UKAVDHN6N7G5T6Z5EZO5QCDependencies
- [2]
JJDT2X4Funnecessary args - [3]
UHB4GARJleft/right margin -> left/right coordinates - [4]
LF7BWEG4group all editor globals - [5]
HMODUNJEscroll on backspace - [6]
SPSW74Y5add state arg to Text.keychord_pressed - [7]
2RXZ3PGObeginning of a new approach to scroll+wrap - [8]
XNFTJHC4split keyboard handling between Text and Drawing - [9]
QCPXQ2E3add state arg to a few functions - [10]
AYE2VEGJextract a couple of methods - [*]
LXTTOB33extract a couple of files - [*]
DSLD74DKlots more tests - [*]
BULPIBEGbeginnings of a module for the text editor
Change contents
- edit in text_tests.lua at line 43
endfunction test_backspace_from_start_of_final_line()io.write('\ntest_backspace_from_start_of_final_line')-- display final line of text with cursor at start of itApp.screen.init{width=120, height=60}Editor_state = edit.initialize_test_state()Editor_state.lines = load_array{'abc', 'def'}Editor_state.screen_top1 = {line=2, pos=1}Editor_state.cursor1 = {line=2, pos=1}Text.redraw_all(Editor_state)-- backspace scrolls upedit.run_after_keychord(Editor_state, 'backspace')check_eq(#Editor_state.lines, 1, 'F - test_backspace_from_start_of_final_line/#lines')check_eq(Editor_state.cursor1.line, 1, 'F - test_backspace_from_start_of_final_line/cursor')check_eq(Editor_state.screen_top1.line, 1, 'F - test_backspace_from_start_of_final_line/screen_top') - replacement in text.lua at line 209
if Text.lt1(State.cursor1, State.screen_top1) thenif State.screen_top1.line > #State.lines thenText.populate_screen_line_starting_pos(State, #State.lines)local line_cache = State.line_cache[#State.line_cache]State.screen_top1 = {line=#State.lines, pos=line_cache.screen_line_starting_pos[#line_cache.screen_line_starting_pos]}elseif Text.lt1(State.cursor1, State.screen_top1) then