From 6e6544d645f9a9c151a2e027e23d8f79ecd8f7c9 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Mon, 30 Dec 2019 16:24:21 -0500 Subject: [PATCH 1/4] vim-patch:8.1.1739: deleted match highlighting not updated in other window Problem: Deleted match highlighting not updated in other window. Solution: Mark the window for refresh. (closes vim/vim#4720) Also fix that ambi-width check clears with wrong attributes. https://github.com/vim/vim/commit/06029a857a3d4d90b3162090506c1e00dc84c60b --- src/nvim/testdir/test_match.vim | 24 ++++++++++++++++++++++++ src/nvim/window.c | 2 +- 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/src/nvim/testdir/test_match.vim b/src/nvim/testdir/test_match.vim index 90dfcf952d..921c3e3c55 100644 --- a/src/nvim/testdir/test_match.vim +++ b/src/nvim/testdir/test_match.vim @@ -1,6 +1,8 @@ " Test for :match, :2match, :3match, clearmatches(), getmatches(), matchadd(), " matchaddpos(), matcharg(), matchdelete(), and setmatches(). +source screendump.vim + function Test_match() highlight MyGroup1 term=bold ctermbg=red guibg=red highlight MyGroup2 term=italic ctermbg=green guibg=green @@ -248,4 +250,26 @@ func Test_matchaddpos_using_negative_priority() set hlsearch& endfunc +func Test_matchdelete_other_window() + if !CanRunVimInTerminal() + throw 'Skipped: cannot make screendumps' + endif + + let lines =<< trim END + call setline(1, 'Hello Vim world') + let mid = matchadd('Error', 'world', 1) + let winid = win_getid() + new + END + call writefile(lines, 'XscriptMatchDelete') + let buf = RunVimInTerminal('-S XscriptMatchDelete', #{rows: 12}) + call term_wait(buf) + call term_sendkeys(buf, ":call matchdelete(mid, winid)\") + call VerifyScreenDump(buf, 'Test_matchdelete_1', {}) + + call StopVimInTerminal(buf) + call delete('XscriptMatchDelete') +endfunc + + " vim: shiftwidth=2 sts=2 expandtab diff --git a/src/nvim/window.c b/src/nvim/window.c index af78c89618..5d4332c75a 100644 --- a/src/nvim/window.c +++ b/src/nvim/window.c @@ -6680,7 +6680,7 @@ int match_delete(win_T *wp, int id, int perr) rtype = VALID; } xfree(cur); - redraw_later(rtype); + redraw_win_later(wp, rtype); return 0; } From 0e7baed2195fec8e99df69112e464791c02b2555 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Mon, 30 Dec 2019 16:27:26 -0500 Subject: [PATCH 2/4] vim-patch:8.1.1741: cleared/added match highlighting not updated in other window Problem: Cleared/added match highlighting not updated in other window. (Andi Massimino) Solution: Mark the right window for refresh. https://github.com/vim/vim/commit/4ef18dcc2e3a6a9aea2dc90bbdb742c3c9231394 --- src/nvim/testdir/test_match.vim | 45 +++++++++++++++++++++++++++------ src/nvim/window.c | 4 +-- 2 files changed, 39 insertions(+), 10 deletions(-) diff --git a/src/nvim/testdir/test_match.vim b/src/nvim/testdir/test_match.vim index 921c3e3c55..c134cfb1c0 100644 --- a/src/nvim/testdir/test_match.vim +++ b/src/nvim/testdir/test_match.vim @@ -250,25 +250,54 @@ func Test_matchaddpos_using_negative_priority() set hlsearch& endfunc -func Test_matchdelete_other_window() - if !CanRunVimInTerminal() - throw 'Skipped: cannot make screendumps' - endif - +func OtherWindowCommon() let lines =<< trim END call setline(1, 'Hello Vim world') let mid = matchadd('Error', 'world', 1) let winid = win_getid() new END - call writefile(lines, 'XscriptMatchDelete') - let buf = RunVimInTerminal('-S XscriptMatchDelete', #{rows: 12}) + call writefile(lines, 'XscriptMatchCommon') + let buf = RunVimInTerminal('-S XscriptMatchCommon', #{rows: 12}) call term_wait(buf) + return buf +endfunc + +func Test_matchdelete_other_window() + if !CanRunVimInTerminal() + throw 'Skipped: cannot make screendumps' + endif + let buf = OtherWindowCommon() call term_sendkeys(buf, ":call matchdelete(mid, winid)\") call VerifyScreenDump(buf, 'Test_matchdelete_1', {}) call StopVimInTerminal(buf) - call delete('XscriptMatchDelete') + call delete('XscriptMatchCommon') +endfunc + +func Test_matchclear_other_window() + if !CanRunVimInTerminal() + throw 'Skipped: cannot make screendumps' + endif + let buf = OtherWindowCommon() + call term_sendkeys(buf, ":call clearmatches(winid)\") + call VerifyScreenDump(buf, 'Test_matchclear_1', {}) + + call StopVimInTerminal(buf) + call delete('XscriptMatchCommon') +endfunc + +func Test_matchadd_other_window() + if !CanRunVimInTerminal() + throw 'Skipped: cannot make screendumps' + endif + let buf = OtherWindowCommon() + call term_sendkeys(buf, ":call matchadd('Search', 'Hello', 1, -1, #{window: winid})\") + call term_sendkeys(buf, ":\") + call VerifyScreenDump(buf, 'Test_matchadd_1', {}) + + call StopVimInTerminal(buf) + call delete('XscriptMatchCommon') endfunc diff --git a/src/nvim/window.c b/src/nvim/window.c index 5d4332c75a..79d7a8acba 100644 --- a/src/nvim/window.c +++ b/src/nvim/window.c @@ -6622,7 +6622,7 @@ int match_add(win_T *wp, const char *const grp, const char *const pat, prev->next = m; m->next = cur; - redraw_later(rtype); + redraw_win_later(wp, rtype); return id; fail: @@ -6698,7 +6698,7 @@ void clear_matches(win_T *wp) xfree(wp->w_match_head); wp->w_match_head = m; } - redraw_later(SOME_VALID); + redraw_win_later(wp, SOME_VALID); } /* From eeabd3a8c6e904bf3e01017b60336c0063356943 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Mon, 30 Dec 2019 16:55:46 -0500 Subject: [PATCH 3/4] vim-patch:8.2.0063: wrong size argument to vim_snprintf() Problem: Wrong size argument to vim_snprintf(). (Dominique Pelle) Solution: Reduce the size by the length. (related to vim/vim#5410) https://github.com/vim/vim/commit/08b28b7ad52d5ee3cb5fa5982b647e325a410484 --- src/nvim/ops.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/nvim/ops.c b/src/nvim/ops.c index b597c5b214..6a621cdaa6 100644 --- a/src/nvim/ops.c +++ b/src/nvim/ops.c @@ -5654,7 +5654,8 @@ void cursor_pos_info(dict_T *dict) bom_count = bomb_size(); if (dict == NULL && bom_count > 0) { - vim_snprintf((char *)IObuff + STRLEN(IObuff), IOSIZE - STRLEN(IObuff), + const size_t len = STRLEN(IObuff); + vim_snprintf((char *)IObuff + len, IOSIZE - len, _("(+%" PRId64 " for BOM)"), (int64_t)bom_count); } if (dict == NULL) { From 4bd51d8988b0af76a8c9e8cb38c537fc53346c20 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Mon, 30 Dec 2019 18:47:49 -0500 Subject: [PATCH 4/4] CI: set nodejs version to 10 on main scripts nvm can run within a bash shell only. --- ci/install.sh | 2 ++ ci/run_tests.sh | 2 ++ 2 files changed, 4 insertions(+) diff --git a/ci/install.sh b/ci/install.sh index a6cd955da5..3364edfe70 100755 --- a/ci/install.sh +++ b/ci/install.sh @@ -22,6 +22,8 @@ echo "Install neovim RubyGem." gem install --no-document --version ">= 0.8.0" neovim echo "Install neovim npm package" +source ~/.nvm/nvm.sh +nvm use 10 npm install -g neovim npm link neovim diff --git a/ci/run_tests.sh b/ci/run_tests.sh index 6b2f69293c..844e9559ef 100755 --- a/ci/run_tests.sh +++ b/ci/run_tests.sh @@ -19,6 +19,8 @@ exit_suite --continue enter_suite tests +source ~/.nvm/nvm.sh +nvm use 10 export TREE_SITTER_DIR=$HOME/tree-sitter-build/ if test "$CLANG_SANITIZER" != "TSAN" ; then