From 03c4016d07477781aa3adcc9edf340c0bec9c6c8 Mon Sep 17 00:00:00 2001 From: mitchell <70453897+orbitalquark@users.noreply.github.com> Date: Tue, 20 Oct 2020 15:29:03 -0400 Subject: Code cleanup. Of note: * io.save_all_files() does not visit each buffer to save anymore. An unintended side-effect was checking for outside modification (but only if the file itself was modified), so outside changes will always be saved over now. * The menu clicked handler uses assert_type(), so the 'Unknown command' localization is no longer needed. * When printing to a new buffer type would split the view, use an existing split view when possible. * Prefer 'goto continue' construct in loops over nested 'if's. * Fixed clearing of ui.find.replace_entry_text on reset in the GUI version. * Fixed lack of statusbar updating when setting options like buffer EOL mode, indentation, and encoding. * Renamed internal new_snippet() to new() and put it in the snippet metatable. --- test/test.lua | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'test') diff --git a/test/test.lua b/test/test.lua index 1505f2c2..047f6601 100644 --- a/test/test.lua +++ b/test/test.lua @@ -786,6 +786,23 @@ function test_ui_print() ui.silent_print = silent_print end +function test_ui_print_to_other_view() + local silent_print = ui.silent_print + + ui.silent_print = false + view:split() + ui.goto_view(-1) + assert_equal(_VIEWS[view], 1) + ui.print('foo') -- should print to other view, not split again + assert_equal(#_VIEWS, 2) + assert_equal(_VIEWS[view], 2) + buffer:close() + ui.goto_view(-1) + view:unsplit() + + ui.silent_print = silent_print +end + function test_ui_dialogs_colorselect_interactive() local color = ui.dialogs.colorselect{title = 'Blue', color = 0xFF0000} assert_equal(color, 0xFF0000) @@ -1729,6 +1746,12 @@ function test_editing_transpose_chars() buffer:char_left() textadept.editing.transpose_chars() assert_equal(buffer:get_text(), '⌘⇧⌥') + buffer:clear_all() + textadept.editing.transpose_chars() + assert_equal(buffer:get_text(), '') + buffer:add_text('a') + textadept.editing.transpose_chars() + assert_equal(buffer:get_text(), 'a') -- TODO: multiple selection? buffer:close(true) end -- cgit v1.2.3