Skip to content

Commit ecd34bf

Browse files
committed
patch 8.2.1362: last entry of ":set term=xxx" overwritten by error message
Problem: Last entry of ":set term=xxx" overwritten by error message when 'cmdheight' is two or more. (Tony Mechelynck) Solution: Output extra line breaks.
1 parent 6a25026 commit ecd34bf

3 files changed

Lines changed: 19 additions & 0 deletions

File tree

src/term.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1763,6 +1763,7 @@ get_term_entries(int *height, int *width)
17631763
report_term_error(char *error_msg, char_u *term)
17641764
{
17651765
struct builtin_term *termp;
1766+
int i;
17661767

17671768
mch_errmsg("\r\n");
17681769
if (error_msg != NULL)
@@ -1787,6 +1788,10 @@ report_term_error(char *error_msg, char_u *term)
17871788
mch_errmsg("\r\n");
17881789
}
17891790
}
1791+
// Output extra 'cmdheight' line breaks to avoid that the following error
1792+
// message overwrites the last terminal name.
1793+
for (i = 1; i < p_ch; ++i)
1794+
mch_errmsg("\r\n");
17901795
}
17911796

17921797
static void

src/testdir/test_termcodes.vim

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ CheckUnix
77

88
source shared.vim
99
source mouse.vim
10+
source view_util.vim
1011

1112
func Test_term_mouse_left_click()
1213
new
@@ -1893,6 +1894,17 @@ func Test_get_termcode()
18931894
set ttybuiltin
18941895
endfunc
18951896

1897+
func Test_list_builtin_terminals()
1898+
let buf = RunVimInTerminal('', #{rows: 14})
1899+
call term_sendkeys(buf, ":set cmdheight=3\<CR>")
1900+
call term_wait(buf, 100)
1901+
call term_sendkeys(buf, ":set term=xxx\<CR>")
1902+
call term_wait(buf, 100)
1903+
call assert_match('builtin_dumb', term_getline(buf, 11))
1904+
call assert_match('Not found in termcap', term_getline(buf, 12))
1905+
call StopVimInTerminal(buf)
1906+
endfunc
1907+
18961908
func GetEscCodeCSI27(key, modifier)
18971909
let key = printf("%d", char2nr(a:key))
18981910
let mod = printf("%d", a:modifier)

src/version.c

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

755755
static int included_patches[] =
756756
{ /* Add new patch number below this line */
757+
/**/
758+
1362,
757759
/**/
758760
1361,
759761
/**/

0 commit comments

Comments
 (0)