From 9437800d280385c018a99aa0fbe9043e4d7715aa Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sat, 11 Feb 2023 18:44:06 +0800 Subject: vim-patch:9.0.1298: inserting register on the cmdline does not trigger incsearch Problem: Inserting a register on the command line does not trigger incsearch or update hlsearch. Solution: Have cmdline_insert_reg() return CMDLINE_CHANGED when appropriate and handle it correctly. (Ken Takata, closes vim/vim#11960) https://github.com/vim/vim/commit/c4b7dec38292fe1cfad7aa5f244031fc6f7c7a09 Co-authored-by: K.Takata --- test/functional/ui/searchhl_spec.lua | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) (limited to 'test/functional/ui/searchhl_spec.lua') diff --git a/test/functional/ui/searchhl_spec.lua b/test/functional/ui/searchhl_spec.lua index 18bbb56a61..404cc6d043 100644 --- a/test/functional/ui/searchhl_spec.lua +++ b/test/functional/ui/searchhl_spec.lua @@ -10,7 +10,6 @@ local testprg = helpers.testprg describe('search highlighting', function() local screen - local colors = Screen.colors before_each(function() clear() @@ -18,9 +17,9 @@ describe('search highlighting', function() screen:attach() screen:set_default_attr_ids( { [1] = {bold=true, foreground=Screen.colors.Blue}, - [2] = {background = colors.Yellow}, -- Search + [2] = {background = Screen.colors.Yellow}, -- Search [3] = {reverse = true}, - [4] = {foreground = colors.Red}, -- Message + [4] = {foreground = Screen.colors.Red}, -- Message [6] = {foreground = Screen.colors.Blue4, background = Screen.colors.LightGrey}, -- Folded }) end) @@ -498,6 +497,20 @@ describe('search highlighting', function() {1:~ }│{1:~ }| //^ | ]]) + feed('') + + -- incsearch works after c_CTRL-R_CTRL-R + command('let @" = "file"') + feed('/"') + screen:expect([[ + the first line │the first line | + in a little {3:file} │in a little {2:file} | + {1:~ }│{1:~ }| + {1:~ }│{1:~ }| + {1:~ }│{1:~ }| + {1:~ }│{1:~ }| + /file^ | + ]]) end) it('works with incsearch and offset', function() @@ -572,12 +585,12 @@ describe('search highlighting', function() it('works with matchadd and syntax', function() screen:set_default_attr_ids { [1] = {bold=true, foreground=Screen.colors.Blue}; - [2] = {background = colors.Yellow}; + [2] = {background = Screen.colors.Yellow}; [3] = {reverse = true}; - [4] = {foreground = colors.Red}; - [5] = {bold = true, background = colors.Green}; - [6] = {italic = true, background = colors.Magenta}; - [7] = {bold = true, background = colors.Yellow}; + [4] = {foreground = Screen.colors.Red}; + [5] = {bold = true, background = Screen.colors.Green}; + [6] = {italic = true, background = Screen.colors.Magenta}; + [7] = {bold = true, background = Screen.colors.Yellow}; [8] = {foreground = Screen.colors.Blue4, background = Screen.colors.LightGray}; } feed_command('set hlsearch') -- cgit From 05faa8f30ad770d4e4ead41cec601ccced8fb97f Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Wed, 15 Feb 2023 07:26:55 +0800 Subject: test: make expect_unchanged() less confusing (#22255) Problem: The sleep before collecting the initial screen state is confusing and may lead to unexpected success if it comes after a blocking RPC call. Solution: Remove that sleep and add an "intermediate" argument. --- test/functional/ui/searchhl_spec.lua | 1 + 1 file changed, 1 insertion(+) (limited to 'test/functional/ui/searchhl_spec.lua') diff --git a/test/functional/ui/searchhl_spec.lua b/test/functional/ui/searchhl_spec.lua index 404cc6d043..916a5eb537 100644 --- a/test/functional/ui/searchhl_spec.lua +++ b/test/functional/ui/searchhl_spec.lua @@ -317,6 +317,7 @@ describe('search highlighting', function() ]]) feed('/foo') helpers.poke_eventloop() + screen:sleep(0) screen:expect_unchanged() end) -- cgit From fd2ece278b0941ec6673489e88868120e86b834a Mon Sep 17 00:00:00 2001 From: Matthias Deiml Date: Sun, 12 Mar 2023 23:58:46 +0100 Subject: feat(ui): add scroll_delta to win_viewport event #19270 scroll_delta contains how much the top line of a window moved since the last time win_viewport was emitted. It is expected to be used to implement smooth scrolling. For this purpose it only counts "virtual" or "displayed" so folds should count as one line. Because of this it adds extra information that cannot be computed from the topline parameter. Fixes #19227 --- test/functional/ui/searchhl_spec.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'test/functional/ui/searchhl_spec.lua') diff --git a/test/functional/ui/searchhl_spec.lua b/test/functional/ui/searchhl_spec.lua index 916a5eb537..3c8dceb8cb 100644 --- a/test/functional/ui/searchhl_spec.lua +++ b/test/functional/ui/searchhl_spec.lua @@ -52,7 +52,7 @@ describe('search highlighting', function() {1:~ }| /text^ | ]], win_viewport={ - [2] = {win = {id = 1000}, topline = 0, botline = 3, curline = 0, curcol = 9, linecount = 2}; + [2] = {win = {id = 1000}, topline = 0, botline = 3, curline = 0, curcol = 9, linecount = 2, sum_scroll_delta = 0}; }} end) @@ -616,7 +616,7 @@ describe('search highlighting', function() {1:~ }| {4:search hit BOTTOM, continuing at TOP} | ]], win_viewport={ - [2] = {win = {id = 1000}, topline = 0, botline = 3, curline = 0, curcol = 11, linecount = 2}; + [2] = {win = {id = 1000}, topline = 0, botline = 3, curline = 0, curcol = 11, linecount = 2, sum_scroll_delta = 0}; }} -- check highlights work also in folds -- cgit From 55f6a1cab031ecc28c5a7f2558a0cac9df2145e1 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Tue, 30 May 2023 07:18:12 +0800 Subject: vim-patch:9.0.1588: Incsearch not triggered when pasting clipboard register (#23817) Problem: Incsearch not triggered when pasting clipboard register on the command line. Solution: Also set "literally" when using a clipboard register. (Ken Takata, closes vim/vim#12460) https://github.com/vim/vim/commit/9cf6ab133227ac7e9169941752293bb7178d8e38 Co-authored-by: K.Takata --- test/functional/ui/searchhl_spec.lua | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'test/functional/ui/searchhl_spec.lua') diff --git a/test/functional/ui/searchhl_spec.lua b/test/functional/ui/searchhl_spec.lua index 3c8dceb8cb..1e42689200 100644 --- a/test/functional/ui/searchhl_spec.lua +++ b/test/functional/ui/searchhl_spec.lua @@ -512,6 +512,36 @@ describe('search highlighting', function() {1:~ }│{1:~ }| /file^ | ]]) + feed('') + + command('set rtp^=test/functional/fixtures') + -- incsearch works after c_CTRL-R inserts clipboard register + + command('let @* = "first"') + feed('/*') + screen:expect([[ + the {3:first} line │the {2:first} line | + in a little file │in a little file | + {1:~ }│{1:~ }| + {1:~ }│{1:~ }| + {1:~ }│{1:~ }| + {1:~ }│{1:~ }| + /first^ | + ]]) + feed('') + + command('let @+ = "little"') + feed('/+') + screen:expect([[ + the first line │the first line | + in a {3:little} file │in a {2:little} file | + {1:~ }│{1:~ }| + {1:~ }│{1:~ }| + {1:~ }│{1:~ }| + {1:~ }│{1:~ }| + /little^ | + ]]) + feed('') end) it('works with incsearch and offset', function() -- cgit From 59289fb987bd51b072f91ae0de8ee8515bf07e21 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sun, 23 Jul 2023 21:36:32 +0800 Subject: fix(highlight): make CurSearch work properly with 'winhl' (#24448) --- test/functional/ui/searchhl_spec.lua | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) (limited to 'test/functional/ui/searchhl_spec.lua') diff --git a/test/functional/ui/searchhl_spec.lua b/test/functional/ui/searchhl_spec.lua index 1e42689200..ec1ebbe4ca 100644 --- a/test/functional/ui/searchhl_spec.lua +++ b/test/functional/ui/searchhl_spec.lua @@ -56,7 +56,7 @@ describe('search highlighting', function() }} end) - it('works', function() + local function test_search_hl() insert([[ some text more textstuff @@ -109,6 +109,26 @@ describe('search highlighting', function() {1:~ }| :nohlsearch | ]]) + end + + it("works when 'winhighlight' is not set", function() + test_search_hl() + end) + + it("works when 'winhighlight' doesn't change Search highlight", function() + command('setlocal winhl=NonText:Underlined') + local attrs = screen:get_default_attr_ids() + attrs[1] = {foreground = Screen.colors.SlateBlue, underline = true} + screen:set_default_attr_ids(attrs) + test_search_hl() + end) + + it("works when 'winhighlight' changes Search highlight", function() + command('setlocal winhl=Search:Underlined') + local attrs = screen:get_default_attr_ids() + attrs[2] = {foreground = Screen.colors.SlateBlue, underline = true} + screen:set_default_attr_ids(attrs) + test_search_hl() end) describe('CurSearch highlight', function() -- cgit From b84a67f50ed6141f72d433094a1a611ae4f67924 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Tue, 22 Aug 2023 22:48:55 +0800 Subject: vim-patch:9.0.0579: using freed memory when 'tagfunc' wipes out buffer (#24838) Problem: Using freed memory when 'tagfunc' wipes out buffer that holds 'complete'. Solution: Make a copy of the option. Make sure cursor position is valid. https://github.com/vim/vim/commit/0ff01835a40f549c5c4a550502f62a2ac9ac447c Cherry-pick a cmdwin change from patch 9.0.0500. Co-authored-by: Bram Moolenaar --- test/functional/ui/searchhl_spec.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test/functional/ui/searchhl_spec.lua') diff --git a/test/functional/ui/searchhl_spec.lua b/test/functional/ui/searchhl_spec.lua index ec1ebbe4ca..7fd66d6f8a 100644 --- a/test/functional/ui/searchhl_spec.lua +++ b/test/functional/ui/searchhl_spec.lua @@ -52,7 +52,7 @@ describe('search highlighting', function() {1:~ }| /text^ | ]], win_viewport={ - [2] = {win = {id = 1000}, topline = 0, botline = 3, curline = 0, curcol = 9, linecount = 2, sum_scroll_delta = 0}; + [2] = {win = {id = 1000}, topline = 0, botline = 3, curline = 0, curcol = 8, linecount = 2, sum_scroll_delta = 0}; }} end) -- cgit From bf70a33f5e7de0218704126c149db24542e39766 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sat, 14 Oct 2023 09:58:30 +0800 Subject: vim-patch:8.1.0822: peeking and flushing output slows down execution (#25629) Problem: Peeking and flushing output slows down execution. Solution: Do not update the mode message when global_busy is set. Do not flush when only peeking for a character. (Ken Takata) https://github.com/vim/vim/commit/cb574f415486adff645ce384979bfecf27f5be8c --- test/functional/ui/searchhl_spec.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test/functional/ui/searchhl_spec.lua') diff --git a/test/functional/ui/searchhl_spec.lua b/test/functional/ui/searchhl_spec.lua index 7fd66d6f8a..eb7a2574f3 100644 --- a/test/functional/ui/searchhl_spec.lua +++ b/test/functional/ui/searchhl_spec.lua @@ -337,7 +337,7 @@ describe('search highlighting', function() ]]) feed('/foo') helpers.poke_eventloop() - screen:sleep(0) + screen:sleep(100) screen:expect_unchanged() end) -- cgit From ce0f80835a5f6febd64f4ce5cf245d476ebaecfd Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sat, 14 Oct 2023 13:53:52 +0800 Subject: test(ui/searchhl_spec): match more in :terminal test (#25631) --- test/functional/ui/searchhl_spec.lua | 29 ++++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-) (limited to 'test/functional/ui/searchhl_spec.lua') diff --git a/test/functional/ui/searchhl_spec.lua b/test/functional/ui/searchhl_spec.lua index eb7a2574f3..dc7ef666bd 100644 --- a/test/functional/ui/searchhl_spec.lua +++ b/test/functional/ui/searchhl_spec.lua @@ -19,7 +19,8 @@ describe('search highlighting', function() [1] = {bold=true, foreground=Screen.colors.Blue}, [2] = {background = Screen.colors.Yellow}, -- Search [3] = {reverse = true}, - [4] = {foreground = Screen.colors.Red}, -- Message + [4] = {foreground = Screen.colors.Red}, -- WarningMsg + [5] = {bold = true, reverse = true}, -- StatusLine [6] = {foreground = Screen.colors.Blue4, background = Screen.colors.LightGrey}, -- Folded }) end) @@ -326,19 +327,33 @@ describe('search highlighting', function() it('is preserved during :terminal activity', function() feed((':terminal "%s" REP 5000 foo'):format(testprg('shell-test'))) - feed(':file term') + screen:expect([[ + ^0: foo | + 1: foo | + 2: foo | + 3: foo | + 4: foo | + 5: foo | + :file term | + ]]) + feed('G') -- Follow :terminal output. feed(':vnew') insert([[ foo bar baz bar baz foo - bar foo baz - ]]) + bar foo baz]]) feed('/foo') - helpers.poke_eventloop() - screen:sleep(100) - screen:expect_unchanged() + screen:expect([[ + {3:foo} bar baz │{MATCH:%d+}: {2:foo}{MATCH:%s+}| + bar baz {2:foo} │{MATCH:%d+}: {2:foo}{MATCH:%s+}| + bar {2:foo} baz │{MATCH:%d+}: {2:foo}{MATCH:%s+}| + {1:~ }│{MATCH:.*}| + {1:~ }│{MATCH:.*}| + {5:[No Name] [+] }{3:term }| + /foo^ | + ]]) end) it('works with incsearch', function() -- cgit