From 10c3b206cbf394d7b67bff95242b7033a1ce1d63 Mon Sep 17 00:00:00 2001 From: James McCoy Date: Wed, 29 Nov 2017 20:43:07 -0500 Subject: [PATCH 1/9] version.c: Mark 8.0.0171 as NA [ci skip] --- src/nvim/version.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/nvim/version.c b/src/nvim/version.c index a09574a73e..b228b8909d 100644 --- a/src/nvim/version.c +++ b/src/nvim/version.c @@ -1085,7 +1085,7 @@ static const int included_patches[] = { 174, // 173 NA 172, - // 171, + // 171 NA // 170 NA // 169 NA 168, From 3d0ee17c916eca85ee28b8e716b6203f6d7fbf1c Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Fri, 1 Dec 2017 04:12:59 +0100 Subject: [PATCH 2/9] tui/rxvt: enable focus-reporting closes #7578 --- src/nvim/tui/tui.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/nvim/tui/tui.c b/src/nvim/tui/tui.c index 724d59b15a..56a81a1c36 100644 --- a/src/nvim/tui/tui.c +++ b/src/nvim/tui/tui.c @@ -1620,9 +1620,8 @@ static void augment_terminfo(TUIData *data, const char *term, ut, NULL, "\033]12;#%p1%06x\007"); } - /// Terminals generally ignore private modes that they do not recognize, - /// and there is no known ambiguity with these modes from terminal type to - /// terminal type, so we can afford to just set these unconditionally. + /// Terminals usually ignore unrecognized private modes, and there is no + /// known ambiguity with these. So we just set them unconditionally. data->unibi_ext.enable_lr_margin = (int)unibi_add_ext_str(ut, NULL, "\x1b[?69h"); data->unibi_ext.disable_lr_margin = (int)unibi_add_ext_str(ut, NULL, @@ -1632,9 +1631,9 @@ static void augment_terminfo(TUIData *data, const char *term, data->unibi_ext.disable_bracketed_paste = (int)unibi_add_ext_str(ut, NULL, "\x1b[?2004l"); data->unibi_ext.enable_focus_reporting = (int)unibi_add_ext_str(ut, NULL, - "\x1b[?1004h"); + rxvt ? "\x1b]777;focus;on\x7" : "\x1b[?1004h"); data->unibi_ext.disable_focus_reporting = (int)unibi_add_ext_str(ut, NULL, - "\x1b[?1004l"); + rxvt ? "\x1b]777;focus;off\x7" : "\x1b[?1004l"); data->unibi_ext.enable_mouse = (int)unibi_add_ext_str(ut, NULL, "\x1b[?1002h\x1b[?1006h"); data->unibi_ext.disable_mouse = (int)unibi_add_ext_str(ut, NULL, From 27f9b1c7b029d8f61723fd261bed76ea7a01e68d Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Fri, 1 Dec 2017 04:18:34 +0100 Subject: [PATCH 3/9] tui: emit some termcodes later (after startup) (#7664) For some reason, enabling focus reporting during terminal setup, causes slow rendering during Nvim startup on tmux 2.3 with the tmux `focus-events` option enabled. To workaround that issue, this commit defers the request. closes #7649 init.vim: call plug#begin('~/.config/nvim/plugged') Plug 'morhetz/gruvbox' call plug#end() set background=light " background light just to see the effect more quickly colorscheme gruvbox .tmux.conf: set -g focus-events on set-option -ga terminal-overrides ",xterm-256color:Tc" set-option -g default-terminal "screen-256color" Using `script` to record the terminal session (and `vterm-dump` to post-process the result): BEFORE this commit: ./build/bin/nvim -u NONE{CR}{LF} {DECSM 1049}{DECSM 1}{ESC =} {CUP *}{ED 2}{DECSM 2004}{DECSM 1004}{CSI 8,44,156 t}{CSI * r} {CUP 1,1} {CUP *}{ED 2}{DECSM 25} {DECRM 25}{CSI 2 q}{CSI 2 q} {CUP *}{ED 2}{LF} {ESC (B}{SGR *}{SGR 94}~ {CR}{LF} ~ {CR}{LF} AFTER this commit: ./build/bin/nvim -u NONE{CR}{LF} {DECSM 1049}{DECSM 1}{ESC =} {CUP *}{ED 2}{CSI 8,44,156 t}{CSI * r} {CUP 1,1} {CUP *}{ED 2}{DECSM 2004}{DECSM 1004}{DECSM 25} {DECRM 25}{CSI 2 q}{CSI 2 q} {CUP *}{ED 2}{LF} {ESC (B}{SGR *}{SGR 94}~ {CR}{LF} ~ {CR}{LF} ... --- src/nvim/tui/tui.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/nvim/tui/tui.c b/src/nvim/tui/tui.c index 56a81a1c36..9bd3364a43 100644 --- a/src/nvim/tui/tui.c +++ b/src/nvim/tui/tui.c @@ -167,6 +167,18 @@ static size_t unibi_pre_fmt_str(TUIData *data, unsigned int unibi_index, return unibi_run(str, data->params, buf, len); } +/// Emits some termcodes after Nvim startup, which were observed to slowdown +/// rendering during startup in tmux 2.3 (+focus-events). #7649 +static void terminfo_start_event(void **argv) +{ + UI *ui = argv[0]; + TUIData *data = ui->data; + // Enable bracketed paste + unibi_out_ext(ui, data->unibi_ext.enable_bracketed_paste); + // Enable focus reporting + unibi_out_ext(ui, data->unibi_ext.enable_focus_reporting); +} + static void termname_set_event(void **argv) { char *termname = argv[0]; @@ -244,10 +256,6 @@ static void terminfo_start(UI *ui) unibi_out(ui, unibi_enter_ca_mode); unibi_out(ui, unibi_keypad_xmit); unibi_out(ui, unibi_clear_screen); - // Enable bracketed paste - unibi_out_ext(ui, data->unibi_ext.enable_bracketed_paste); - // Enable focus reporting - unibi_out_ext(ui, data->unibi_ext.enable_focus_reporting); uv_loop_init(&data->write_loop); if (data->out_isatty) { uv_tty_init(&data->write_loop, &data->output_handle.tty, data->out_fd, 0); @@ -296,6 +304,8 @@ static void tui_terminal_start(UI *ui) update_size(ui); signal_watcher_start(&data->winch_handle, sigwinch_cb, SIGWINCH); term_input_start(&data->input); + loop_schedule_deferred(data->loop, + event_create(terminfo_start_event, 1, ui)); } static void tui_terminal_stop(UI *ui) From ee2e6d1d1aae923f647334f1c9f697a291ae9d5f Mon Sep 17 00:00:00 2001 From: Wang Shidong Date: Fri, 1 Dec 2017 06:40:03 -0600 Subject: [PATCH 4/9] Fix type in job_control doc --- runtime/doc/job_control.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/doc/job_control.txt b/runtime/doc/job_control.txt index 7df43d6793..e57015db22 100644 --- a/runtime/doc/job_control.txt +++ b/runtime/doc/job_control.txt @@ -30,7 +30,7 @@ To control jobs, use the "job…" family of functions: |jobstart()|, Example: > - function! s:JobHandler(job_id, data, event) dict + function! s:OnEvent(job_id, data, event) dict if a:event == 'stdout' let str = self.shell.' stdout: '.join(a:data) elseif a:event == 'stderr' From 585d664b7b0d5032082bdc3ca8a17bc7fa34a4e8 Mon Sep 17 00:00:00 2001 From: ckelsel Date: Sat, 2 Dec 2017 15:25:24 +0800 Subject: [PATCH 5/9] vim-patch:8.0.0298 Problem: Ex command range with repeated search does not work. (Bruce DeVisser) Solution: Skip over \/, \? and \&. https://github.com/vim/vim/commit/cbf20fbcd3e9bb006f694bcc35da859930fb12a2 --- src/nvim/ex_docmd.c | 10 ++++++++-- src/nvim/testdir/test_cmdline.vim | 25 +++++++++++++++++++++++++ src/nvim/version.c | 2 +- 3 files changed, 34 insertions(+), 3 deletions(-) diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c index 5180420eff..801979a9cb 100644 --- a/src/nvim/ex_docmd.c +++ b/src/nvim/ex_docmd.c @@ -3484,8 +3484,14 @@ char_u *skip_range( { unsigned delim; - while (vim_strchr((char_u *)" \t0123456789.$%'/?-+,;", *cmd) != NULL) { - if (*cmd == '\'') { + while (vim_strchr((char_u *)" \t0123456789.$%'/?-+,;\\", *cmd) != NULL) { + if (*cmd == '\\') { + if (cmd[1] == '?' || cmd[1] == '/' || cmd[1] == '&') { + cmd++; + } else { + break; + } + } else if (*cmd == '\'') { if (*++cmd == NUL && ctx != NULL) *ctx = EXPAND_NOTHING; } else if (*cmd == '/' || *cmd == '?') { diff --git a/src/nvim/testdir/test_cmdline.vim b/src/nvim/testdir/test_cmdline.vim index 5fc519f822..ac44e09a5a 100644 --- a/src/nvim/testdir/test_cmdline.vim +++ b/src/nvim/testdir/test_cmdline.vim @@ -306,3 +306,28 @@ func Test_cmdline_complete_wildoptions() call assert_equal(a, b) bw! endfunc + +" using a leading backslash here +set cpo+=C + +func Test_cmdline_search_range() + new + call setline(1, ['a', 'b', 'c', 'd']) + /d + 1,\/s/b/B/ + call assert_equal('B', getline(2)) + + /a + $ + \?,4s/c/C/ + call assert_equal('C', getline(3)) + + call setline(1, ['a', 'b', 'c', 'd']) + %s/c/c/ + 1,\&s/b/B/ + call assert_equal('B', getline(2)) + + bwipe! +endfunc + +set cpo& diff --git a/src/nvim/version.c b/src/nvim/version.c index b228b8909d..0f058c751b 100644 --- a/src/nvim/version.c +++ b/src/nvim/version.c @@ -958,7 +958,7 @@ static const int included_patches[] = { // 301, 300, // 299, - // 298, + 298, 297, // 296, // 295, From 7ab36403e1abce45c688a33e2909c04e54da62e5 Mon Sep 17 00:00:00 2001 From: ckelsel Date: Sat, 2 Dec 2017 15:45:19 +0800 Subject: [PATCH 6/9] fix lint error --- src/nvim/ex_docmd.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c index 801979a9cb..e11788531b 100644 --- a/src/nvim/ex_docmd.c +++ b/src/nvim/ex_docmd.c @@ -3492,8 +3492,9 @@ char_u *skip_range( break; } } else if (*cmd == '\'') { - if (*++cmd == NUL && ctx != NULL) + if (*++cmd == NUL && ctx != NULL) { *ctx = EXPAND_NOTHING; + } } else if (*cmd == '/' || *cmd == '?') { delim = *cmd++; while (*cmd != NUL && *cmd != delim) From 4b83f3791257c0aecff6c35dbe9a644a1a72418c Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Sat, 2 Dec 2017 03:53:23 +0100 Subject: [PATCH 7/9] tui.c: request focus-reporting (fix regression) #7670 ref #7649 ref #7664 27f9b1c7b029d8 caused a regression: it uses loop_schedule_deferred() to defer emitting the "enable focus reporting" termcode. tui_main() never processes `tui_loop.events` (which loop_schedule_deferred() depends on), so the event was never actually processed. But fixing that (by processing `tui_loop.events`) would bring back the problem 27f9b1c7b029 tried to fix: it still emits the event too soon. Instead, do a little dance: schedule the event on `main_loop` and then forward it to `tui_loop`. NOTE: after this commit, in tmux 2.3 with `focus-events` enabled, FocusGained is fired on startup and when resuming from suspend. Using `script` to record the terminal session (and `vterm-dump` to post-process the result): BEFORE: {DECSM 1049}{DECSM 1}{ESC =} {CUP *}{ED *}{DECSM 2004}{DECSM 1004}{CSI 1,43 r} {CUP 1,1} {CUP *}{ED *}{SM 34}{DECSM 25} {DECRM 25}{CSI 2 q}{CSI 2 q} {CUP *}{ED *}{LF} {SGR *}{LS1}{SGR 94}~ ... AFTER: {CUP *}{ED *}{CSI 1,43 r} {CUP 1,1} {CUP *}{ED *}{SM 34}{DECSM 25} {DECRM 25}{CSI 2 q}{CSI 2 q} {CUP *}{ED *}{DECSM 2004}{DECSM 1004}{LF} {SGR *}{LS1}{SGR 94}~ ... --- src/nvim/event/loop.h | 9 ++++----- src/nvim/tui/tui.c | 15 +++++++++++---- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/src/nvim/event/loop.h b/src/nvim/event/loop.h index b0ddc59469..d1a40d5cc9 100644 --- a/src/nvim/event/loop.h +++ b/src/nvim/event/loop.h @@ -19,12 +19,11 @@ typedef struct loop { MultiQueue *events; MultiQueue *thread_events; // Immediate events: - // "Events that should be processed after exiting uv_run() (to avoid - // recursion), but before returning from loop_poll_events()." - // 502aee690c980fcb3cfcb3f211dcfad06103db46 - // Practical consequence: these events are processed by + // "Processed after exiting uv_run() (to avoid recursion), but before + // returning from loop_poll_events()." 502aee690c98 + // Practical consequence (for main_loop): these events are processed by // state_enter()..os_inchar() - // whereas "regular" (main_loop.events) events are processed by + // whereas "regular" events (main_loop.events) are processed by // state_enter()..VimState.execute() // But state_enter()..os_inchar() can be "too early" if you want the event // to trigger UI updates and other user-activity-related side-effects. diff --git a/src/nvim/tui/tui.c b/src/nvim/tui/tui.c index 9bd3364a43..2436295ad4 100644 --- a/src/nvim/tui/tui.c +++ b/src/nvim/tui/tui.c @@ -169,10 +169,16 @@ static size_t unibi_pre_fmt_str(TUIData *data, unsigned int unibi_index, /// Emits some termcodes after Nvim startup, which were observed to slowdown /// rendering during startup in tmux 2.3 (+focus-events). #7649 -static void terminfo_start_event(void **argv) +static void terminfo_after_startup_event(void **argv) { UI *ui = argv[0]; + bool defer = argv[1] != NULL; // clever(?) boolean without malloc() dance. TUIData *data = ui->data; + if (defer) { // We're on the main-loop. Now forward to the TUI loop. + loop_schedule(data->loop, + event_create(terminfo_after_startup_event, 2, ui, NULL)); + return; + } // Enable bracketed paste unibi_out_ext(ui, data->unibi_ext.enable_bracketed_paste); // Enable focus reporting @@ -268,6 +274,9 @@ static void terminfo_start(UI *ui) uv_pipe_init(&data->write_loop, &data->output_handle.pipe, 0); uv_pipe_open(&data->output_handle.pipe, data->out_fd); } + + loop_schedule(&main_loop, + event_create(terminfo_after_startup_event, 2, ui, ui)); } static void terminfo_stop(UI *ui) @@ -304,8 +313,6 @@ static void tui_terminal_start(UI *ui) update_size(ui); signal_watcher_start(&data->winch_handle, sigwinch_cb, SIGWINCH); term_input_start(&data->input); - loop_schedule_deferred(data->loop, - event_create(terminfo_start_event, 1, ui)); } static void tui_terminal_stop(UI *ui) @@ -352,7 +359,7 @@ static void tui_main(UIBridgeData *bridge, UI *ui) CONTINUE(bridge); while (!data->stop) { - loop_poll_events(&tui_loop, -1); + loop_poll_events(&tui_loop, -1); // tui_loop.events is never processed } ui_bridge_stopped(bridge); From 7a4c9dc1c22c8cafba9c33cb7c085b7d0b467226 Mon Sep 17 00:00:00 2001 From: KunMing Xie Date: Sun, 3 Dec 2017 00:14:18 +0800 Subject: [PATCH 8/9] vim-patch:8.0.0295 (#7671) Problem: test_viml hangs. Solution: Put resetting 'more' before sourcing the script. https://github.com/vim/vim/commit/7a073549a3b1e72037a4e98ceb406d057ac9ba50 --- src/nvim/testdir/runtest.vim | 1 - src/nvim/version.c | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/nvim/testdir/runtest.vim b/src/nvim/testdir/runtest.vim index 39ffabc024..4de1345679 100644 --- a/src/nvim/testdir/runtest.vim +++ b/src/nvim/testdir/runtest.vim @@ -203,7 +203,6 @@ let s:flaky = [ \ ] " Locate Test_ functions and execute them. -set nomore redir @q silent function /^Test_ redir END diff --git a/src/nvim/version.c b/src/nvim/version.c index b228b8909d..96161c91ff 100644 --- a/src/nvim/version.c +++ b/src/nvim/version.c @@ -961,7 +961,7 @@ static const int included_patches[] = { // 298, 297, // 296, - // 295, + 295, 294, // 293, 292, From 44421a22c0d9e8e2181d9338a36d1a4ec1f329be Mon Sep 17 00:00:00 2001 From: KunMing Xie Date: Sun, 3 Dec 2017 00:25:50 +0800 Subject: [PATCH 9/9] vim-patch:8.0.0306 (#7675) Problem: mode() not sufficiently tested. Solution: Add more tests. (Yegappan Lakshmanan) https://github.com/vim/vim/commit/e971df39a5aac5d9b7e8033247dc18b12daa0eb8 --- src/nvim/testdir/test_functions.vim | 34 +++++++++++++++++++++++++++++ src/nvim/version.c | 2 +- 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/src/nvim/testdir/test_functions.vim b/src/nvim/testdir/test_functions.vim index 59807ca946..0ce034b63e 100644 --- a/src/nvim/testdir/test_functions.vim +++ b/src/nvim/testdir/test_functions.vim @@ -207,39 +207,73 @@ func! Test_mode() normal! 3G exe "normal i\\" call assert_equal('i-i', g:current_modes) + " i_CTRL-P: Multiple matches exe "normal i\uBa\\\u" call assert_equal('i-ic', g:current_modes) + " i_CTRL-P: Single match exe "normal iBro\\\u" call assert_equal('i-ic', g:current_modes) + " i_CTRL-X exe "normal iBa\\\u" call assert_equal('i-ix', g:current_modes) + " i_CTRL-X CTRL-P: Multiple matches exe "normal iBa\\\\u" call assert_equal('i-ic', g:current_modes) + " i_CTRL-X CTRL-P: Single match exe "normal iBro\\\\u" call assert_equal('i-ic', g:current_modes) + " i_CTRL-X CTRL-P + CTRL-P: Single match exe "normal iBro\\\\\u" call assert_equal('i-ic', g:current_modes) + " i_CTRL-X CTRL-L: Multiple matches + exe "normal i\\\\u" + call assert_equal('i-ic', g:current_modes) + " i_CTRL-X CTRL-L: Single match + exe "normal iBlu\\\\u" + call assert_equal('i-ic', g:current_modes) + " i_CTRL-P: No match exe "normal iCom\\\u" call assert_equal('i-ic', g:current_modes) + " i_CTRL-X CTRL-P: No match exe "normal iCom\\\\u" call assert_equal('i-ic', g:current_modes) + " i_CTRL-X CTRL-L: No match + exe "normal iabc\\\\u" + call assert_equal('i-ic', g:current_modes) + " R_CTRL-P: Multiple matches exe "normal RBa\\\u" call assert_equal('R-Rc', g:current_modes) + " R_CTRL-P: Single match exe "normal RBro\\\u" call assert_equal('R-Rc', g:current_modes) + " R_CTRL-X exe "normal RBa\\\u" call assert_equal('R-Rx', g:current_modes) + " R_CTRL-X CTRL-P: Multiple matches exe "normal RBa\\\\u" call assert_equal('R-Rc', g:current_modes) + " R_CTRL-X CTRL-P: Single match exe "normal RBro\\\\u" call assert_equal('R-Rc', g:current_modes) + " R_CTRL-X CTRL-P + CTRL-P: Single match exe "normal RBro\\\\\u" call assert_equal('R-Rc', g:current_modes) + " R_CTRL-X CTRL-L: Multiple matches + exe "normal R\\\\u" + call assert_equal('R-Rc', g:current_modes) + " R_CTRL-X CTRL-L: Single match + exe "normal RBlu\\\\u" + call assert_equal('R-Rc', g:current_modes) + " R_CTRL-P: No match exe "normal RCom\\\u" call assert_equal('R-Rc', g:current_modes) + " R_CTRL-X CTRL-P: No match exe "normal RCom\\\\u" call assert_equal('R-Rc', g:current_modes) + " R_CTRL-X CTRL-L: No match + exe "normal Rabc\\\\u" + call assert_equal('R-Rc', g:current_modes) call assert_equal('n', mode(0)) call assert_equal('n', mode(1)) diff --git a/src/nvim/version.c b/src/nvim/version.c index 24ee7ddffc..8d85855c6e 100644 --- a/src/nvim/version.c +++ b/src/nvim/version.c @@ -950,7 +950,7 @@ static const int included_patches[] = { // 309, 308, 307, - // 306, + 306, 305, // 304, // 303,