[vim/vim] highlight: wrong column highlighted with 'cursorcolumn' (PR #20902)

h_east (Vim Github Repository) <[email protected]> Fri, 31 Jul 2026 14:08:05 -0700
Newsgroups gmane.editors.vim.devel
Message-ID <vim/vim/pull/[email protected]>
```
Problem:  With 'virtualedit' set to "all" and 'cursorcolumn' set, the wrong
          column may be highlighted after a command that moved the cursor
          into virtual space and back.
Solution: Make sure the virtual column is up to date before drawing the
          window.
```

fixes: #2576

---

    set virtualedit=all
    set cursorcolumn
    call setline(1, ['', '', ''])
    call cursor(3, 1)

Pressing \<Del> highlights the second column while the cursor is in the
first one.

"x" is translated to "dl", and with 'virtualedit' the "l" succeeds on an
empty line, so coladvance() sets w_virtcol for the virtual position.  When
the operator puts the cursor back, do_pending_operator() resets
VALID_VIRTCOL, but the old value stays in w_virtcol and nothing computes it
again: only the ruler validates it, in win_redr_ruler().

This was in todo.txt, the entry is removed.
You can view, comment on, or merge this pull request online at:

  https://github.com/vim/vim/pull/20902

-- Commit Summary --

  * highlight: wrong column highlighted with 'cursorcolumn'

-- File Changes --

    M runtime/doc/todo.txt (3)
    M src/drawscreen.c (6)
    A src/testdir/dumps/Test_cursorcolumn_virtualedit_1.dump (8)
    M src/testdir/test_highlight.vim (24)

-- Patch Links --

https://github.com/vim/vim/pull/20902.patch
https://github.com/vim/vim/pull/20902.diff

-- 
Reply to this email directly or view it on GitHub:
https://github.com/vim/vim/pull/20902
You are receiving this because you are subscribed to this thread.

Message ID: <vim/vim/pull/[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/pull/20902%40github.com.