diff options
author | zeertzjq <zeertzjq@outlook.com> | 2022-04-20 20:42:55 +0800 |
---|---|---|
committer | zeertzjq <zeertzjq@outlook.com> | 2022-04-21 06:24:11 +0800 |
commit | 81453579745516316067ba8154eb02e1305114fc (patch) | |
tree | e724eda0cf298123b3410d3d96350d845a35d159 /test/functional/ui/searchhl_spec.lua | |
parent | bfd6eb4404d7250d1b59fc24f08a9392fba0c043 (diff) | |
download | rneovim-81453579745516316067ba8154eb02e1305114fc.tar.gz rneovim-81453579745516316067ba8154eb02e1305114fc.tar.bz2 rneovim-81453579745516316067ba8154eb02e1305114fc.zip |
vim-patch:8.2.4724: current instance of last search pattern not easily spotted
Problem: Current instance of last search pattern not easily spotted.
Solution: Add CurSearch highlighting. (closes vim/vim#10133)
https://github.com/vim/vim/commit/a43993897aa372159f682df37562f159994dc85c
This fixes CurSearch highlight for multiline match.
Omit screen redrawing code because Nvim redraws CurSearch differently.
Diffstat (limited to 'test/functional/ui/searchhl_spec.lua')
-rw-r--r-- | test/functional/ui/searchhl_spec.lua | 150 |
1 files changed, 102 insertions, 48 deletions
diff --git a/test/functional/ui/searchhl_spec.lua b/test/functional/ui/searchhl_spec.lua index 068a77a2e4..a08db3e5e7 100644 --- a/test/functional/ui/searchhl_spec.lua +++ b/test/functional/ui/searchhl_spec.lua @@ -109,54 +109,108 @@ describe('search highlighting', function() ]]) end) - it('works for match under cursor', function() - screen:set_default_attr_ids({ - [1] = {background = Screen.colors.Yellow}, - [2] = {foreground = Screen.colors.Gray100, background = Screen.colors.Gray0}, - [3] = {foreground = Screen.colors.Red}, - }) - - command('highlight CurSearch guibg=Black guifg=White') - insert([[ - There is no way that a bee should be - able to fly. Its wings are too small - to get its fat little body off the - ground. The bee, of course, flies - anyway because bees don't care what - humans think is impossible.]]) - - feed('/bee<CR>') - screen:expect{grid=[[ - There is no way that a {2:^bee} should be | - able to fly. Its wings are too small | - to get its fat little body off the | - ground. The {1:bee}, of course, flies | - anyway because {1:bee}s don't care what | - humans think is impossible. | - {3:search hit BOTTOM, continuing at TOP} | - ]]} - - feed('nn') - screen:expect{grid=[[ - There is no way that a {1:bee} should be | - able to fly. Its wings are too small | - to get its fat little body off the | - ground. The {1:bee}, of course, flies | - anyway because {2:^bee}s don't care what | - humans think is impossible. | - /bee | - ]]} - - feed('N') - screen:expect{grid=[[ - There is no way that a {1:bee} should be | - able to fly. Its wings are too small | - to get its fat little body off the | - ground. The {2:^bee}, of course, flies | - anyway because {1:bee}s don't care what | - humans think is impossible. | - ?bee | - ]]} + describe('CurSearch highlight', function() + before_each(function() + screen:set_default_attr_ids({ + [1] = {background = Screen.colors.Yellow}, -- Search + [2] = {foreground = Screen.colors.White, background = Screen.colors.Black}, -- CurSearch + [3] = {foreground = Screen.colors.Red}, -- WarningMsg + }) + command('highlight CurSearch guibg=Black guifg=White') + end) + + it('works for match under cursor', function() + insert([[ + There is no way that a bee should be + able to fly. Its wings are too small + to get its fat little body off the + ground. The bee, of course, flies + anyway because bees don't care what + humans think is impossible.]]) + + feed('/bee<CR>') + screen:expect{grid=[[ + There is no way that a {2:^bee} should be | + able to fly. Its wings are too small | + to get its fat little body off the | + ground. The {1:bee}, of course, flies | + anyway because {1:bee}s don't care what | + humans think is impossible. | + {3:search hit BOTTOM, continuing at TOP} | + ]]} + + feed('nn') + screen:expect{grid=[[ + There is no way that a {1:bee} should be | + able to fly. Its wings are too small | + to get its fat little body off the | + ground. The {1:bee}, of course, flies | + anyway because {2:^bee}s don't care what | + humans think is impossible. | + /bee | + ]]} + + feed('N') + screen:expect{grid=[[ + There is no way that a {1:bee} should be | + able to fly. Its wings are too small | + to get its fat little body off the | + ground. The {2:^bee}, of course, flies | + anyway because {1:bee}s don't care what | + humans think is impossible. | + ?bee | + ]]} + end) + + it('works for multiline match', function() + insert([[ + one + foo + bar + baz + foo + bar]]) + feed('gg/foo<CR>') + screen:expect([[ + one | + {2:^foo} | + bar | + baz | + {1:foo} | + bar | + /foo | + ]]) + feed('n') + screen:expect([[ + one | + {1:foo} | + bar | + baz | + {2:^foo} | + bar | + /foo | + ]]) + feed('?<CR>') + screen:expect([[ + one | + {2:^foo} | + bar | + baz | + {1:foo} | + bar | + ?foo | + ]]) + feed('gg/foo\\nbar<CR>') + screen:expect([[ + one | + {2:^foo} | + {1:bar} | + baz | + {1:foo} | + {1:bar} | + /foo\nbar | + ]]) + end) end) it('highlights after EOL', function() |