]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 8.0.1705: when making a vertical split the mode message isn't updated v8.0.1705
authorBram Moolenaar <Bram@vim.org>
Fri, 13 Apr 2018 18:41:29 +0000 (20:41 +0200)
committerBram Moolenaar <Bram@vim.org>
Fri, 13 Apr 2018 18:41:29 +0000 (20:41 +0200)
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)

src/screen.c
src/testdir/test_window_cmd.vim
src/version.c

index bcfaabed191e4a1bf6083f9c28da2b71a7dda316..d1f17b51bae49be616f6cc915c1b892943e4bc34 100644 (file)
@@ -8699,7 +8699,8 @@ screen_fill(
        if (row == Rows - 1)            /* overwritten the command line */
        {
            redraw_cmdline = TRUE;
-           if (c1 == ' ' && c2 == ' ')
+           if (start_col == 0 && end_col == Columns
+                   && c1 == ' ' && c2 == ' ' && attr == 0)
                clear_cmdline = FALSE;  /* command line has been cleared */
            if (start_col == 0)
                mode_displayed = FALSE; /* mode cleared or overwritten */
index 69b139fe3b194e70b1e7a266014efda2e50b2250..296cba2fd881849a8f52e012741767465375b5b3 100644 (file)
@@ -483,4 +483,28 @@ func Test_access_freed_mem()
   bwipe xxx
 endfunc
 
+func Test_visual_cleared_after_window_split()
+  new | only!
+  let smd_save = &showmode
+  set showmode
+  let ls_save = &laststatus
+  set laststatus=1
+  call setline(1, ['a', 'b', 'c', 'd', ''])
+  norm! G
+  exe "norm! kkvk"
+  redraw
+  exe "norm! \<C-W>v"
+  redraw
+  " check if '-- VISUAL --' disappeared from command line
+  let columns = range(1, &columns)
+  let cmdlinechars = map(columns, 'nr2char(screenchar(&lines, v:val))')
+  let cmdline = join(cmdlinechars, '')
+  let cmdline_ltrim = substitute(cmdline, '^\s*', "", "")
+  let mode_shown = substitute(cmdline_ltrim, '\s*$', "", "")
+  call assert_equal('', mode_shown)
+  let &showmode = smd_save
+  let &laststatus = ls_save
+  bwipe!
+endfunc
+
 " vim: shiftwidth=2 sts=2 expandtab
index 8d7049d5fd852c2855f8d575c2c9bd4277414f2d..6c3b38ddb9260fb3d573a53b49424013c607e61e 100644 (file)
@@ -762,6 +762,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1705,
 /**/
     1704,
 /**/