You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Run this shell command (you'll need to update the path to the plugin):
vim -Nu NONE -S <(cat <<'EOF'
set rtp^=/path/to/vim-repeat
nno <c-b> xp:call repeat#set("\<lt>c-b>")<cr>
let buf =<< trim END
" fold A {{{1
" some text
" fold B {{{1
" some text
END
%d
pu!=buf
setl fdm=marker
EOF
) /tmp/file
Press zo to open the B fold.
Press C-b to exchange the position of two characters and invoke repeat#set() which causes the wrapper mapping around the undo command to be installed.
The undo command is written in the typeahead via feedkeys() which doesn't execute it immediately. In contrast, zv is executed via :norm which does execute the command immediately. As a result, zv is executed before the undo command, while it should be executed after.
There are several solutions, but I think the simplest one is to just pass zv to feedkeys().
There are several solutions, but I think the simplest one is to just pass zv to feedkeys().
Actually no, the simplest fix would be to use the t flag: #81 (comment)
Edit: t would cause the undo/redo command to be saved twice during a recording which is wrong. So, passing zv to feedkeys() is better.
Edit 2: Yes, but only on the condition that zv is really needed; that is if the cursor is in a closed fold; otherwise, we may prevent u, U, and C-r from printing some info about the undo state, as reported in #27. See this comment for more details.
Describe the bug
The undo command may open the wrong fold.
To Reproduce
Run this shell command (you'll need to update the path to the plugin):
zo
to open the B fold.C-b
to exchange the position of two characters and invokerepeat#set()
which causes the wrapper mapping around the undo command to be installed.zc
to close the B fold.k
to move on the A fold.u
to undo the last change.Result: The A fold is opened.
Expected behavior
The B fold is opened.
Screenshots
Environment
Additional context
The issue is due to the
zv
command being executed too early:vim-repeat/autoload/repeat.vim
Line 135 in c947ad2
The undo command is written in the typeahead via
feedkeys()
which doesn't execute it immediately. In contrast,zv
is executed via:norm
which does execute the command immediately. As a result,zv
is executed before the undo command, while it should be executed after.There are several solutions, but I think the simplest one is to just pass
zv
tofeedkeys()
.It's a regression introduced by 1b82cad.
The text was updated successfully, but these errors were encountered: