mirror of
https://github.com/vim/vim.git
synced 2025-09-27 04:14:06 -04:00
patch 8.0.1714: term_setsize() does not give an error in a normal buffer
Problem: Term_setsize() does not give an error in a normal buffer. Solution: Add an error message.
This commit is contained in:
@@ -4629,7 +4629,12 @@ f_term_setsize(typval_T *argvars UNUSED, typval_T *rettv UNUSED)
|
||||
term_T *term;
|
||||
varnumber_T rows, cols;
|
||||
|
||||
if (buf == NULL || buf->b_term->tl_vterm == NULL)
|
||||
if (buf == NULL)
|
||||
{
|
||||
EMSG(_("E955: Not a terminal buffer"));
|
||||
return;
|
||||
}
|
||||
if (buf->b_term->tl_vterm == NULL)
|
||||
return;
|
||||
term = buf->b_term;
|
||||
rows = get_tv_number(&argvars[1]);
|
||||
|
@@ -271,6 +271,27 @@ func Test_terminal_scroll()
|
||||
call delete('Xtext')
|
||||
endfunc
|
||||
|
||||
func Test_terminal_scrollback()
|
||||
let buf = Run_shell_in_terminal({})
|
||||
set terminalscroll=100
|
||||
call writefile(range(150), 'Xtext')
|
||||
if has('win32')
|
||||
call term_sendkeys(buf, "type Xtext\<CR>")
|
||||
else
|
||||
call term_sendkeys(buf, "cat Xtext\<CR>")
|
||||
endif
|
||||
let rows = term_getsize(buf)[0]
|
||||
call WaitFor({-> term_getline(buf, rows - 1) =~ '149'})
|
||||
let lines = line('$')
|
||||
call assert_true(lines <= 100)
|
||||
call assert_true(lines > 90)
|
||||
|
||||
call Stop_shell_in_terminal(buf)
|
||||
call term_wait(buf)
|
||||
exe buf . 'bwipe'
|
||||
set terminalscroll&
|
||||
endfunc
|
||||
|
||||
func Test_terminal_size()
|
||||
let cmd = Get_cat_123_cmd()
|
||||
|
||||
@@ -298,6 +319,7 @@ func Test_terminal_size()
|
||||
call assert_equal([7, 30], term_getsize(''))
|
||||
|
||||
bwipe!
|
||||
call assert_fails("call term_setsize('', 7, 30)", "E955:")
|
||||
|
||||
call term_start(cmd, {'term_rows': 6, 'term_cols': 36})
|
||||
let size = term_getsize('')
|
||||
|
@@ -762,6 +762,8 @@ static char *(features[]) =
|
||||
|
||||
static int included_patches[] =
|
||||
{ /* Add new patch number below this line */
|
||||
/**/
|
||||
1714,
|
||||
/**/
|
||||
1713,
|
||||
/**/
|
||||
|
Reference in New Issue
Block a user