]> granicus.if.org Git - vim/commitdiff
patch 8.2.1362: last entry of ":set term=xxx" overwritten by error message v8.2.1362
authorBram Moolenaar <Bram@vim.org>
Tue, 4 Aug 2020 18:17:31 +0000 (20:17 +0200)
committerBram Moolenaar <Bram@vim.org>
Tue, 4 Aug 2020 18:17:31 +0000 (20:17 +0200)
Problem:    Last entry of ":set term=xxx" overwritten by error message when
            'cmdheight' is two or more. (Tony Mechelynck)
Solution:   Output extra line breaks.

src/term.c
src/testdir/test_termcodes.vim
src/version.c

index 3c0ca779b490435a4b98a450ad5e4552bd2a0eaa..3648df6d5060cbb3cd4cf16ba0005e9e030d902f 100644 (file)
@@ -1763,6 +1763,7 @@ get_term_entries(int *height, int *width)
 report_term_error(char *error_msg, char_u *term)
 {
     struct builtin_term *termp;
+    int                        i;
 
     mch_errmsg("\r\n");
     if (error_msg != NULL)
@@ -1787,6 +1788,10 @@ report_term_error(char *error_msg, char_u *term)
            mch_errmsg("\r\n");
        }
     }
+    // Output extra 'cmdheight' line breaks to avoid that the following error
+    // message overwrites the last terminal name.
+    for (i = 1; i < p_ch; ++i)
+       mch_errmsg("\r\n");
 }
 
     static void
index 30123148f6fd673cbc08dc400fe37dfd4b5f4d6c..da2f066ac73965ca22705d09740eb86bd8812dee 100644 (file)
@@ -7,6 +7,7 @@ CheckUnix
 
 source shared.vim
 source mouse.vim
+source view_util.vim
 
 func Test_term_mouse_left_click()
   new
@@ -1893,6 +1894,17 @@ func Test_get_termcode()
   set ttybuiltin
 endfunc
 
+func Test_list_builtin_terminals()
+  let buf = RunVimInTerminal('', #{rows: 14})
+  call term_sendkeys(buf, ":set cmdheight=3\<CR>")
+  call term_wait(buf, 100)
+  call term_sendkeys(buf, ":set term=xxx\<CR>")
+  call term_wait(buf, 100)
+  call assert_match('builtin_dumb', term_getline(buf, 11))
+  call assert_match('Not found in termcap', term_getline(buf, 12))
+  call StopVimInTerminal(buf)
+endfunc
+
 func GetEscCodeCSI27(key, modifier)
   let key = printf("%d", char2nr(a:key))
   let mod = printf("%d", a:modifier)
index cb54f8cdb3a58e79b4632e6884407d7085e4bf21..251a59431cb56c2b06f28ab2c3e4a0875867b8eb 100644 (file)
@@ -754,6 +754,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1362,
 /**/
     1361,
 /**/