[vim/vim] cursorbind not resynchronized after undo changes diff correspondence (Issue #20982)
Narendran Gopalakrishnan (Vim Github Repository) <[email protected]> Sun, 09 Aug 2026 03:18:16 -0700
| Newsgroups | gmane.editors.vim.devel |
|---|---|
| Message-ID | <vim/vim/issues/[email protected]> |
gnarendran created an issue (vim/vim#20982)
### Steps to reproduce
With `'cursorbind'` enabled in diff mode, undoing a change can leave the cursor in the other diff window at a stale, non-corresponding position.
This is particularly notable because `:help diffupdate` says that differences are kept updated after text changes and that `:diffupdate` can be used to update them. However, `:diffupdate` does not correct the stale cursor position.
[temp2.txt](https://github.com/user-attachments/files/30870669/temp2.txt)
[temp1.txt](https://github.com/user-attachments/files/30870668/temp1.txt)
`temp1.txt`:
```text
C11
C12
C31
C32
```
`temp2.txt`:
```text
C21
C22
A21
A22
C41
C42
```
Start:
```text
vim -u NONE -d "+set diffopt+=linematch:60" -d temp1.txt temp2.txt
```
At each stage, this command shows the line under the cursor in both windows:
```vim
echo printf("temp1.txt(%s) Vs temp2.txt(%s)", getline("."), trim(win_execute(win_getid(2), 'echo getline(".")')))
```
Initially:
```text
temp1.txt(C11) Vs temp2.txt(C21)
```
Execute `2dd` in the first window:
```text
temp1.txt(C31) Vs temp2.txt(C21)
```
This is valid: the deleted lines are represented by filler.
Execute `jk` in the first window:
```text
temp1.txt(C32) Vs temp2.txt(C41)
```
`cursorbind` has correctly moved the second cursor to the corresponding position.
Now execute `u` in the first window:
```text
temp1.txt(C11) Vs temp2.txt(C41)
```
This is *incorrect*: `C11` and `C41` do not correspond. The first cursor has moved because undo restored the deleted lines, but the cursor in the other diff window has not been resynchronized.
Executing `:diffupdate` does not correct the cursor. Moving the cursor vertically again causes `cursorbind` to resynchronize it.
Reproduced in both Vim and Neovim nightly.
### Expected behaviour
After undo changes the diff correspondence and moves the cursor to `C11`, and after the recommended :diffupdate, `cursorbind` should update the cursor in the other diff window to the corresponding position.
### Version of Vim
Vim 9.2.390
### Environment
Fedora 44
xterm
xterm-256color
bash
### Logs and stack traces
```shell
```
--
Reply to this email directly or view it on GitHub:
https://github.com/vim/vim/issues/20982
You are receiving this because you are subscribed to this thread.
Message ID: <vim/vim/issues/[email protected]>
--
--
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].
To view this discussion visit https://groups.google.com/d/msgid/vim_dev/vim/vim/issues/20982%40github.com.