diff options
author | Bram Moolenaar <Bram@vim.org> | 2022-09-18 15:08:19 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2022-09-18 15:08:19 +0100 |
commit | b2f0ca820eae50994745106d824e215d87bd7926 (patch) | |
tree | 9fa5e1872f7138b1794aef6ffd85209874d125b8 /src/ex_getln.c | |
parent | 566badc76ba7c0fbdc75e62f79486182304fc7cc (diff) |
patch 9.0.0500: when quitting cmdline window with CTRL-C it remains visiblev9.0.0500
Problem: When quitting the cmdline window with CTRL-C it remains visible.
Solution: Redraw to avoid confusion. Adjust the error message.
(closes #11152) Adjust the cursor position after CTRL-C.
Diffstat (limited to 'src/ex_getln.c')
-rw-r--r-- | src/ex_getln.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/src/ex_getln.c b/src/ex_getln.c index a4fb61145c..02205814d9 100644 --- a/src/ex_getln.c +++ b/src/ex_getln.c @@ -4631,13 +4631,11 @@ open_cmdwin(void) ccline.cmdlen = (int)STRLEN(ccline.cmdbuff); ccline.cmdbufflen = ccline.cmdlen + 1; ccline.cmdpos = curwin->w_cursor.col; - if (ccline.cmdpos > ccline.cmdlen) + // If the cursor is on the last character, it probably should be + // after it. + if (ccline.cmdpos == ccline.cmdlen - 1 + || ccline.cmdpos > ccline.cmdlen) ccline.cmdpos = ccline.cmdlen; - if (cmdwin_result == K_IGNORE) - { - set_cmdspos_cursor(); - redrawcmd(); - } } # ifdef FEAT_CONCEAL @@ -4664,6 +4662,15 @@ open_cmdwin(void) // Restore window sizes. win_size_restore(&winsizes); skip_win_fix_cursor = FALSE; + + if (cmdwin_result == K_IGNORE) + { + // It can be confusing that the cmdwin still shows, redraw the + // screen. + update_screen(UPD_VALID); + set_cmdspos_cursor(); + redrawcmd(); + } } ga_clear(&winsizes); |