bugfix: search
[?]
Jul 21, 2022, 11:53 PM
FZBXBUFFNRE5ZJO5DLRU375HOXT2B7FO35XD7BTHHUXSARVWDFLQCDependencies
- [2]
HALS7E5Umore clearly skip prints before screen top - [3]
HOSPP2ANcrisp font rendering - [4]
Z4XRNDTRfind text - [*]
LXTTOB33extract a couple of files - [*]
BULPIBEGbeginnings of a module for the text editor
Change contents
- edit in text_tests.lua at line 1968[6.43800]
function test_search()io.write('\ntest_search')App.screen.init{width=120, height=60}Editor_state = edit.initialize_test_state()Editor_state.lines = load_array{'abc', 'def', 'ghi', 'deg'}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)local y = Editor_state.topApp.screen.check(y, 'abc', 'F - test_search/baseline/screen:1')y = y + Editor_state.line_heightApp.screen.check(y, 'def', 'F - test_search/baseline/screen:2')y = y + Editor_state.line_heightApp.screen.check(y, 'ghi', 'F - test_search/baseline/screen:3')-- search for a stringedit.run_after_keychord(Editor_state, 'C-f')edit.run_after_textinput(Editor_state, 'd')edit.run_after_keychord(Editor_state, 'return')check_eq(Editor_state.cursor1.line, 2, 'F - test_search/1/cursor:line')check_eq(Editor_state.cursor1.pos, 1, 'F - test_search/1/cursor:pos')-- reset cursorEditor_state.cursor1 = {line=1, pos=1}-- search for second occurrenceedit.run_after_keychord(Editor_state, 'C-f')edit.run_after_textinput(Editor_state, 'de')edit.run_after_keychord(Editor_state, 'down')edit.run_after_keychord(Editor_state, 'return')check_eq(Editor_state.cursor1.line, 4, 'F - test_search/2/cursor:line')check_eq(Editor_state.cursor1.pos, 1, 'F - test_search/2/cursor:pos')end - replacement in text.lua at line 54
local lo_px = Text.draw_highlight(line, x,y, pos, State.cursor1.pos, State.cursor1.pos+utf8.len(State.search_term))local lo_px = Text.draw_highlight(State, line, x,y, pos, State.cursor1.pos, State.cursor1.pos+utf8.len(State.search_term))