bugfix: check after cursor on same line when searching upwards
[?]
Aug 12, 2022, 5:23 AM
AMOPICKVRHMQERJLFPMAAEBV7TL5QACGGSBJWRCMV5R5O3KDVETACDependencies
- [2]
LLAOOMULbugfix: search upwards - [3]
LXTTOB33extract a couple of files - [4]
LF7BWEG4group all editor globals - [5]
5ZA3BRNYadd state arg to a few functions - [*]
MSOQI3A5bugfix: check before cursor on same line
Change contents
- edit in text_tests.lua at line 2086[7.716]
function test_search_wrap_upwards()io.write('\ntest_search_wrap_upwards')App.screen.init{width=120, height=60}Editor_state = edit.initialize_test_state()Editor_state.lines = load_array{'abc abd'}Text.redraw_all(Editor_state)Editor_state.cursor1 = {line=1, pos=1}Editor_state.screen_top1 = {line=1, pos=1}Editor_state.screen_bottom1 = {}edit.draw(Editor_state)-- search upwards for a stringedit.run_after_keychord(Editor_state, 'C-f')edit.run_after_textinput(Editor_state, 'a')edit.run_after_keychord(Editor_state, 'up')-- cursor wrapscheck_eq(Editor_state.cursor1.line, 1, 'F - test_search_wrap_upwards/1/cursor:line')check_eq(Editor_state.cursor1.pos, 5, 'F - test_search_wrap_upwards/1/cursor:pos')end - replacement in search.lua at line 71
-- search current line-- search current line before cursor - edit in search.lua at line 77
-- search lines above cursor - edit in search.lua at line 96
endendif pos == nil then-- search current line after cursorpos = rfind(State.lines[State.cursor1.line].data, State.search_term)if pos and pos > State.cursor1.pos thenState.cursor1.pos = pos