aboutsummaryrefslogtreecommitdiff
path: root/test/functional/ui
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2018-02-01 23:25:55 +0100
committerJustin M. Keyes <justinkz@gmail.com>2018-02-01 23:25:55 +0100
commit709a87d194971f187442caa2e551c781aba38d50 (patch)
treec7fc053abd52b0d4de1e93577557546555c1a488 /test/functional/ui
parent6710164c2c44335a916a728cc8eb329c69d155f4 (diff)
parent87e03c2b85cef0b31eee5aab5078cd6457dd3c9b (diff)
downloadrneovim-709a87d194971f187442caa2e551c781aba38d50.tar.gz
rneovim-709a87d194971f187442caa2e551c781aba38d50.tar.bz2
rneovim-709a87d194971f187442caa2e551c781aba38d50.zip
Merge #7463 'incsearch + hlsearch highlight all'
Diffstat (limited to 'test/functional/ui')
-rw-r--r--test/functional/ui/searchhl_spec.lua129
1 files changed, 124 insertions, 5 deletions
diff --git a/test/functional/ui/searchhl_spec.lua b/test/functional/ui/searchhl_spec.lua
index 5af8b83a36..9f273e8dc9 100644
--- a/test/functional/ui/searchhl_spec.lua
+++ b/test/functional/ui/searchhl_spec.lua
@@ -2,6 +2,8 @@ local helpers = require('test.functional.helpers')(after_each)
local Screen = require('test.functional.ui.screen')
local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert
local feed_command = helpers.feed_command
+local eq = helpers.eq
+local eval = helpers.eval
describe('search highlighting', function()
local screen
@@ -99,7 +101,30 @@ describe('search highlighting', function()
feed("gg/li")
screen:expect([[
the first {3:li}ne |
- in a little file |
+ in a {2:li}ttle file |
+ |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ /li^ |
+ ]])
+
+ -- check that consecutive matches are caught by C-g/C-t
+ feed("<C-g>")
+ screen:expect([[
+ the first {2:li}ne |
+ in a {3:li}ttle file |
+ |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ /li^ |
+ ]])
+
+ feed("<C-t>")
+ screen:expect([[
+ the first {3:li}ne |
+ in a {2:li}ttle file |
|
{1:~ }|
{1:~ }|
@@ -132,7 +157,7 @@ describe('search highlighting', function()
feed("/fir")
screen:expect([[
the {3:fir}st line |
- in a {2:lit}tle file |
+ in a little file |
|
{1:~ }|
{1:~ }|
@@ -144,13 +169,107 @@ describe('search highlighting', function()
feed("<esc>/ttle")
screen:expect([[
the first line |
- in a {2:li}{3:ttle} file |
+ in a li{3:ttle} file |
|
{1:~ }|
{1:~ }|
{1:~ }|
/ttle^ |
]])
+
+ -- cancelling search resets to the old search term
+ feed('<esc>')
+ screen:expect([[
+ the first line |
+ in a {2:^lit}tle file |
+ |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ |
+ ]])
+ eq('lit', eval('@/'))
+
+ -- cancelling inc search restores the hl state
+ feed(':noh<cr>')
+ screen:expect([[
+ the first line |
+ in a ^little file |
+ |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ :noh |
+ ]])
+
+ feed('/first')
+ screen:expect([[
+ the {3:first} line |
+ in a little file |
+ |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ /first^ |
+ ]])
+ feed('<esc>')
+ screen:expect([[
+ the first line |
+ in a ^little file |
+ |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ |
+ ]])
+
+ -- test that pressing C-g in an empty command line does not move the cursor
+ feed('/<C-g>')
+ screen:expect([[
+ the first line |
+ in a little file |
+ |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ /^ |
+ ]])
+
+ -- same, for C-t
+ feed('<ESC>/<C-t>')
+ screen:expect([[
+ the first line |
+ in a little file |
+ |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ /^ |
+ ]])
+
+ -- 8.0.1304, test that C-g and C-t works with incsearch and empty pattern
+ feed('<esc>/fi<CR>')
+ feed('//')
+ screen:expect([[
+ the {3:fi}rst line |
+ in a little {2:fi}le |
+ |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ //^ |
+ ]])
+
+ feed('<C-g>')
+ screen:expect([[
+ the {2:fi}rst line |
+ in a little {3:fi}le |
+ |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ //^ |
+ ]])
end)
it('works with incsearch and offset', function()
@@ -163,7 +282,7 @@ describe('search highlighting', function()
feed("gg/mat/e")
screen:expect([[
not the {3:mat}ch you're looking for |
- the match is here |
+ the {2:mat}ch is here |
{1:~ }|
{1:~ }|
{1:~ }|
@@ -174,7 +293,7 @@ describe('search highlighting', function()
-- Search with count and /e offset fixed in Vim patch 7.4.532.
feed("<esc>2/mat/e")
screen:expect([[
- not the match you're looking for |
+ not the {2:mat}ch you're looking for |
the {3:mat}ch is here |
{1:~ }|
{1:~ }|