diff options
author | zeertzjq <zeertzjq@outlook.com> | 2022-11-01 06:14:20 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-01 06:14:20 +0800 |
commit | 428ab6f24e6b5bae60a71138d571d57ac18528d5 (patch) | |
tree | 57a300d62af1218994f5805dbd067043c3c79dd9 | |
parent | bf3cbee630eec82d95520cd3e9688ef1732c298e (diff) | |
download | rneovim-428ab6f24e6b5bae60a71138d571d57ac18528d5.tar.gz rneovim-428ab6f24e6b5bae60a71138d571d57ac18528d5.tar.bz2 rneovim-428ab6f24e6b5bae60a71138d571d57ac18528d5.zip |
fix(mark): do not restore view in op-pending mode (#20889)
-rw-r--r-- | src/nvim/normal.c | 4 | ||||
-rw-r--r-- | test/functional/editor/mark_spec.lua | 14 |
2 files changed, 17 insertions, 1 deletions
diff --git a/src/nvim/normal.c b/src/nvim/normal.c index 3c49948b55..a83111136d 100644 --- a/src/nvim/normal.c +++ b/src/nvim/normal.c @@ -5697,6 +5697,10 @@ static void nv_gomark(cmdarg_T *cap) { int name; MarkMove flags = jop_flags & JOP_VIEW ? kMarkSetView : 0; // flags for moving to the mark + if (cap->oap->op_type != OP_NOP) { + // When there is a pending operator, do not restore the view as this is usually unexpected. + flags = 0; + } MarkMoveRes move_res = 0; // Result from moving to the mark const bool old_KeyTyped = KeyTyped; // getting file may reset it diff --git a/test/functional/editor/mark_spec.lua b/test/functional/editor/mark_spec.lua index 2440867c6e..f300fea3a0 100644 --- a/test/functional/editor/mark_spec.lua +++ b/test/functional/editor/mark_spec.lua @@ -330,7 +330,7 @@ describe('named marks view', function() os.remove(file2) end) - it('is restored', function() + it('is restored in normal mode but not op-pending mode', function() local screen = Screen.new(5, 8) screen:attach() command("edit " .. file1) @@ -358,6 +358,18 @@ describe('named marks view', function() 8 line | | ]]) + -- not in op-pending mode #20886 + feed("ggj=`a") + screen:expect([[ + 1 line | + ^2 line | + 3 line | + 4 line | + 5 line | + 6 line | + 7 line | + | + ]]) end) it('is restored across files', function() |