aboutsummaryrefslogtreecommitdiff
path: root/test/functional
diff options
context:
space:
mode:
authorIbby <33922797+SleepySwords@users.noreply.github.com>2023-03-27 01:25:37 +1100
committerbfredl <bjorn.linse@gmail.com>2023-05-22 13:49:42 +0200
commitc5bf838f8aa51709f8d7ee81cf2b2a6479c77ad7 (patch)
tree0b5a1a0596bf4d5dda60bd776749950e629af8be /test/functional
parente12b5882af97126a9525a74a0955cc9e0f9114a9 (diff)
downloadrneovim-c5bf838f8aa51709f8d7ee81cf2b2a6479c77ad7.tar.gz
rneovim-c5bf838f8aa51709f8d7ee81cf2b2a6479c77ad7.tar.bz2
rneovim-c5bf838f8aa51709f8d7ee81cf2b2a6479c77ad7.zip
fix(ui): fix visual and search highlighting interfering with virtual text
vim-patch:9.0.0193: search and match highlgith interfere with virtual text Problem: Search and match highlgith interfere with virtual text highlight. (Ben Jackson) Solution: Check for match highlight after text properties. Reset and restore search highlight when showing virtual text. (closes vim/vim#10892) https://github.com/vim/vim/commit/e38fc86180fd3f6b372648eea6adc3f623fea302 vim-patch:9.0.0452: Visual highlighting extends into virtual text prop Problem: Visual highlighting extends into virtual text prop. Solution: Do not highlight what isn't actually selected. Fix ordering of stored text props. https://github.com/vim/vim/commit/6eda17d881c9b2880ccb2a4d11951939a58f233d Co-authored-by: Bram Moolenaar <Bram@vim.org>
Diffstat (limited to 'test/functional')
-rw-r--r--test/functional/ui/decorations_spec.lua92
1 files changed, 91 insertions, 1 deletions
diff --git a/test/functional/ui/decorations_spec.lua b/test/functional/ui/decorations_spec.lua
index 4ed9d5a044..fa492dfcac 100644
--- a/test/functional/ui/decorations_spec.lua
+++ b/test/functional/ui/decorations_spec.lua
@@ -646,6 +646,8 @@ describe('extmark decorations', function()
[26] = {background=Screen.colors.DarkGrey, foreground=Screen.colors.LightGrey};
[27] = {background = Screen.colors.Plum1};
[28] = {foreground = Screen.colors.SlateBlue};
+ [29] = {background = Screen.colors.Yellow1};
+ [30] = {reverse = true};
}
ns = meths.create_namespace 'test'
@@ -1582,7 +1584,7 @@ bbbbbbb]])
]]}
end)
- it('has correct cursor position with virtual text on an empty line', function()
+ it('cursor position is correct with virtual text on an empty line', function()
command('set linebreak')
insert('one twoword')
feed('0')
@@ -1606,6 +1608,94 @@ bbbbbbb]])
|
]]}
end)
+
+ it('search highlight is correct with virtual text attatched to', function()
+ insert('foo foo foo foo')
+ feed('0')
+ meths.buf_set_extmark(0, ns, 0, 8,
+ { virt_text = { { 'virtual text', 'Special' } }, virt_text_pos = 'inline' })
+ screen:expect { grid = [[
+ ^foo foo {28:virtual text}foo foo |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ |
+ ]]}
+
+ feed('/foo')
+ screen:expect { grid = [[
+ {29:foo} {30:foo} {28:virtual text}{29:foo} {29:foo} |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ /foo^ |
+ ]]}
+ end)
+
+ it('visual select highlight is correct with virtual text attatched to', function()
+ insert('foo foo foo foo')
+ feed('0')
+ meths.buf_set_extmark(0, ns, 0, 8,
+ { virt_text = { { 'virtual text', 'Special' } }, virt_text_pos = 'inline' })
+ feed('8l')
+ screen:expect { grid = [[
+ foo foo {28:virtual text}^foo foo |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ |
+ ]]}
+
+ feed('v')
+ feed('2h')
+ screen:expect { grid = [[
+ foo fo^o{18: }{28:virtual text}{18:f}oo foo |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {24:-- VISUAL --} |
+ ]]}
+ end)
end)
describe('decorations: virtual lines', function()