aboutsummaryrefslogtreecommitdiff
path: root/test/functional/legacy/search_spec.lua
diff options
context:
space:
mode:
Diffstat (limited to 'test/functional/legacy/search_spec.lua')
-rw-r--r--test/functional/legacy/search_spec.lua110
1 files changed, 110 insertions, 0 deletions
diff --git a/test/functional/legacy/search_spec.lua b/test/functional/legacy/search_spec.lua
index 5f71861821..277d8d6c7f 100644
--- a/test/functional/legacy/search_spec.lua
+++ b/test/functional/legacy/search_spec.lua
@@ -6,6 +6,7 @@ local eq = helpers.eq
local eval = helpers.eval
local feed = helpers.feed
local funcs = helpers.funcs
+local wait = helpers.wait
describe('search cmdline', function()
local screen
@@ -471,4 +472,113 @@ describe('search cmdline', function()
coladd = 0, skipcol = 0, curswant = 0},
funcs.winsaveview())
end)
+
+ it("CTRL-G with 'incsearch' and ? goes in the right direction", function()
+ -- oldtest: Test_search_cmdline4().
+ screen:detach()
+ screen = Screen.new(40, 4)
+ screen:attach()
+ screen:set_default_attr_ids({
+ inc = {reverse = true},
+ err = { foreground = Screen.colors.Grey100, background = Screen.colors.Red },
+ more = { bold = true, foreground = Screen.colors.SeaGreen4 },
+ tilde = { bold = true, foreground = Screen.colors.Blue1 },
+ })
+ command('enew!')
+ funcs.setline(1, {' 1 the first', ' 2 the second', ' 3 the third'})
+ command('set laststatus=0 shortmess+=s')
+ command('set incsearch')
+ command('$')
+ -- Send the input in chunks, so the cmdline logic regards it as
+ -- "interactive". This mimics Vim's test_override("char_avail").
+ -- (See legacy test: test_search.vim)
+ feed('?the')
+ wait()
+ feed('<c-g>')
+ wait()
+ feed('<cr>')
+ screen:expect([[
+ 1 the first |
+ 2 the second |
+ 3 ^the third |
+ ?the |
+ ]])
+
+ command('$')
+ feed('?the')
+ wait()
+ feed('<c-g>')
+ wait()
+ feed('<c-g>')
+ wait()
+ feed('<cr>')
+ screen:expect([[
+ 1 ^the first |
+ 2 the second |
+ 3 the third |
+ ?the |
+ ]])
+
+ command('$')
+ feed('?the')
+ wait()
+ feed('<c-g>')
+ wait()
+ feed('<c-g>')
+ wait()
+ feed('<c-g>')
+ wait()
+ feed('<cr>')
+ screen:expect([[
+ 1 the first |
+ 2 ^the second |
+ 3 the third |
+ ?the |
+ ]])
+
+ command('$')
+ feed('?the')
+ wait()
+ feed('<c-t>')
+ wait()
+ feed('<cr>')
+ screen:expect([[
+ 1 ^the first |
+ 2 the second |
+ 3 the third |
+ ?the |
+ ]])
+
+ command('$')
+ feed('?the')
+ wait()
+ feed('<c-t>')
+ wait()
+ feed('<c-t>')
+ wait()
+ feed('<cr>')
+ screen:expect([[
+ 1 the first |
+ 2 the second |
+ 3 ^the third |
+ ?the |
+ ]])
+
+ command('$')
+ feed('?the')
+ wait()
+ feed('<c-t>')
+ wait()
+ feed('<c-t>')
+ wait()
+ feed('<c-t>')
+ wait()
+ feed('<cr>')
+ screen:expect([[
+ 1 the first |
+ 2 ^the second |
+ 3 the third |
+ ?the |
+ ]])
+ end)
end)