[vim/vim] scroll: window scrolls when using the autocommand window (PR #20884)
h_east (Vim Github Repository) <[email protected]> Thu, 30 Jul 2026 10:44:21 -0700
| Newsgroups | gmane.editors.vim.devel |
|---|---|
| Message-ID | <vim/vim/pull/[email protected]> |
```
Problem: The window scrolls when an autocommand window is used while the
cursor is behind multi-byte characters.
Solution: Use the byte column instead of the character count when computing
how many screen lines the text up to the cursor takes.
```
fixes: #12085
---
To reproduce, on a 24 x 80 screen:
call setline(1, repeat([repeat(nr2char(0x3042), 200)], 20))
normal! G0100l
echo line('w0')
call bufload(bufadd(''))
echo line('w0')
The topline moves down while the cursor stays where it is. bufload() is
only used to make Vim use the autocommand window.
plines_win_col() is passed a byte column but consumed one character per
iteration, so with multi-byte characters before the cursor it reported one
screen line too many. Its only caller is scroll_to_fraction().
The todo.txt entry is kept for the part that is not fixed: the snapshot
restore still resets w_skipcol in a long wrapped line.
You can view, comment on, or merge this pull request online at:
https://github.com/vim/vim/pull/20884
-- Commit Summary --
* scroll: window scrolls when using the autocommand window
-- File Changes --
M runtime/doc/todo.txt (8)
M src/misc1.c (5)
M src/testdir/test_window_cmd.vim (18)
-- Patch Links --
https://github.com/vim/vim/pull/20884.patch
https://github.com/vim/vim/pull/20884.diff
--
Reply to this email directly or view it on GitHub:
https://github.com/vim/vim/pull/20884
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/20884%40github.com.