Skip to content

Commit 5bab555

Browse files
committed
patch 8.0.1705: when making a vertical split the mode message isn't updated
Problem: When making a vertical split the mode message isn't always updated, "VISUAL" remains. (Alexei Averchenko) Solution: Only reset clear_cmdline when filling all columns of the last screen line. (Tom M. closes #2611)
1 parent b8e22a0 commit 5bab555

File tree

3 files changed

+28
-1
lines changed

3 files changed

+28
-1
lines changed

src/screen.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8699,7 +8699,8 @@ screen_fill(
86998699
if (row == Rows - 1) /* overwritten the command line */
87008700
{
87018701
redraw_cmdline = TRUE;
8702-
if (c1 == ' ' && c2 == ' ')
8702+
if (start_col == 0 && end_col == Columns
8703+
&& c1 == ' ' && c2 == ' ' && attr == 0)
87038704
clear_cmdline = FALSE; /* command line has been cleared */
87048705
if (start_col == 0)
87058706
mode_displayed = FALSE; /* mode cleared or overwritten */

src/testdir/test_window_cmd.vim

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -483,4 +483,28 @@ func Test_access_freed_mem()
483483
bwipe xxx
484484
endfunc
485485

486+
func Test_visual_cleared_after_window_split()
487+
new | only!
488+
let smd_save = &showmode
489+
set showmode
490+
let ls_save = &laststatus
491+
set laststatus=1
492+
call setline(1, ['a', 'b', 'c', 'd', ''])
493+
norm! G
494+
exe "norm! kkvk"
495+
redraw
496+
exe "norm! \<C-W>v"
497+
redraw
498+
" check if '-- VISUAL --' disappeared from command line
499+
let columns = range(1, &columns)
500+
let cmdlinechars = map(columns, 'nr2char(screenchar(&lines, v:val))')
501+
let cmdline = join(cmdlinechars, '')
502+
let cmdline_ltrim = substitute(cmdline, '^\s*', "", "")
503+
let mode_shown = substitute(cmdline_ltrim, '\s*$', "", "")
504+
call assert_equal('', mode_shown)
505+
let &showmode = smd_save
506+
let &laststatus = ls_save
507+
bwipe!
508+
endfunc
509+
486510
" vim: shiftwidth=2 sts=2 expandtab

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -762,6 +762,8 @@ static char *(features[]) =
762762

763763
static int included_patches[] =
764764
{ /* Add new patch number below this line */
765+
/**/
766+
1705,
765767
/**/
766768
1704,
767769
/**/

0 commit comments

Comments
 (0)