diff options
author | zeertzjq <zeertzjq@outlook.com> | 2022-09-13 22:08:01 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-13 22:08:01 +0800 |
commit | f19e91acd8b90eaddaaa6070db260acf8de9aa10 (patch) | |
tree | 2e604d008e3e15955a559cce07e6d8550979d2ab /test | |
parent | ec1f153ddc58e38bf21e2a47b9621feb63fd0e51 (diff) | |
download | rneovim-f19e91acd8b90eaddaaa6070db260acf8de9aa10.tar.gz rneovim-f19e91acd8b90eaddaaa6070db260acf8de9aa10.tar.bz2 rneovim-f19e91acd8b90eaddaaa6070db260acf8de9aa10.zip |
vim-patch:9.0.0457: substitute prompt does not highlight an empty match (#20186)
Problem: Substitute prompt does not highlight an empty match.
Solution: Highlight at least one character.
https://github.com/vim/vim/commit/a04f457a6c071179bac4088c9314007d39d5c5e0
Diffstat (limited to 'test')
-rw-r--r-- | test/functional/legacy/substitute_spec.lua (renamed from test/functional/legacy/080_substitute_spec.lua) | 31 |
1 files changed, 29 insertions, 2 deletions
diff --git a/test/functional/legacy/080_substitute_spec.lua b/test/functional/legacy/substitute_spec.lua index faeb61e3af..f3ce343680 100644 --- a/test/functional/legacy/080_substitute_spec.lua +++ b/test/functional/legacy/substitute_spec.lua @@ -3,11 +3,13 @@ -- Test for *:s%* on :substitute. local helpers = require('test.functional.helpers')(after_each) +local Screen = require('test.functional.ui.screen') local feed, insert = helpers.feed, helpers.insert +local exec = helpers.exec local clear, feed_command, expect = helpers.clear, helpers.feed_command, helpers.expect local eq, eval = helpers.eq, helpers.eval -describe('substitue()', function() +describe('substitute()', function() before_each(clear) -- The original test contained several TEST_X lines to delimit different @@ -132,7 +134,7 @@ describe('substitue()', function() end) end) -describe(':substitue', function() +describe(':substitute', function() before_each(clear) it('with \\ze and \\zs and confirmation dialog (TEST_8)', function() @@ -159,4 +161,29 @@ describe(':substitue', function() feed('yyq') -- For the dialog of the previous :s command. expect('XXx') end) + + it('first char is highlighted with confirmation dialog and empty match', function() + local screen = Screen.new(60, 8) + screen:set_default_attr_ids({ + [0] = {bold = true, foreground = Screen.colors.Blue}, -- NonText + [1] = {reverse = true}, -- IncSearch + [2] = {bold = true, foreground = Screen.colors.SeaGreen}, -- MoreMsg + }) + screen:attach() + exec([[ + set nohlsearch noincsearch + call setline(1, ['one', 'two', 'three']) + ]]) + feed(':%s/^/ /c<CR>') + screen:expect([[ + {1:o}ne | + two | + three | + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + {2:replace with (y/n/a/q/l/^E/^Y)?}^ | + ]]) + end) end) |