support other whitespace chars in word movements
[?]
Jul 12, 2022, 1:56 AM
2LC3BM2NCIR76UILI5D4DVC5KYJSBVHDNMOC5G3TOJNCRLX6PZEQCDependencies
- [2]
MP2TBKU6bugfix: crash in Text.up() after return - [3]
NUZFHX6Iflesh out some tests for word movements - [4]
62PZGSUCoptimization: moving cursor to next word - [5]
ZPUQSPQPextract a few methods - [6]
DHI6IJCNselecting text and deleting selections - [7]
ZHLO7K3Madd args to some functions - [*]
LXTTOB33extract a couple of files - [*]
BULPIBEGbeginnings of a module for the text editor - [*]
KECEMMMRextract couple of functions
Change contents
- edit in text_tests.lua at line 142
endfunction test_skip_past_tab_to_previous_word()io.write('\ntest_skip_past_tab_to_previous_word')App.screen.init{width=120, height=60}Lines = load_array{'abc def\tghi'}Cursor1 = {line=1, pos=10} -- within third wordMargin_right = 0; Margin_width = Margin_leftApp.draw()App.run_after_keychord('M-left')check_eq(Cursor1.pos, 9, 'F - test_skip_past_tab_to_previous_word') - edit in text_tests.lua at line 189
function test_skip_past_tab_to_next_word()io.write('\ntest_skip_past_tab_to_next_word')App.screen.init{width=120, height=60}Lines = load_array{'abc\tdef'}Cursor1 = {line=1, pos=1} -- at the space between wordsMargin_right = 0; Margin_width = Margin_leftApp.draw()App.run_after_keychord('M-right')check_eq(Cursor1.pos, 4, 'F - test_skip_past_tab_to_next_word')end - replacement in text.lua at line 522
local offset = Text.offset(Lines[Cursor1.line].data, Cursor1.pos)assert(offset > 1)if Lines[Cursor1.line].data:sub(offset-1,offset-1) == ' ' thenif Text.match(Lines[Cursor1.line].data, Cursor1.pos-1, '%s') then - replacement in text.lua at line 532
local offset = Text.offset(Lines[Cursor1.line].data, Cursor1.pos)if Lines[Cursor1.line].data:sub(offset,offset) == ' ' then -- TODO: other space charactersif Text.match(Lines[Cursor1.line].data, Cursor1.pos, '%s') then - edit in text.lua at line 539[11.42][11.42]
endfunction Text.match(s, pos, pat)local start_offset = Text.offset(s, pos)assert(start_offset)local end_offset = Text.offset(s, pos+1)assert(end_offset > start_offset)local curr = s:sub(start_offset, end_offset-1)return curr:match(pat)