From cc484928d5b3402e0d93318df5b7b9b3385f2ee5 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Mon, 14 Sep 2020 01:30:49 -0400 Subject: vim-patch:8.2.0637: incsearch highlighting does not work for ":sort!" Problem: Incsearch highlighting does not work for ":sort!". Solution: Skip over the exclamation point. (closes vim/vim#5983) https://github.com/vim/vim/commit/333015a46e916f566763ec44ae8669c0378767d9 --- src/nvim/ex_getln.c | 5 ++++- src/nvim/testdir/test_search.vim | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/nvim/ex_getln.c b/src/nvim/ex_getln.c index d57239e570..996ccc8e60 100644 --- a/src/nvim/ex_getln.c +++ b/src/nvim/ex_getln.c @@ -339,7 +339,10 @@ static bool do_incsearch_highlighting(int firstc, incsearch_state_T *s, p_magic = false; } } else if (STRNCMP(cmd, "sort", MAX(p - cmd, 3)) == 0) { - // skip over flags. + // skip over ! and flags + if (*p == '!') { + p = skipwhite(p + 1); + } while (ASCII_ISALPHA(*(p = skipwhite(p)))) { p++; } diff --git a/src/nvim/testdir/test_search.vim b/src/nvim/testdir/test_search.vim index aaa60e39c9..211fc73562 100644 --- a/src/nvim/testdir/test_search.vim +++ b/src/nvim/testdir/test_search.vim @@ -743,11 +743,14 @@ func Test_incsearch_sort_dump() " the 'ambiwidth' check. sleep 100m - " Need to send one key at a time to force a redraw. call term_sendkeys(buf, ':sort ni u /on') call VerifyScreenDump(buf, 'Test_incsearch_sort_01', {}) call term_sendkeys(buf, "\") + call term_sendkeys(buf, ':sort! /on') + call VerifyScreenDump(buf, 'Test_incsearch_sort_02', {}) + call term_sendkeys(buf, "\") + call StopVimInTerminal(buf) call delete('Xis_sort_script') endfunc -- cgit