From 9ced05413474a7c8b8a8b2f36a27db29a37dfaf6 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Wed, 6 Jul 2022 19:01:44 +0800 Subject: fix(mark): fix unexpected cursor movements (#19253) --- test/functional/editor/mark_spec.lua | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'test') diff --git a/test/functional/editor/mark_spec.lua b/test/functional/editor/mark_spec.lua index 8b469286ec..1eb76aa628 100644 --- a/test/functional/editor/mark_spec.lua +++ b/test/functional/editor/mark_spec.lua @@ -279,6 +279,27 @@ describe('named marks', function() -- should still be folded eq(2, funcs.foldclosed('.')) end) + + it("getting '{ '} '( ') does not move cursor", function() + meths.buf_set_lines(0, 0, 0, true, {'aaaaa', 'bbbbb', 'ccccc', 'ddddd', 'eeeee'}) + meths.win_set_cursor(0, {2, 0}) + funcs.getpos("'{") + eq({2, 0}, meths.win_get_cursor(0)) + funcs.getpos("'}") + eq({2, 0}, meths.win_get_cursor(0)) + funcs.getpos("'(") + eq({2, 0}, meths.win_get_cursor(0)) + funcs.getpos("')") + eq({2, 0}, meths.win_get_cursor(0)) + end) + + it('in command range does not move cursor #19248', function() + meths.create_user_command('Test', ':', {range = true}) + meths.buf_set_lines(0, 0, 0, true, {'aaaaa', 'bbbbb', 'ccccc', 'ddddd', 'eeeee'}) + meths.win_set_cursor(0, {2, 0}) + command([['{,'}Test]]) + eq({2, 0}, meths.win_get_cursor(0)) + end) end) describe('named marks view', function() -- cgit