aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2022-05-10 08:54:37 +0800
committerGitHub <noreply@github.com>2022-05-10 08:54:37 +0800
commit5359be78935dc639c481d74f010fe133dd40290c (patch)
tree84c02f5a532d200cfa6b122b70ef625bc5c99068 /test
parent9aa5647e686e5420e5b9b51828ec7d55631f98ed (diff)
parent65df08aade7eac9fab51058924af89a60351f4bf (diff)
downloadrneovim-5359be78935dc639c481d74f010fe133dd40290c.tar.gz
rneovim-5359be78935dc639c481d74f010fe133dd40290c.tar.bz2
rneovim-5359be78935dc639c481d74f010fe133dd40290c.zip
Merge pull request #18509 from zeertzjq/vim-8.2.4929
vim-patch:8.2.4929: off-by-one error in in statusline item
Diffstat (limited to 'test')
-rw-r--r--test/functional/legacy/statusline_spec.lua71
1 files changed, 71 insertions, 0 deletions
diff --git a/test/functional/legacy/statusline_spec.lua b/test/functional/legacy/statusline_spec.lua
new file mode 100644
index 0000000000..5eb46077ec
--- /dev/null
+++ b/test/functional/legacy/statusline_spec.lua
@@ -0,0 +1,71 @@
+local helpers = require('test.functional.helpers')(after_each)
+local Screen = require('test.functional.ui.screen')
+local clear = helpers.clear
+local exec = helpers.exec
+local feed = helpers.feed
+
+before_each(clear)
+
+describe('statusline', function()
+ local screen
+
+ before_each(function()
+ screen = Screen.new(50, 7)
+ screen:attach()
+ end)
+
+ it('is updated in cmdline mode when using window-local statusline vim-patch:8.2.2737', function()
+ screen:set_default_attr_ids({
+ [1] = {bold = true, foreground = Screen.colors.Blue}, -- NonText
+ [2] = {bold = true, reverse = true}, -- StatusLine
+ [3] = {reverse = true}, -- StatusLineNC, VertSplit
+ })
+ exec([[
+ setlocal statusline=-%{mode()}-
+ split
+ setlocal statusline=+%{mode()}+
+ ]])
+ screen:expect([[
+ ^ |
+ {1:~ }|
+ {2:+n+ }|
+ |
+ {1:~ }|
+ {3:-n- }|
+ |
+ ]])
+ feed(':')
+ screen:expect([[
+ |
+ {1:~ }|
+ {2:+c+ }|
+ |
+ {1:~ }|
+ {3:-c- }|
+ :^ |
+ ]])
+ end)
+
+ it('truncated item does not cause off-by-one highlight vim-patch:8.2.4929', function()
+ screen:set_default_attr_ids({
+ [1] = {bold = true, foreground = Screen.colors.Blue}, -- NonText
+ [2] = {foreground = Screen.colors.Blue}, -- User1
+ [3] = {background = Screen.colors.Red, foreground = Screen.colors.White}, -- User2
+ })
+ exec([[
+ set laststatus=2
+ hi! link User1 Directory
+ hi! link User2 ErrorMsg
+ set statusline=%.5(%1*ABC%2*DEF%1*GHI%)
+ ]])
+ screen:expect([[
+ ^ |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {3:<F}{2:GHI }|
+ |
+ ]])
+ end)
+end)