aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/test.lua
diff options
context:
space:
mode:
authorGravatar mitchell <70453897+orbitalquark@users.noreply.github.com>2021-04-12 01:50:22 -0400
committerGravatar mitchell <70453897+orbitalquark@users.noreply.github.com>2021-04-12 01:50:22 -0400
commit19899b518f18165b1dfb6d9b4b18e531f4b56249 (patch)
treeb6a5356b0453be53826d29947cb8b7221d37f796 /test/test.lua
parente17757efbd4d67901abb7cb165d93c76bdca2d8c (diff)
Fixed a bug where redoing a full-buffer change could jump to an unrelated state.
Do a simple position save instead of using the history mechanism.
Diffstat (limited to 'test/test.lua')
-rw-r--r--test/test.lua6
1 files changed, 3 insertions, 3 deletions
diff --git a/test/test.lua b/test/test.lua
index 4ed4f919..cc3458b6 100644
--- a/test/test.lua
+++ b/test/test.lua
@@ -2942,19 +2942,19 @@ function test_history_undo_full_buffer_change()
textadept.editing.filter_through('sort -n')
ui.update()
assert(buffer:get_line(buffer:line_from_position(buffer.current_pos)) ~= '150\n', 'not sorted')
- local first_visible_line = view.first_visible_line
+ local pos, first_visible_line = buffer.current_pos, view.first_visible_line
buffer:undo()
-- Verify the view state was restored.
ui.update()
if CURSES then events.emit(events.UPDATE_UI, buffer.UPDATE_SELECTION) end
- assert_equal(buffer:line_from_position(buffer.current_pos), 50)
+ assert_equal(buffer.current_pos, pos)
assert_equal(buffer:get_line(buffer:line_from_position(buffer.current_pos)), '150\n')
assert_equal(view.first_visible_line, first_visible_line)
buffer:redo()
-- Verify the previous view state was kept.
ui.update()
if CURSES then events.emit(events.UPDATE_UI, buffer.UPDATE_SELECTION) end
- assert_equal(buffer:line_from_position(buffer.current_pos), 50)
+ assert_equal(buffer.current_pos, pos)
assert_equal(view.first_visible_line, first_visible_line)
buffer:close(true)
end