Compare commits

...

7 Commits

Author SHA1 Message Date
52dbb5ea7f patch 8.0.1330: MS-Windows: job in terminal can't get back to Vim
Problem:    MS-Windows: job in terminal can't get back to Vim.
Solution:   set VIM_SERVERNAME in the environment. (Yasuhiro Matsumoto, closes
            #2360)
2017-11-21 18:11:27 +01:00
5505860152 patch 8.0.1329: when a flaky test fails it also often fails the second time
Problem:    When a flaky test fails it also often fails the second time.
Solution:   Sleep a couple of seconds before the second try.
2017-11-21 15:14:51 +01:00
ff5467965e patch 8.0.1328: trouble when using ":term ++close" with autocmd
Problem:    Trouble when using ":term ++close" with autocmd. (Gabriel Barta)
Solution:   Use aucmd_prepbuf() and aucmd_restbuf() instead of setting curbuf.
            (closes #2339)
2017-11-21 14:47:57 +01:00
91ffda9852 patch 8.0.1327: new proto file missing from distribution
Problem:    New proto file missing from distribution.
Solution:   Add it. (closes #2355)
2017-11-21 13:52:14 +01:00
6e77df2d85 patch 8.0.1326: largefile test fails on CI, glob test on MS-Windows
Problem:    Largefile test fails on CI, glob test on MS-Windows.
Solution:   Remove largefile test from list of all tests. Don't run
            Test_glob() on non-unix systems.  More cleanup. (Yegappan
            Lakshmanan, closes #2354)
2017-11-21 11:43:08 +01:00
5df95ea9ef patch 8.0.1325: more tests are not run
Problem:    More tests are not run.
Solution:   Add targets to the list of tests. (Yegappan Lakshmanan)
2017-11-20 22:08:10 +01:00
bb160a188a patch 8.0.1324: some xterm sends different mouse move codes
Problem:    Some xterm sends different mouse move codes.
Solution:   Also accept 0x80 as a move event.
2017-11-20 21:52:24 +01:00
12 changed files with 177 additions and 44 deletions

View File

@ -141,6 +141,7 @@ SRC_ALL = \
src/testdir/xterm_ramp.vim \
src/proto.h \
src/proto/arabic.pro \
src/proto/beval.pro \
src/proto/blowfish.pro \
src/proto/buffer.pro \
src/proto/channel.pro \

View File

@ -1,4 +1,4 @@
*terminal.txt* For Vim version 8.0. Last change: 2017 Nov 12
*terminal.txt* For Vim version 8.0. Last change: 2017 Nov 17
VIM REFERENCE MANUAL by Bram Moolenaar
@ -106,6 +106,10 @@ BufWinEnter autocommand event is triggered. This makes it possible to set
options specifically for the window and buffer. Example: >
au BufWinEnter * if &buftype == 'terminal' | setlocal bufhidden=hide | endif
Mouse events (click and drag) are passed to the terminal. Mouse move events
are only passed when Vim itself is receiving them. For a terminal that is
when 'balloonevalterm' is enabled.
Size and color ~
*terminal-size-color*
@ -335,6 +339,9 @@ to point to the right file, if needed. If you have both the 32-bit and 64-bit
version, rename to winpty32.dll and winpty64.dll to match the way Vim was
build.
Environment variables are used to pass information to the running job:
VIM_SERVERNAME v:servername
==============================================================================
2. Remote testing *terminal-testing*

View File

@ -5034,10 +5034,10 @@ job_io_file_open(
* environment argument of vim_create_process().
*/
void
win32_build_env(dict_T *env, garray_T *gap)
win32_build_env(dict_T *env, garray_T *gap, int is_terminal)
{
hashitem_T *hi;
int todo = (int)env->dv_hashtab.ht_used;
long_u todo = env != NULL ? env->dv_hashtab.ht_used : 0;
LPVOID base = GetEnvironmentStringsW();
/* for last \0 */
@ -5062,6 +5062,8 @@ win32_build_env(dict_T *env, garray_T *gap)
*((WCHAR*)gap->ga_data + gap->ga_len++) = L'\0';
}
if (env != NULL)
{
for (hi = env->dv_hashtab.ht_array; todo > 0; ++hi)
{
if (!HASHITEM_EMPTY(hi))
@ -5089,8 +5091,27 @@ win32_build_env(dict_T *env, garray_T *gap)
if (wval != NULL) vim_free(wval);
}
}
}
# ifdef FEAT_CLIENTSERVER
if (is_terminal)
{
char_u *servername = get_vim_var_str(VV_SEND_SERVER);
size_t lval = STRLEN(servername);
size_t n;
if (ga_grow(gap, (int)(14 + lval + 2)) == OK)
{
for (n = 0; n < 15; n++)
*((WCHAR*)gap->ga_data + gap->ga_len++) =
(WCHAR)"VIM_SERVERNAME="[n];
for (n = 0; n < lval; n++)
*((WCHAR*)gap->ga_data + gap->ga_len++) =
(WCHAR)servername[n];
*((WCHAR*)gap->ga_data + gap->ga_len++) = L'\0';
}
}
# endif
}
void
@ -5133,7 +5154,7 @@ mch_job_start(char *cmd, job_T *job, jobopt_T *options)
}
if (options->jo_env != NULL)
win32_build_env(options->jo_env, &ga);
win32_build_env(options->jo_env, &ga, FALSE);
ZeroMemory(&pi, sizeof(pi));
ZeroMemory(&si, sizeof(si));

View File

@ -67,5 +67,5 @@ void used_file_arg(char *name, int literal, int full_path, int diff_mode);
void set_alist_count(void);
void fix_arg_enc(void);
int mch_setenv(char *var, char *value, int x);
void win32_build_env(dict_T *l, garray_T *gap);
void win32_build_env(dict_T *l, garray_T *gap, int is_terminal);
/* vim: set ft=c : */

View File

@ -4980,6 +4980,8 @@ check_termcode(
* add 0x08 for ALT
* add 0x10 for CTRL
* add 0x20 for mouse drag (0x40 is drag with left button)
* add 0x40 for mouse move (0x80 is move, 0x81 too)
* 0x43 (drag + release) is also move
* c == column + ' ' + 1 == column + 33
* r == row + ' ' + 1 == row + 33
*
@ -5121,6 +5123,12 @@ check_termcode(
# endif
)
{
# if defined(UNIX) && defined(FEAT_MOUSE_TTY)
if (use_xterm_mouse() > 1 && mouse_code >= 0x80)
/* mouse-move event, using MOUSE_DRAG works */
mouse_code = MOUSE_DRAG;
else
# endif
/* Keep the mouse_code before it's changed, so that we
* remember that it was a mouse wheel click. */
wheel_code = mouse_code;

View File

@ -51,6 +51,7 @@
* - implement term_setsize()
* - Termdebug does not work when Vim build with mzscheme. gdb hangs.
* - MS-Windows GUI: WinBar has tearoff item
* - Adding WinBar to terminal window doesn't display, text isn't shifted down.
* - MS-Windows GUI: still need to type a key after shell exits? #1924
* - After executing a shell command the status line isn't redraw.
* - What to store in a session file? Shell at the prompt would be OK to
@ -2172,10 +2173,13 @@ term_channel_closed(channel_T *ch)
if (term->tl_finish == 'c')
{
aco_save_T aco;
/* ++close or term_finish == "close" */
ch_log(NULL, "terminal job finished, closing window");
curbuf = term->tl_buffer;
aucmd_prepbuf(&aco, term->tl_buffer);
do_bufdel(DOBUF_WIPE, (char_u *)"", 1, fnum, fnum, FALSE);
aucmd_restbuf(&aco);
break;
}
if (term->tl_finish == 'o' && term->tl_buffer->b_nwindows == 0)
@ -3420,12 +3424,10 @@ term_and_job_init(
return FAIL;
if (opt->jo_cwd != NULL)
cwd_wchar = enc_to_utf16(opt->jo_cwd, NULL);
if (opt->jo_env != NULL)
{
ga_init2(&ga_env, (int)sizeof(char*), 20);
win32_build_env(opt->jo_env, &ga_env);
win32_build_env(opt->jo_env, &ga_env, TRUE);
env_wchar = ga_env.ga_data;
}
job = job_alloc();
if (job == NULL)
@ -3527,7 +3529,6 @@ term_and_job_init(
failed:
if (argvar->v_type == VAR_LIST)
vim_free(ga_cmd.ga_data);
if (opt->jo_env != NULL)
vim_free(ga_env.ga_data);
vim_free(cmd_wchar);
vim_free(cwd_wchar);

View File

@ -67,6 +67,7 @@ SCRIPTS_GUI =
# Tests using runtest.vim
# Keep test_alot*.res as the last one, sort the others.
# test_largefile.res is omitted, it uses too much resources to run on CI.
NEW_TESTS = test_arabic.res \
test_arglist.res \
test_assert.res \
@ -78,11 +79,13 @@ NEW_TESTS = test_arabic.res \
test_cdo.res \
test_channel.res \
test_charsearch.res \
test_charsearch_utf8.res \
test_cindent.res \
test_clientserver.res \
test_close_count.res \
test_cmdline.res \
test_command_count.res \
test_comparators.res \
test_crypt.res \
test_cscope.res \
test_curswant.res \
@ -91,13 +94,18 @@ NEW_TESTS = test_arabic.res \
test_display.res \
test_edit.res \
test_erasebackword.res \
test_escaped_glob.res \
test_exec_while_if.res \
test_exists.res \
test_exists_autocmd.res \
test_expr_utf8.res \
test_farsi.res \
test_file_size.res \
test_find_complete.res \
test_fixeol.res \
test_fnameescape.res \
test_fold.res \
test_getcwd.res \
test_getvar.res \
test_gf.res \
test_gn.res \
@ -124,8 +132,10 @@ NEW_TESTS = test_arabic.res \
test_lua.res \
test_makeencoding.res \
test_man.res \
test_maparg.res \
test_marks.res \
test_matchadd_conceal.res \
test_matchadd_conceal_utf8.res \
test_mksession.res \
test_mksession_utf8.res \
test_nested_function.res \
@ -136,6 +146,7 @@ NEW_TESTS = test_arabic.res \
test_packadd.res \
test_paste.res \
test_perl.res \
test_plus_arg_edit.res \
test_preview.res \
test_profile.res \
test_python2.res \
@ -144,13 +155,17 @@ NEW_TESTS = test_arabic.res \
test_pyx3.res \
test_quickfix.res \
test_quotestar.res \
test_retab.res \
test_regex_char_classes.res \
test_regexp_latin.res \
test_regexp_utf8.res \
test_registers.res \
test_retab.res \
test_ruby.res \
test_scrollbind.res \
test_search.res \
test_signs.res \
test_smartindent.res \
test_source_utf8.res \
test_spell.res \
test_startup.res \
test_startup_utf8.res \
@ -166,8 +181,10 @@ NEW_TESTS = test_arabic.res \
test_textformat.res \
test_textobjects.res \
test_undo.res \
test_usercommands.res \
test_user_func.res \
test_usercommands.res \
test_utf8.res \
test_utf8_comparisons.res \
test_viminfo.res \
test_vimscript.res \
test_visual.res \

View File

@ -286,6 +286,10 @@ for s:test in sort(s:tests)
call add(s:messages, 'Flaky test failed, running it again')
let first_run = v:errors
" Flakiness is often caused by the system being very busy. Sleep a couple
" of seconds to have a higher chance of succeeding the second time.
sleep 2
let v:errors = []
call RunTheTest(s:test)
if len(v:errors) > 0

View File

@ -9,12 +9,19 @@ function SetUp()
endfunction
function Test_glob()
if !has('unix')
" This test fails on Windows because of the special characters in the
" filenames. Disable the test on non-Unix systems for now.
return
endif
call assert_equal("", glob('Xxx\{'))
call assert_equal("", glob('Xxx\$'))
w! Xxx{
w! Xxx\$
call assert_equal("Xxx{", glob('Xxx\{'))
call assert_equal("Xxx$", glob('Xxx\$'))
call delete('Xxx{')
call delete('Xxx$')
endfunction
function Test_globpath()

View File

@ -5,4 +5,6 @@ function Test_edit()
edit +1|s/|/PIPE/|w Xfile1| e Xfile2|1 | s/\//SLASH/|w
call assert_equal(["fooPIPEbar"], readfile("Xfile1"))
call assert_equal(["fooSLASHbar"], readfile("Xfile2"))
call delete('Xfile1')
call delete('Xfile2')
endfunction

View File

@ -352,9 +352,7 @@ func Test_terminal_curwin()
call delete('Xtext')
endfunc
func Test_finish_open_close()
call assert_equal(1, winnr('$'))
func s:get_sleep_cmd()
if s:python != ''
let cmd = s:python . " test_short_sleep.py"
let waittime = 500
@ -367,12 +365,18 @@ func Test_finish_open_close()
let cmd = 'sleep 1'
endif
endif
return [cmd, waittime]
endfunc
func Test_terminal_finish_open_close()
call assert_equal(1, winnr('$'))
let [cmd, waittime] = s:get_sleep_cmd()
exe 'terminal ++close ' . cmd
call assert_equal(2, winnr('$'))
wincmd p
call WaitFor("winnr('$') == 1", waittime)
call assert_equal(1, winnr('$'))
call term_start(cmd, {'term_finish': 'close'})
call assert_equal(2, winnr('$'))
@ -430,6 +434,27 @@ func Test_terminal_cwd()
call delete('Xdir', 'rf')
endfunc
func Test_terminal_servername()
if !has('clientserver')
return
endif
let g:buf = Run_shell_in_terminal({})
" Wait for the shell to display a prompt
call WaitFor('term_getline(g:buf, 1) != ""')
if has('win32')
call term_sendkeys(g:buf, "echo %VIM_SERVERNAME%\r")
else
call term_sendkeys(g:buf, "echo $VIM_SERVERNAME\r")
endif
call term_wait(g:buf)
call Stop_shell_in_terminal(g:buf)
call WaitFor('getline(2) == v:servername')
call assert_equal(v:servername, getline(2))
exe g:buf . 'bwipe'
unlet g:buf
endfunc
func Test_terminal_env()
let g:buf = Run_shell_in_terminal({'env': {'TESTENV': 'correct'}})
" Wait for the shell to display a prompt
@ -743,3 +768,29 @@ func Test_terminal_composing_unicode()
unlet g:job
let &encoding = save_enc
endfunc
func Test_terminal_aucmd_on_close()
fun Nop()
let s:called = 1
endfun
aug repro
au!
au BufWinLeave * call Nop()
aug END
let [cmd, waittime] = s:get_sleep_cmd()
call assert_equal(1, winnr('$'))
new
call setline(1, ['one', 'two'])
exe 'term ++close ' . cmd
wincmd p
call WaitFor("winnr('$') == 2", waittime)
call assert_equal(1, s:called)
bwipe!
unlet s:called
au! repro
delfunc Nop
endfunc

View File

@ -771,6 +771,20 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
1330,
/**/
1329,
/**/
1328,
/**/
1327,
/**/
1326,
/**/
1325,
/**/
1324,
/**/
1323,
/**/