skip multiple consecutive whitespace
[?]
Jul 12, 2022, 2:18 AM
V3EABA35RWCOOU5OMIYRWXAKZOLHO4XPGTPOKY24RR2LOAD7ZQAQCDependencies
- [2]
ZHLO7K3Madd args to some functions - [3]
2LC3BM2Nsupport other whitespace chars in word movements - [4]
MP2TBKU6bugfix: crash in Text.up() after return - [5]
62PZGSUCoptimization: moving cursor to next word - [6]
ZPUQSPQPextract a few methods - [*]
LXTTOB33extract a couple of files - [*]
NUZFHX6Iflesh out some tests for word movements - [*]
BULPIBEGbeginnings of a module for the text editor
Change contents
- edit in text_tests.lua at line 153
endfunction test_skip_multiple_spaces_to_previous_word()io.write('\ntest_skip_multiple_spaces_to_previous_word')App.screen.init{width=120, height=60}Lines = load_array{'abc def'}Cursor1 = {line=1, pos=6} -- at the start of second wordMargin_right = 0; Margin_width = Margin_leftApp.draw()App.run_after_keychord('M-left')check_eq(Cursor1.pos, 1, 'F - test_skip_multiple_spaces_to_previous_word') - edit in text_tests.lua at line 211
function test_skip_multiple_spaces_to_next_word()io.write('\ntest_skip_multiple_spaces_to_next_word')App.screen.init{width=120, height=60}Lines = load_array{'abc def'}Cursor1 = {line=1, pos=4} -- at the start of second wordMargin_right = 0; Margin_width = Margin_leftApp.draw()App.run_after_keychord('M-right')check_eq(Cursor1.pos, 9, 'F - test_skip_multiple_spaces_to_next_word')end - edit in text.lua at line 518
-- skip some whitespace - edit in text.lua at line 520
if Cursor1.pos == 1 thenbreakendif Text.match(Lines[Cursor1.line].data, Cursor1.pos-1, '%S') thenbreakend - replacement in text.lua at line 527
if Cursor1.pos == 1 then break endend-- skip some non-whitespacewhile true doText.left(left, right)if Cursor1.pos == 1 thenbreakend - edit in text.lua at line 542
-- skip some whitespacewhile true doif Cursor1.pos > utf8.len(Lines[Cursor1.line].data) thenbreakendif Text.match(Lines[Cursor1.line].data, Cursor1.pos, '%S') thenbreakendText.right_without_scroll()end - replacement in text.lua at line 554
if Cursor1.pos > utf8.len(Lines[Cursor1.line].data) then break endif Cursor1.pos > utf8.len(Lines[Cursor1.line].data) thenbreakend