1
0
forked from aniani/vim

patch 8.0.1644: terminal API tests still fail

Problem:    Terminal API tests still fail.
Solution:   Explicitly set 'title' in the terminal job. (Ozaki Kiichi,
            closes #2750)
This commit is contained in:
Bram Moolenaar
2018-03-25 20:31:32 +02:00
parent 2de50f8762
commit cf67a509e9
3 changed files with 13 additions and 14 deletions

View File

@@ -24,7 +24,9 @@ source shared.vim
" By default uses a size of 20 lines and 75 columns. " By default uses a size of 20 lines and 75 columns.
" Returns the buffer number of the terminal. " Returns the buffer number of the terminal.
" "
" Options is a dictionary (not used yet). " Options is a dictionary, these items are recognized:
" "rows" - height of the terminal window (max. 20)
" "cols" - width of the terminal window (max. 78)
func RunVimInTerminal(arguments, options) func RunVimInTerminal(arguments, options)
" If Vim doesn't exit a swap file remains, causing other tests to fail. " If Vim doesn't exit a swap file remains, causing other tests to fail.
" Remove it here. " Remove it here.
@@ -47,17 +49,15 @@ func RunVimInTerminal(arguments, options)
set t_Co=256 background=light set t_Co=256 background=light
hi Normal ctermfg=NONE ctermbg=NONE hi Normal ctermfg=NONE ctermbg=NONE
" Make the window 20 lines high, unless told otherwise. " Make the window 20 lines high and 75 columns, unless told otherwise.
let rows = 20 let rows = get(a:options, 'rows', 20)
if has_key(a:options, 'rows') let cols = get(a:options, 'cols', 75)
let rows = a:options['rows']
endif
let cmd = GetVimCommandClean() let cmd = GetVimCommandClean()
" Add -v to have gvim run in the terminal (if possible) " Add -v to have gvim run in the terminal (if possible)
let cmd .= ' -v ' . a:arguments let cmd .= ' -v ' . a:arguments
let buf = term_start(cmd, {'curwin': 1, 'term_rows': rows, 'term_cols': 75}) let buf = term_start(cmd, {'curwin': 1, 'term_rows': rows, 'term_cols': cols})
call assert_equal([rows, 75], term_getsize(buf)) call assert_equal([rows, cols], term_getsize(buf))
return buf return buf
endfunc endfunc

View File

@@ -1029,10 +1029,10 @@ func Test_terminal_api_drop_newwin()
return return
endif endif
call assert_equal(1, winnr('$')) call assert_equal(1, winnr('$'))
set title
" Use the title termcap entries to output the escape sequence. " Use the title termcap entries to output the escape sequence.
call writefile([ call writefile([
\ 'set title',
\ 'exe "set t_ts=\<Esc>]51; t_fs=\x07"', \ 'exe "set t_ts=\<Esc>]51; t_fs=\x07"',
\ 'let &titlestring = ''["drop","Xtextfile"]''', \ 'let &titlestring = ''["drop","Xtextfile"]''',
\ 'redraw', \ 'redraw',
@@ -1046,7 +1046,6 @@ func Test_terminal_api_drop_newwin()
call StopVimInTerminal(buf) call StopVimInTerminal(buf)
call delete('Xscript') call delete('Xscript')
bwipe Xtextfile bwipe Xtextfile
set title&
endfunc endfunc
func Test_terminal_api_drop_oldwin() func Test_terminal_api_drop_oldwin()
@@ -1058,10 +1057,10 @@ func Test_terminal_api_drop_oldwin()
let textfile_winid = win_getid() let textfile_winid = win_getid()
call assert_equal(2, winnr('$')) call assert_equal(2, winnr('$'))
call win_gotoid(firstwinid) call win_gotoid(firstwinid)
set title
" Use the title termcap entries to output the escape sequence. " Use the title termcap entries to output the escape sequence.
call writefile([ call writefile([
\ 'set title',
\ 'exe "set t_ts=\<Esc>]51; t_fs=\x07"', \ 'exe "set t_ts=\<Esc>]51; t_fs=\x07"',
\ 'let &titlestring = ''["drop","Xtextfile"]''', \ 'let &titlestring = ''["drop","Xtextfile"]''',
\ 'redraw', \ 'redraw',
@@ -1074,7 +1073,6 @@ func Test_terminal_api_drop_oldwin()
call StopVimInTerminal(buf) call StopVimInTerminal(buf)
call delete('Xscript') call delete('Xscript')
bwipe Xtextfile bwipe Xtextfile
set title&
endfunc endfunc
func TryThis(bufnum, arg) func TryThis(bufnum, arg)
@@ -1086,10 +1084,10 @@ func Test_terminal_api_call()
if !CanRunVimInTerminal() if !CanRunVimInTerminal()
return return
endif endif
set title
" Use the title termcap entries to output the escape sequence. " Use the title termcap entries to output the escape sequence.
call writefile([ call writefile([
\ 'set title',
\ 'exe "set t_ts=\<Esc>]51; t_fs=\x07"', \ 'exe "set t_ts=\<Esc>]51; t_fs=\x07"',
\ 'let &titlestring = ''["call","TryThis",["hello",123]]''', \ 'let &titlestring = ''["call","TryThis",["hello",123]]''',
\ 'redraw', \ 'redraw',
@@ -1104,5 +1102,4 @@ func Test_terminal_api_call()
call delete('Xscript') call delete('Xscript')
unlet g:called_bufnum unlet g:called_bufnum
unlet g:called_arg unlet g:called_arg
set title&
endfunc endfunc

View File

@@ -766,6 +766,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
1644,
/**/ /**/
1643, 1643,
/**/ /**/