From f107c48f8fbc4ef27b2bb1d4d01420229421b885 Mon Sep 17 00:00:00 2001 From: mitchell <70453897+orbitalquark@users.noreply.github.com> Date: Sat, 19 Dec 2020 11:27:08 -0500 Subject: Ensure a bare `ui.find.focus()` call resets incremental and in files options. --- test/test.lua | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'test') diff --git a/test/test.lua b/test/test.lua index 37f525b2..25aff22a 100644 --- a/test/test.lua +++ b/test/test.lua @@ -2656,6 +2656,23 @@ function test_find_replace_regex_transforms() buffer:close(true) end +function test_ui_find_focus() + buffer:new() + buffer:append_text(' foo\n\n foo') + ui.find.focus{incremental = true} + ui.find.find_entry_text = 'foo' + if CURSES then events.emit(events.FIND_TEXT_CHANGED) end -- simulate + assert_equal(buffer:line_from_position(buffer.current_pos), 1) + buffer:line_down() + ui.find.focus() -- should turn off incremental find + ui.find.find_entry_text = 'f' + if CURSES then events.emit(events.FIND_TEXT_CHANGED) end -- simulate + assert_equal(buffer:line_from_position(buffer.current_pos), 2) + buffer:close(true) + + assert_raises(function() ui.find.focus(1) end, 'table/nil expected, got number') +end + function test_history() local filename1 = _HOME .. '/test/modules/textadept/history/1' io.open_file(filename1) -- cgit v1.2.3