diff options
| author | zeertzjq <zeertzjq@outlook.com> | 2026-04-15 18:22:05 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-04-15 18:22:05 +0800 |
| commit | 202e17deef9f7bf37d8c519f77edb7bf430eeb23 (patch) | |
| tree | c716cf57a366f9fcba52ad2032340b9ee82ff912 /src | |
| parent | 92317013b4ad9e108183d165f34427111ec171da (diff) | |
vim-patch:9.2.0346: Wrong cursor position when entering command line window (#39072)
Problem: Wrong cursor position when entering command line window
Solution: Add check_cursor() command to verify the cursor position
(Hirohito Higashi).
When opening the command-line window with CTRL-F after typing a command
that fills the screen width, the cursor was placed past the end of the
line. Add check_cursor() after setting State to MODE_NORMAL so the
cursor is adjusted to the last character.
Also fix the cmdwin prefix character (e.g. ':') being drawn on wrapped
continuation rows. Draw an empty space instead so that the text
alignment is preserved.
closes: vim/vim#19964
https://github.com/vim/vim/commit/c4fe1e958a2051d443abe072c8a5366a887da9b3
Cherry-pick Test_wildmenu_pum() changes from patch 9.1.1995.
Co-authored-by: Hirohito Higashi <h.east.727@gmail.com>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Diffstat (limited to 'src')
| -rw-r--r-- | src/nvim/drawline.c | 5 | ||||
| -rw-r--r-- | src/nvim/ex_getln.c | 1 |
2 files changed, 5 insertions, 1 deletions
diff --git a/src/nvim/drawline.c b/src/nvim/drawline.c index d2f9f17cc0..995422276b 100644 --- a/src/nvim/drawline.c +++ b/src/nvim/drawline.c @@ -1700,7 +1700,10 @@ int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, int col_rows, b if (wp == cmdwin_win) { // Draw the cmdline character. - draw_col_fill(&wlv, schar_from_ascii(cmdwin_type), 1, win_hl_attr(wp, HLF_AT)); + draw_col_fill(&wlv, + schar_from_ascii(wlv.row == wlv.startrow ? cmdwin_type : ' '), + 1, + wlv.row == wlv.startrow ? win_hl_attr(wp, HLF_AT) : 0); } if (wlv.filler_todo > 0) { diff --git a/src/nvim/ex_getln.c b/src/nvim/ex_getln.c index 52873ed52b..2278ba2494 100644 --- a/src/nvim/ex_getln.c +++ b/src/nvim/ex_getln.c @@ -4688,6 +4688,7 @@ static int open_cmdwin(void) exmode_active = false; State = MODE_NORMAL; + check_cursor(curwin); setmouse(); clear_showcmd(); |
