After a bit of digging around we managed to confirm that it is, indeed, a bug
in vim. It can be replicated with `vim +"source [filename]"` using the
following two tests:
1. [OK] The following test produces the expected result: substitution change is
joined to the previous change in the buffer (addition of line 3). Upon undo,
the cursor position is correctly restored to the second line in the buffer.
set undolevels=10
normal ggiline one is bull of aaaa
set undolevels=10 " used to break a change into separate undo blocks
normal Goline two is full of bbbb
set undolevels=10 " used to break a change into separate undo blocks
normal Goline three is full of cccc
set undolevels=10 " used to break a change into separate undo blocks
undojoin
keepjumps %s/aaaa/zzzz/
normal u
2. [ERR] The following test produces an unexpected result: substitution change
is joined to the previous change in the buffer (addition of line 4). Upon undo,
the cursor position is incorrectly restored to the first line in the buffer.
set undolevels=10
normal ggiline one is bull of aaaa
set undolevels=10 " used to break a change into separate undo blocks
normal Goline two is full of bbbb
set undolevels=10 " used to break a change into separate undo blocks
normal Goline three is full of cccc
set undolevels=10 " used to break a change into separate undo blocks
normal Goline four is full of aaaa's again
set undolevels=10 " used to break a change into separate undo blocks
undojoin
keepjumps %s/aaaa/zzzz/
normal u
It appears that the bug is originating around line 2711 in undo.c Sorry, can't
be more specific, C is not my strong point, so I'm just summarising what
@doliver found so far.
A full description of what we've found is on StackOverflow:
http://stackoverflow.com/questions/31548025/vim-undo-why-does-the-cursor-jump-to-the-wrong-position-when-undoing-undojoin
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.