Permalink
Browse files

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.
  • Loading branch information...
brammool committed Apr 14, 2018
1 parent b3623a3 commit 6e72cd0d7267b9545ef966a53e62706914a96042
Showing with 30 additions and 1 deletion.
  1. +6 −1 src/terminal.c
  2. +22 −0 src/testdir/test_terminal.vim
  3. +2 −0 src/version.c
@@ -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,
/**/

0 comments on commit 6e72cd0

Please sign in to comment.