bugfix: search upwards
[?]
Aug 12, 2022, 3:14 AM
LLAOOMULEBXFMIGRBY6LRVEK4RXQGPNTFVWMCZNUEJZHWC7UGUEACDependencies
- [2]
MSOQI3A5bugfix: check before cursor on same line - [3]
LXTTOB33extract a couple of files - [4]
5ZA3BRNYadd state arg to a few functions - [5]
LF7BWEG4group all editor globals
Change contents
- edit in text_tests.lua at line 2049
function test_search_upwards()io.write('\ntest_search_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=2}Editor_state.screen_top1 = {line=1, pos=1}Editor_state.screen_bottom1 = {}edit.draw(Editor_state)-- search for a stringedit.run_after_keychord(Editor_state, 'C-f')edit.run_after_textinput(Editor_state, 'a')-- search for previous occurrenceedit.run_after_keychord(Editor_state, 'up')check_eq(Editor_state.cursor1.line, 1, 'F - test_search_upwards/2/cursor:line')check_eq(Editor_state.cursor1.pos, 1, 'F - test_search_upwards/2/cursor:pos')end - replacement in search.lua at line 82
local pos = rfind(State.lines[State.cursor1.line].data, State.search_term, State.cursor1.pos)local pos = rfind(State.lines[State.cursor1.line].data, State.search_term, State.cursor1.pos-1)