mirror of
				https://github.com/neovim/neovim.git
				synced 2025-10-26 12:27:24 +00:00 
			
		
		
		
	Merge #11060 from janlazo/vim-8.1.1783
vim-patch:8.0.{1109,1529,1539,1621,1733,1771,1776},8.1.{1783,2054,2058}
			
			
This commit is contained in:
		| @@ -6657,7 +6657,7 @@ remote_expr({server}, {string} [, {idvar} [, {timeout}]]) | |||||||
| 		between (not at the end), like with join(expr, "\n"). | 		between (not at the end), like with join(expr, "\n"). | ||||||
| 		If {idvar} is present and not empty, it is taken as the name | 		If {idvar} is present and not empty, it is taken as the name | ||||||
| 		of a variable and a {serverid} for later use with | 		of a variable and a {serverid} for later use with | ||||||
| 		remote_read() is stored there. | 		|remote_read()| is stored there. | ||||||
| 		If {timeout} is given the read times out after this many | 		If {timeout} is given the read times out after this many | ||||||
| 		seconds.  Otherwise a timeout of 600 seconds is used. | 		seconds.  Otherwise a timeout of 600 seconds is used. | ||||||
| 		See also |clientserver| |RemoteReply|. | 		See also |clientserver| |RemoteReply|. | ||||||
|   | |||||||
| @@ -7004,6 +7004,8 @@ static int assert_equalfile(typval_T *argvars) | |||||||
|           break; |           break; | ||||||
|         } |         } | ||||||
|       } |       } | ||||||
|  |       fclose(fd1); | ||||||
|  |       fclose(fd2); | ||||||
|     } |     } | ||||||
|   } |   } | ||||||
|   if (IObuff[0] != NUL) { |   if (IObuff[0] != NUL) { | ||||||
| @@ -18444,6 +18446,7 @@ static void timer_due_cb(TimeWatcher *tw, void *data) | |||||||
|   timer_T *timer = (timer_T *)data; |   timer_T *timer = (timer_T *)data; | ||||||
|   int save_did_emsg = did_emsg; |   int save_did_emsg = did_emsg; | ||||||
|   int save_called_emsg = called_emsg; |   int save_called_emsg = called_emsg; | ||||||
|  |   const bool save_ex_pressedreturn = get_pressedreturn(); | ||||||
|  |  | ||||||
|   if (timer->stopped || timer->paused) { |   if (timer->stopped || timer->paused) { | ||||||
|     return; |     return; | ||||||
| @@ -18472,6 +18475,7 @@ static void timer_due_cb(TimeWatcher *tw, void *data) | |||||||
|   } |   } | ||||||
|   did_emsg = save_did_emsg; |   did_emsg = save_did_emsg; | ||||||
|   called_emsg = save_called_emsg; |   called_emsg = save_called_emsg; | ||||||
|  |   set_pressedreturn(save_ex_pressedreturn); | ||||||
|  |  | ||||||
|   if (timer->emsg_count >= 3) { |   if (timer->emsg_count >= 3) { | ||||||
|     timer_stop(timer); |     timer_stop(timer); | ||||||
|   | |||||||
| @@ -1632,7 +1632,7 @@ return { | |||||||
|     command='marks', |     command='marks', | ||||||
|     flags=bit.bor(EXTRA, TRLBAR, CMDWIN), |     flags=bit.bor(EXTRA, TRLBAR, CMDWIN), | ||||||
|     addr_type=ADDR_LINES, |     addr_type=ADDR_LINES, | ||||||
|     func='do_marks', |     func='ex_marks', | ||||||
|   }, |   }, | ||||||
|   { |   { | ||||||
|     command='match', |     command='match', | ||||||
|   | |||||||
| @@ -77,7 +77,7 @@ | |||||||
| #include "nvim/api/private/helpers.h" | #include "nvim/api/private/helpers.h" | ||||||
|  |  | ||||||
| static int quitmore = 0; | static int quitmore = 0; | ||||||
| static int ex_pressedreturn = FALSE; | static bool ex_pressedreturn = false; | ||||||
|  |  | ||||||
| /// Whether ":lcd" or ":tcd" was produced for a session. | /// Whether ":lcd" or ":tcd" was produced for a session. | ||||||
| static int did_lcd; | static int did_lcd; | ||||||
| @@ -1278,14 +1278,14 @@ static char_u * do_one_cmd(char_u **cmdlinep, | |||||||
|             || getline_equal(fgetline, cookie, getexline)) |             || getline_equal(fgetline, cookie, getexline)) | ||||||
|         && curwin->w_cursor.lnum < curbuf->b_ml.ml_line_count) { |         && curwin->w_cursor.lnum < curbuf->b_ml.ml_line_count) { | ||||||
|       ea.cmd = (char_u *)"+"; |       ea.cmd = (char_u *)"+"; | ||||||
|       ex_pressedreturn = TRUE; |       ex_pressedreturn = true; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     /* ignore comment and empty lines */ |     /* ignore comment and empty lines */ | ||||||
|     if (*ea.cmd == '"') |     if (*ea.cmd == '"') | ||||||
|       goto doend; |       goto doend; | ||||||
|     if (*ea.cmd == NUL) { |     if (*ea.cmd == NUL) { | ||||||
|       ex_pressedreturn = TRUE; |       ex_pressedreturn = true; | ||||||
|       goto doend; |       goto doend; | ||||||
|     } |     } | ||||||
|  |  | ||||||
| @@ -10131,6 +10131,17 @@ static void ex_folddo(exarg_T *eap) | |||||||
|   ml_clearmarked();      // clear rest of the marks |   ml_clearmarked();      // clear rest of the marks | ||||||
| } | } | ||||||
|  |  | ||||||
|  | bool get_pressedreturn(void) | ||||||
|  |   FUNC_ATTR_PURE FUNC_ATTR_WARN_UNUSED_RESULT | ||||||
|  | { | ||||||
|  |   return ex_pressedreturn; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | void set_pressedreturn(bool val) | ||||||
|  | { | ||||||
|  |   ex_pressedreturn = val; | ||||||
|  | } | ||||||
|  |  | ||||||
| static void ex_terminal(exarg_T *eap) | static void ex_terminal(exarg_T *eap) | ||||||
| { | { | ||||||
|   char ex_cmd[1024]; |   char ex_cmd[1024]; | ||||||
|   | |||||||
| @@ -616,7 +616,7 @@ static char_u *mark_line(pos_T *mp, int lead_len) | |||||||
| /* | /* | ||||||
|  * print the marks |  * print the marks | ||||||
|  */ |  */ | ||||||
| void do_marks(exarg_T *eap) | void ex_marks(exarg_T *eap) | ||||||
| { | { | ||||||
|   char_u      *arg = eap->arg; |   char_u      *arg = eap->arg; | ||||||
|   int i; |   int i; | ||||||
|   | |||||||
| @@ -7569,8 +7569,8 @@ void highlight_changed(void) | |||||||
| { | { | ||||||
|   int id; |   int id; | ||||||
|   char_u userhl[30];  // use 30 to avoid compiler warning |   char_u userhl[30];  // use 30 to avoid compiler warning | ||||||
|   int id_SNC = -1; |  | ||||||
|   int id_S = -1; |   int id_S = -1; | ||||||
|  |   int id_SNC = 0; | ||||||
|   int hlcnt; |   int hlcnt; | ||||||
|  |  | ||||||
|   need_highlight_changed = FALSE; |   need_highlight_changed = FALSE; | ||||||
|   | |||||||
| @@ -135,39 +135,80 @@ endfunc | |||||||
|  |  | ||||||
| " Wait for up to five seconds for "expr" to become true.  "expr" can be a | " Wait for up to five seconds for "expr" to become true.  "expr" can be a | ||||||
| " stringified expression to evaluate, or a funcref without arguments. | " stringified expression to evaluate, or a funcref without arguments. | ||||||
|  | " Using a lambda works best.  Example: | ||||||
|  | "	call WaitFor({-> status == "ok"}) | ||||||
| " | " | ||||||
| " A second argument can be used to specify a different timeout in msec. | " A second argument can be used to specify a different timeout in msec. | ||||||
| " | " | ||||||
| " Return time slept in milliseconds.  With the +reltime feature this can be | " When successful the time slept is returned. | ||||||
| " more than the actual waiting time.  Without +reltime it can also be less. | " When running into the timeout an exception is thrown, thus the function does | ||||||
|  | " not return. | ||||||
| func WaitFor(expr, ...) | func WaitFor(expr, ...) | ||||||
|   let timeout = get(a:000, 0, 5000) |   let timeout = get(a:000, 0, 5000) | ||||||
|   " using reltime() is more accurate, but not always available |   let slept = s:WaitForCommon(a:expr, v:null, timeout) | ||||||
|   if has('reltime') |   if slept < 0 | ||||||
|     let start = reltime() |     throw 'WaitFor() timed out after ' . timeout . ' msec' | ||||||
|   else |  | ||||||
|     let slept = 0 |  | ||||||
|   endif |  | ||||||
|   if type(a:expr) == v:t_func |  | ||||||
|     let Test = a:expr |  | ||||||
|   else |  | ||||||
|     let Test = {-> eval(a:expr) } |  | ||||||
|   endif |  | ||||||
|   for i in range(timeout / 10) |  | ||||||
|     if Test() |  | ||||||
|       if has('reltime') |  | ||||||
| 	return float2nr(reltimefloat(reltime(start)) * 1000) |  | ||||||
|   endif |   endif | ||||||
|   return slept |   return slept | ||||||
|  | endfunc | ||||||
|  |  | ||||||
|  | " Wait for up to five seconds for "assert" to return zero.  "assert" must be a | ||||||
|  | " (lambda) function containing one assert function.  Example: | ||||||
|  | "	call WaitForAssert({-> assert_equal("dead", job_status(job)}) | ||||||
|  | " | ||||||
|  | " A second argument can be used to specify a different timeout in msec. | ||||||
|  | " | ||||||
|  | " Return zero for success, one for failure (like the assert function). | ||||||
|  | func WaitForAssert(assert, ...) | ||||||
|  |   let timeout = get(a:000, 0, 5000) | ||||||
|  |   if s:WaitForCommon(v:null, a:assert, timeout) < 0 | ||||||
|  |     return 1 | ||||||
|   endif |   endif | ||||||
|     if !has('reltime') |   return 0 | ||||||
|  | endfunc | ||||||
|  |  | ||||||
|  | " Common implementation of WaitFor() and WaitForAssert(). | ||||||
|  | " Either "expr" or "assert" is not v:null | ||||||
|  | " Return the waiting time for success, -1 for failure. | ||||||
|  | func s:WaitForCommon(expr, assert, timeout) | ||||||
|  |   " using reltime() is more accurate, but not always available | ||||||
|  |   let slept = 0 | ||||||
|  |   if has('reltime') | ||||||
|  |     let start = reltime() | ||||||
|  |   endif | ||||||
|  |  | ||||||
|  |   while 1 | ||||||
|  |     if type(a:expr) == v:t_func | ||||||
|  |       let success = a:expr() | ||||||
|  |     elseif type(a:assert) == v:t_func | ||||||
|  |       let success = a:assert() == 0 | ||||||
|  |     else | ||||||
|  |       let success = eval(a:expr) | ||||||
|  |     endif | ||||||
|  |     if success | ||||||
|  |       return slept | ||||||
|  |     endif | ||||||
|  |  | ||||||
|  |     if slept >= a:timeout | ||||||
|  |       break | ||||||
|  |     endif | ||||||
|  |     if type(a:assert) == v:t_func | ||||||
|  |       " Remove the error added by the assert function. | ||||||
|  |       call remove(v:errors, -1) | ||||||
|  |     endif | ||||||
|  |  | ||||||
|  |     sleep 10m | ||||||
|  |     if has('reltime') | ||||||
|  |       let slept = float2nr(reltimefloat(reltime(start)) * 1000) | ||||||
|  |     else | ||||||
|       let slept += 10 |       let slept += 10 | ||||||
|     endif |     endif | ||||||
|     sleep 10m |   endwhile | ||||||
|   endfor |  | ||||||
|   throw 'WaitFor() timed out after ' . timeout . ' msec' |   return -1  " timed out | ||||||
| endfunc | endfunc | ||||||
|  |  | ||||||
|  |  | ||||||
| " Wait for up to a given milliseconds. | " Wait for up to a given milliseconds. | ||||||
| " With the +timers feature this waits for key-input by getchar(), Resume() | " With the +timers feature this waits for key-input by getchar(), Resume() | ||||||
| " feeds key-input and resumes process. Return time waited in milliseconds. | " feeds key-input and resumes process. Return time waited in milliseconds. | ||||||
|   | |||||||
| @@ -1344,11 +1344,11 @@ func Test_Changed_FirstTime() | |||||||
|   let buf = term_start([GetVimProg(), '--clean', '-c', 'set noswapfile'], {'term_rows': 3}) |   let buf = term_start([GetVimProg(), '--clean', '-c', 'set noswapfile'], {'term_rows': 3}) | ||||||
|   call assert_equal('running', term_getstatus(buf)) |   call assert_equal('running', term_getstatus(buf)) | ||||||
|   " Wait for the ruler (in the status line) to be shown. |   " Wait for the ruler (in the status line) to be shown. | ||||||
|   call WaitFor({-> term_getline(buf, 3) =~# '\<All$'}) |   call WaitForAssert({-> assert_match('\<All$', term_getline(buf, 3))}) | ||||||
|   " It's only adding autocmd, so that no event occurs. |   " It's only adding autocmd, so that no event occurs. | ||||||
|   call term_sendkeys(buf, ":au! TextChanged <buffer> call writefile(['No'], 'Xchanged.txt')\<cr>") |   call term_sendkeys(buf, ":au! TextChanged <buffer> call writefile(['No'], 'Xchanged.txt')\<cr>") | ||||||
|   call term_sendkeys(buf, "\<C-\\>\<C-N>:qa!\<cr>") |   call term_sendkeys(buf, "\<C-\\>\<C-N>:qa!\<cr>") | ||||||
|   call WaitFor({-> term_getstatus(buf) == 'finished'}) |   call WaitForAssert({-> assert_equal('finished', term_getstatus(buf))}) | ||||||
|   call assert_equal([''], readfile('Xchanged.txt')) |   call assert_equal([''], readfile('Xchanged.txt')) | ||||||
|  |  | ||||||
|   " clean up |   " clean up | ||||||
|   | |||||||
| @@ -28,12 +28,11 @@ func Test_client_server() | |||||||
|   let name = 'XVIMTEST' |   let name = 'XVIMTEST' | ||||||
|   let cmd .= ' --servername ' . name |   let cmd .= ' --servername ' . name | ||||||
|   let job = job_start(cmd, {'stoponexit': 'kill', 'out_io': 'null'}) |   let job = job_start(cmd, {'stoponexit': 'kill', 'out_io': 'null'}) | ||||||
|   call WaitFor({-> job_status(job) == "run"}) |   call WaitForAssert({-> assert_equal("run", job_status(job))}) | ||||||
|  |  | ||||||
|   " Takes a short while for the server to be active. |   " Takes a short while for the server to be active. | ||||||
|   " When using valgrind it takes much longer. |   " When using valgrind it takes much longer. | ||||||
|   call WaitFor('serverlist() =~ "' . name . '"') |   call WaitForAssert({-> assert_match(name, serverlist())}) | ||||||
|   call assert_match(name, serverlist()) |  | ||||||
|  |  | ||||||
|   call remote_foreground(name) |   call remote_foreground(name) | ||||||
|  |  | ||||||
| @@ -54,12 +53,10 @@ func Test_client_server() | |||||||
|     endif |     endif | ||||||
|     " Wait for the server to be up and answering requests. |     " Wait for the server to be up and answering requests. | ||||||
|     sleep 100m |     sleep 100m | ||||||
|     call WaitFor('remote_expr("' . name . '", "v:version", "", 1) != ""') |     call WaitForAssert({-> assert_true(remote_expr(name, "v:version", "", 1) != "")}) | ||||||
|     call assert_true(remote_expr(name, "v:version", "", 1) != "") |  | ||||||
|  |  | ||||||
|     call remote_send(name, ":let testvar = 'maybe'\<CR>") |     call remote_send(name, ":let testvar = 'maybe'\<CR>") | ||||||
|     call WaitFor('remote_expr("' . name . '", "testvar", "", 1) == "maybe"') |     call WaitForAssert({-> assert_equal('maybe', remote_expr(name, "testvar", "", 2))}) | ||||||
|     call assert_equal('maybe', remote_expr(name, "testvar", "", 2)) |  | ||||||
|   endif |   endif | ||||||
|  |  | ||||||
|   call assert_fails('call remote_send("XXX", ":let testvar = ''yes''\<CR>")', 'E241') |   call assert_fails('call remote_send("XXX", ":let testvar = ''yes''\<CR>")', 'E241') | ||||||
| @@ -94,7 +91,7 @@ func Test_client_server() | |||||||
|  |  | ||||||
|   call remote_send(name, ":qa!\<CR>") |   call remote_send(name, ":qa!\<CR>") | ||||||
|   try |   try | ||||||
|     call WaitFor({-> job_status(job) == "dead"}) |     call WaitForAssert({-> assert_equal("dead", job_status(job))}) | ||||||
|   finally |   finally | ||||||
|     if job_status(job) != 'dead' |     if job_status(job) != 'dead' | ||||||
|       call assert_report('Server did not exit') |       call assert_report('Server did not exit') | ||||||
|   | |||||||
| @@ -10,6 +10,10 @@ func Test_compiler() | |||||||
|     unlet $LANG |     unlet $LANG | ||||||
|   endif |   endif | ||||||
|  |  | ||||||
|  |   " %:S does not work properly with 'shellslash' set | ||||||
|  |   let save_shellslash = &shellslash | ||||||
|  |   set noshellslash | ||||||
|  |  | ||||||
|   e Xfoo.pl |   e Xfoo.pl | ||||||
|   compiler perl |   compiler perl | ||||||
|   call assert_equal('perl', b:current_compiler) |   call assert_equal('perl', b:current_compiler) | ||||||
| @@ -24,9 +28,11 @@ func Test_compiler() | |||||||
|   w! |   w! | ||||||
|   call feedkeys(":make\<CR>\<CR>", 'tx') |   call feedkeys(":make\<CR>\<CR>", 'tx') | ||||||
|   let a=execute('clist') |   let a=execute('clist') | ||||||
|   call assert_match("\n 1 Xfoo.pl:3: Global symbol \"\$foo\" " |   call assert_match('\n \d\+ Xfoo.pl:3: Global symbol "$foo" ' | ||||||
|   \ .               "requires explicit package name", a) |   \ .               'requires explicit package name', a) | ||||||
|  |  | ||||||
|  |  | ||||||
|  |   let &shellslash = save_shellslash | ||||||
|   call delete('Xfoo.pl') |   call delete('Xfoo.pl') | ||||||
|   bw! |   bw! | ||||||
| endfunc | endfunc | ||||||
|   | |||||||
| @@ -1,6 +1,7 @@ | |||||||
| " Test for completion menu | " Test for completion menu | ||||||
|  |  | ||||||
| source shared.vim | source shared.vim | ||||||
|  | source screendump.vim | ||||||
|  |  | ||||||
| let g:months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'] | let g:months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'] | ||||||
| let g:setting = '' | let g:setting = '' | ||||||
| @@ -680,18 +681,15 @@ func Test_popup_and_window_resize() | |||||||
|   call term_sendkeys(buf, "\<c-v>") |   call term_sendkeys(buf, "\<c-v>") | ||||||
|   call term_wait(buf, 100) |   call term_wait(buf, 100) | ||||||
|   " popup first entry "!" must be at the top |   " popup first entry "!" must be at the top | ||||||
|   call WaitFor({-> term_getline(buf, 1) =~ "^!"}) |   call WaitForAssert({-> assert_match('^!\s*$', term_getline(buf, 1))}) | ||||||
|   call assert_match('^!\s*$', term_getline(buf, 1)) |  | ||||||
|   exe 'resize +' . (h - 1) |   exe 'resize +' . (h - 1) | ||||||
|   call term_wait(buf, 100) |   call term_wait(buf, 100) | ||||||
|   redraw! |   redraw! | ||||||
|   " popup shifted down, first line is now empty |   " popup shifted down, first line is now empty | ||||||
|   call WaitFor({-> term_getline(buf, 1) == ""}) |   call WaitForAssert({-> assert_equal('', term_getline(buf, 1))}) | ||||||
|   call assert_equal('', term_getline(buf, 1)) |  | ||||||
|   sleep 100m |   sleep 100m | ||||||
|   " popup is below cursor line and shows first match "!" |   " popup is below cursor line and shows first match "!" | ||||||
|   call WaitFor({-> term_getline(buf, term_getcursor(buf)[0] + 1) =~ "^!"}) |   call WaitForAssert({-> assert_match('^!\s*$', term_getline(buf, term_getcursor(buf)[0] + 1))}) | ||||||
|   call assert_match('^!\s*$', term_getline(buf, term_getcursor(buf)[0] + 1)) |  | ||||||
|   " cursor line also shows ! |   " cursor line also shows ! | ||||||
|   call assert_match('^!\s*$', term_getline(buf, term_getcursor(buf)[0])) |   call assert_match('^!\s*$', term_getline(buf, term_getcursor(buf)[0])) | ||||||
|   bwipe! |   bwipe! | ||||||
| @@ -735,6 +733,38 @@ func Test_popup_and_preview_autocommand() | |||||||
|   bw! |   bw! | ||||||
| endfunc | endfunc | ||||||
|  |  | ||||||
|  | func Test_popup_position() | ||||||
|  |   if !CanRunVimInTerminal() | ||||||
|  |     return | ||||||
|  |   endif | ||||||
|  |   call writefile([ | ||||||
|  | 	\ '123456789_123456789_123456789_a', | ||||||
|  | 	\ '123456789_123456789_123456789_b', | ||||||
|  | 	\ '            123', | ||||||
|  | 	\ ], 'Xtest') | ||||||
|  |   let buf = RunVimInTerminal('Xtest', {}) | ||||||
|  |   call term_sendkeys(buf, ":vsplit\<CR>") | ||||||
|  |  | ||||||
|  |   " default pumwidth in left window: overlap in right window | ||||||
|  |   call term_sendkeys(buf, "GA\<C-N>") | ||||||
|  |   call VerifyScreenDump(buf, 'Test_popup_position_01', {'rows': 8}) | ||||||
|  |   call term_sendkeys(buf, "\<Esc>u") | ||||||
|  |  | ||||||
|  |   " default pumwidth: fill until right of window | ||||||
|  |   call term_sendkeys(buf, "\<C-W>l") | ||||||
|  |   call term_sendkeys(buf, "GA\<C-N>") | ||||||
|  |   call VerifyScreenDump(buf, 'Test_popup_position_02', {'rows': 8}) | ||||||
|  |  | ||||||
|  |   " larger pumwidth: used as minimum width | ||||||
|  |   call term_sendkeys(buf, "\<Esc>u") | ||||||
|  |   call term_sendkeys(buf, ":set pumwidth=30\<CR>") | ||||||
|  |   call term_sendkeys(buf, "GA\<C-N>") | ||||||
|  |   call VerifyScreenDump(buf, 'Test_popup_position_03', {'rows': 8}) | ||||||
|  |  | ||||||
|  |   call term_sendkeys(buf, "\<Esc>u") | ||||||
|  |   call StopVimInTerminal(buf) | ||||||
|  |   call delete('Xtest') | ||||||
|  | endfunc | ||||||
|  |  | ||||||
| func Test_popup_complete_backwards() | func Test_popup_complete_backwards() | ||||||
|   new |   new | ||||||
| @@ -746,6 +776,16 @@ func Test_popup_complete_backwards() | |||||||
|   bwipe! |   bwipe! | ||||||
| endfunc | endfunc | ||||||
|  |  | ||||||
|  | func Test_popup_complete_backwards_ctrl_p() | ||||||
|  |   new | ||||||
|  |   call setline(1, ['Post', 'Port', 'Po']) | ||||||
|  |   let expected=['Post', 'Port', 'Port'] | ||||||
|  |   call cursor(3,2) | ||||||
|  |   call feedkeys("A\<C-P>\<C-N>rt\<cr>", 'tx') | ||||||
|  |   call assert_equal(expected, getline(1,'$')) | ||||||
|  |   bwipe! | ||||||
|  | endfunc | ||||||
|  |  | ||||||
| fun! Test_complete_o_tab() | fun! Test_complete_o_tab() | ||||||
|   throw 'skipped: Nvim does not support test_override()' |   throw 'skipped: Nvim does not support test_override()' | ||||||
|   let s:o_char_pressed = 0 |   let s:o_char_pressed = 0 | ||||||
|   | |||||||
| @@ -54,34 +54,33 @@ func Do_test_quotestar_for_x11() | |||||||
|   " Make sure a previous server has exited |   " Make sure a previous server has exited | ||||||
|   try |   try | ||||||
|     call remote_send(name, ":qa!\<CR>") |     call remote_send(name, ":qa!\<CR>") | ||||||
|     call WaitFor('serverlist() !~ "' . name . '"') |  | ||||||
|   catch /E241:/ |   catch /E241:/ | ||||||
|   endtry |   endtry | ||||||
|   call assert_notmatch(name, serverlist()) |   call WaitForAssert({-> assert_notmatch(name, serverlist())}) | ||||||
|  |  | ||||||
|   let cmd .= ' --servername ' . name |   let cmd .= ' --servername ' . name | ||||||
|   let job = job_start(cmd, {'stoponexit': 'kill', 'out_io': 'null'}) |   let job = job_start(cmd, {'stoponexit': 'kill', 'out_io': 'null'}) | ||||||
|   call WaitFor({-> job_status(job) == "run"}) |   call WaitForAssert({-> assert_equal("run", job_status(job))}) | ||||||
|  |  | ||||||
|   " Takes a short while for the server to be active. |   " Takes a short while for the server to be active. | ||||||
|   call WaitFor('serverlist() =~ "' . name . '"') |   call WaitForAssert({-> assert_match(name, serverlist())}) | ||||||
|  |  | ||||||
|   " Wait for the server to be up and answering requests.  One second is not |   " Wait for the server to be up and answering requests.  One second is not | ||||||
|   " always sufficient. |   " always sufficient. | ||||||
|   call WaitFor('remote_expr("' . name . '", "v:version", "", 2) != ""') |   call WaitForAssert({-> assert_notequal('', remote_expr(name, "v:version", "", 2))}) | ||||||
|  |  | ||||||
|   " Clear the *-register of this vim instance and wait for it to be picked up |   " Clear the *-register of this vim instance and wait for it to be picked up | ||||||
|   " by the server. |   " by the server. | ||||||
|   let @* = 'no' |   let @* = 'no' | ||||||
|   call remote_foreground(name) |   call remote_foreground(name) | ||||||
|   call WaitFor('remote_expr("' . name . '", "@*", "", 1) == "no"') |   call WaitForAssert({-> assert_equal("no", remote_expr(name, "@*", "", 1))}) | ||||||
|  |  | ||||||
|   " Set the * register on the server. |   " Set the * register on the server. | ||||||
|   call remote_send(name, ":let @* = 'yes'\<CR>") |   call remote_send(name, ":let @* = 'yes'\<CR>") | ||||||
|   call WaitFor('remote_expr("' . name . '", "@*", "", 1) == "yes"') |   call WaitForAssert({-> assert_equal("yes", remote_expr(name, "@*", "", 1))}) | ||||||
|  |  | ||||||
|   " Check that the *-register of this vim instance is changed as expected. |   " Check that the *-register of this vim instance is changed as expected. | ||||||
|   call WaitFor('@* == "yes"') |   call WaitForAssert({-> assert_equal("yes", @*)}) | ||||||
|  |  | ||||||
|   " Handle the large selection over 262040 byte. |   " Handle the large selection over 262040 byte. | ||||||
|   let length = 262044 |   let length = 262044 | ||||||
| @@ -109,18 +108,17 @@ func Do_test_quotestar_for_x11() | |||||||
|       call remote_send(name, ":gui -f\<CR>") |       call remote_send(name, ":gui -f\<CR>") | ||||||
|     endif |     endif | ||||||
|     " Wait for the server in the GUI to be up and answering requests. |     " Wait for the server in the GUI to be up and answering requests. | ||||||
|     call WaitFor('remote_expr("' . name . '", "has(\"gui_running\")", "", 1) =~ "1"') |     call WaitForAssert({-> assert_match("1", remote_expr(name, "has('gui_running')", "", 1))}) | ||||||
|  |  | ||||||
|     call remote_send(name, ":let @* = 'maybe'\<CR>") |     call remote_send(name, ":let @* = 'maybe'\<CR>") | ||||||
|     call WaitFor('remote_expr("' . name . '", "@*", "", 1) == "maybe"') |     call WaitForAssert({-> assert_equal("maybe", remote_expr(name, "@*", "", 2))}) | ||||||
|     call assert_equal('maybe', remote_expr(name, "@*", "", 2)) |  | ||||||
|  |  | ||||||
|     call assert_equal('maybe', @*) |     call assert_equal('maybe', @*) | ||||||
|   endif |   endif | ||||||
|  |  | ||||||
|   call remote_send(name, ":qa!\<CR>") |   call remote_send(name, ":qa!\<CR>") | ||||||
|   try |   try | ||||||
|     call WaitFor({-> job_status(job) == "dead"}) |     call WaitForAssert({-> assert_equal("dead", job_status(job))}) | ||||||
|   finally |   finally | ||||||
|     if job_status(job) != 'dead' |     if job_status(job) != 'dead' | ||||||
|       call assert_report('Server did not exit') |       call assert_report('Server did not exit') | ||||||
|   | |||||||
| @@ -1,6 +1,7 @@ | |||||||
| " Test for syntax and syntax iskeyword option | " Test for syntax and syntax iskeyword option | ||||||
|  |  | ||||||
| source view_util.vim | source view_util.vim | ||||||
|  | source screendump.vim | ||||||
|  |  | ||||||
| func GetSyntaxItem(pat) | func GetSyntaxItem(pat) | ||||||
|   let c = '' |   let c = '' | ||||||
| @@ -526,7 +527,7 @@ func Test_syntax_c() | |||||||
|   let $COLORFGBG = '15;0' |   let $COLORFGBG = '15;0' | ||||||
|  |  | ||||||
|   let buf = RunVimInTerminal('Xtest.c', {}) |   let buf = RunVimInTerminal('Xtest.c', {}) | ||||||
|   call VerifyScreenDump(buf, 'Test_syntax_c_01') |   call VerifyScreenDump(buf, 'Test_syntax_c_01', {}) | ||||||
|   call StopVimInTerminal(buf) |   call StopVimInTerminal(buf) | ||||||
|  |  | ||||||
|   let $COLORFGBG = '' |   let $COLORFGBG = '' | ||||||
|   | |||||||
| @@ -141,7 +141,7 @@ endfunc | |||||||
| func Test_delete_myself() | func Test_delete_myself() | ||||||
|   let g:called = 0 |   let g:called = 0 | ||||||
|   let t = timer_start(10, 'StopMyself', {'repeat': -1}) |   let t = timer_start(10, 'StopMyself', {'repeat': -1}) | ||||||
|   call WaitFor('g:called == 2') |   call WaitForAssert({-> assert_equal(2, g:called)}) | ||||||
|   call assert_equal(2, g:called) |   call assert_equal(2, g:called) | ||||||
|   call assert_equal([], timer_info(t)) |   call assert_equal([], timer_info(t)) | ||||||
| endfunc | endfunc | ||||||
| @@ -208,7 +208,7 @@ func Test_timer_errors() | |||||||
|   let g:call_count = 0 |   let g:call_count = 0 | ||||||
|   let timer = timer_start(10, 'FuncWithError', {'repeat': -1}) |   let timer = timer_start(10, 'FuncWithError', {'repeat': -1}) | ||||||
|   " Timer will be stopped after failing 3 out of 3 times. |   " Timer will be stopped after failing 3 out of 3 times. | ||||||
|   call WaitFor('g:call_count == 3') |   call WaitForAssert({-> assert_equal(3, g:call_count)}) | ||||||
|   sleep 50m |   sleep 50m | ||||||
|   call assert_equal(3, g:call_count) |   call assert_equal(3, g:call_count) | ||||||
| endfunc | endfunc | ||||||
| @@ -226,7 +226,7 @@ func Test_timer_catch_error() | |||||||
|   let g:call_count = 0 |   let g:call_count = 0 | ||||||
|   let timer = timer_start(10, 'FuncWithCaughtError', {'repeat': 4}) |   let timer = timer_start(10, 'FuncWithCaughtError', {'repeat': 4}) | ||||||
|   " Timer will not be stopped. |   " Timer will not be stopped. | ||||||
|   call WaitFor('g:call_count == 4') |   call WaitForAssert({-> assert_equal(4, g:call_count)}) | ||||||
|   sleep 50m |   sleep 50m | ||||||
|   call assert_equal(4, g:call_count) |   call assert_equal(4, g:call_count) | ||||||
| endfunc | endfunc | ||||||
| @@ -252,4 +252,15 @@ func Test_peek_and_get_char() | |||||||
|   call timer_stop(intr) |   call timer_stop(intr) | ||||||
| endfunc | endfunc | ||||||
|  |  | ||||||
|  | func Test_ex_mode() | ||||||
|  |   " Function with an empty line. | ||||||
|  |   func Foo(...) | ||||||
|  |  | ||||||
|  |   endfunc | ||||||
|  |   let timer =  timer_start(40, function('g:Foo'), {'repeat':-1}) | ||||||
|  |   " This used to throw error E749. | ||||||
|  |   exe "normal Qsleep 100m\rvi\r" | ||||||
|  |   call timer_stop(timer) | ||||||
|  | endfunc | ||||||
|  |  | ||||||
| " vim: shiftwidth=2 sts=2 expandtab | " vim: shiftwidth=2 sts=2 expandtab | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Justin M. Keyes
					Justin M. Keyes