changeset 16477:8cc31b1b1d23 v8.1.1242

patch 8.1.1242: no cmdline redraw when tabpages have different 'cmdheight' commit https://github.com/vim/vim/commit/0fef0aeb1ca6c85df0a656a70b6ca49c34563c89 Author: Bram Moolenaar <Bram@vim.org> Date: Wed May 1 20:30:40 2019 +0200 patch 8.1.1242: no cmdline redraw when tabpages have different 'cmdheight' Problem: No cmdline redraw when tabpages have different 'cmdheight'. Solution: redraw the command line when 'cmdheight' changes when switching tabpages. (closes #4321)
author Bram Moolenaar <Bram@vim.org>
date Wed, 01 May 2019 20:45:05 +0200
parents 9f2336fa44b9
children c218d6ba7fac
files src/testdir/dumps/Test_tabpage_cmdheight.dump src/testdir/screendump.vim src/testdir/test_tabpage.vim src/version.c src/window.c
diffstat 5 files changed, 51 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
new file mode 100644
--- /dev/null
+++ b/src/testdir/dumps/Test_tabpage_cmdheight.dump
@@ -0,0 +1,20 @@
+| +8#0000001#e0e0e08|[|N|o| |N|a|m|e|]| | +2#0000000#ffffff0|[|N|o| |N|a|m|e|]| | +1&&@51|X+8#0000001#e0e0e08
+> +0#0000000#ffffff0@74
+|~+0#4040ff13&| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|[+3#0000000&|N|o| |N|a|m|e|]| @47|0|,|0|-|1| @9|A|l@1
+| +0&&@74
+@75
+@75
--- a/src/testdir/screendump.vim
+++ b/src/testdir/screendump.vim
@@ -26,6 +26,7 @@ source shared.vim
 " Options is a dictionary, these items are recognized:
 " "rows" - height of the terminal window (max. 20)
 " "cols" - width of the terminal window (max. 78)
+" "statusoff" - number of lines the status is offset from default
 func RunVimInTerminal(arguments, options)
   " If Vim doesn't exit a swap file remains, causing other tests to fail.
   " Remove it here.
@@ -51,6 +52,7 @@ func RunVimInTerminal(arguments, options
   " Make the window 20 lines high and 75 columns, unless told otherwise.
   let rows = get(a:options, 'rows', 20)
   let cols = get(a:options, 'cols', 75)
+  let statusoff = get(a:options, 'statusoff', 1)
 
   let cmd = GetVimCommandClean()
 
@@ -77,7 +79,7 @@ func RunVimInTerminal(arguments, options
   " using valgrind).
   " If it fails then show the terminal contents for debugging.
   try
-    call WaitFor({-> len(term_getline(buf, rows)) >= cols - 1 || len(term_getline(buf, rows - 1)) >= cols - 1})
+    call WaitFor({-> len(term_getline(buf, rows)) >= cols - 1 || len(term_getline(buf, rows - statusoff)) >= cols - 1})
   catch /timed out after/
     let lines = map(range(1, rows), {key, val -> term_getline(buf, val)})
     call assert_report('RunVimInTerminal() failed, screen contents: ' . join(lines, "<NL>"))
--- a/src/testdir/test_tabpage.vim
+++ b/src/testdir/test_tabpage.vim
@@ -1,5 +1,6 @@
 " Tests for tabpage
 
+source screendump.vim
 
 function Test_tabpage()
   bw!
@@ -552,4 +553,27 @@ func Test_tabs()
   bw!
 endfunc
 
+func Test_tabpage_cmdheight()
+  if !CanRunVimInTerminal()
+    throw 'Skipped: only works with terminal'
+  endif
+  call writefile([
+        \ 'set laststatus=2',
+        \ 'set cmdheight=2',
+        \ 'tabnew',
+        \ 'set cmdheight=3',
+        \ 'tabnext',
+        \ 'redraw!',
+        \ 'echo "hello\nthere"',
+        \ 'tabnext',
+        \ 'redraw',
+	\ ], 'XTest_tabpage_cmdheight')
+  " Check that cursor line is concealed
+  let buf = RunVimInTerminal('-S XTest_tabpage_cmdheight', {'statusoff': 3})
+  call VerifyScreenDump(buf, 'Test_tabpage_cmdheight', {})
+
+  call StopVimInTerminal(buf)
+  call delete('XTest_conceal')
+endfunc
+
 " vim: shiftwidth=2 sts=2 expandtab
--- a/src/version.c
+++ b/src/version.c
@@ -768,6 +768,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    1242,
+/**/
     1241,
 /**/
     1240,
--- a/src/window.c
+++ b/src/window.c
@@ -3955,6 +3955,8 @@ enter_tabpage(
      * the frames for that.  When the Vim window was resized need to update
      * frame sizes too.  Use the stored value of p_ch, so that it can be
      * different for each tab page. */
+    if (p_ch != curtab->tp_ch_used)
+	clear_cmdline = TRUE;
     p_ch = curtab->tp_ch_used;
     if (curtab->tp_old_Rows != Rows || (old_off != firstwin->w_winrow
 #ifdef FEAT_GUI_TABLINE