diff options
author | zeertzjq <zeertzjq@outlook.com> | 2024-03-15 05:54:22 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-15 05:54:22 +0800 |
commit | ca7dd33fa783181d62b0573082d2e691fcfc29d2 (patch) | |
tree | f07c323c36cd22d522806a3ea1052f84aff66c59 /test/functional/ui/highlight_spec.lua | |
parent | 4de4f13eb35e40799198689a5ae0bc534b4e38a8 (diff) | |
download | rneovim-ca7dd33fa783181d62b0573082d2e691fcfc29d2.tar.gz rneovim-ca7dd33fa783181d62b0573082d2e691fcfc29d2.tar.bz2 rneovim-ca7dd33fa783181d62b0573082d2e691fcfc29d2.zip |
fix(highlight): don't show CursorColumn on current line (#27848)
Problem:
CursorColumn highlight behavior is inconsistent with 'virtualedit' set:
- If cursor is on the text, CursorColumn is not shown.
- If cursor is after end of line, CursorColumn is shown.
Solution:
Don't shown CursorColumn on current line if cursor is after end of line.
Vim doesn't have this problem because in most cases it uses the code
path for drawing buffer text when CursorColumn highlight is needed.
Diffstat (limited to 'test/functional/ui/highlight_spec.lua')
-rw-r--r-- | test/functional/ui/highlight_spec.lua | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/test/functional/ui/highlight_spec.lua b/test/functional/ui/highlight_spec.lua index 727dc38829..f6d262c6fd 100644 --- a/test/functional/ui/highlight_spec.lua +++ b/test/functional/ui/highlight_spec.lua @@ -1380,6 +1380,8 @@ describe('CursorColumn highlight', function() [1] = { background = Screen.colors.Gray90 }, -- CursorColumn [2] = { bold = true, foreground = Screen.colors.Blue1 }, -- NonText [3] = { bold = true }, -- ModeMsg + [4] = { background = Screen.colors.Red }, + [5] = { background = Screen.colors.Blue }, }) screen:attach() end) @@ -1454,6 +1456,47 @@ describe('CursorColumn highlight', function() ]], }) end) + + it('is not shown on current line with virtualedit', function() + exec([[ + hi! CursorColumn guibg=Red + hi! CursorLine guibg=Blue + set virtualedit=all cursorline cursorcolumn + ]]) + insert('line 1\nline 2\nline 3') + feed('k') + screen:expect([[ + line {4:1} | + {5:line ^2 }| + line {4:3} | + {2:~ }|*4 + | + ]]) + feed('l') + screen:expect([[ + line 1{4: } | + {5:line 2^ }| + line 3{4: } | + {2:~ }|*4 + | + ]]) + feed('l') + screen:expect([[ + line 1 {4: } | + {5:line 2 ^ }| + line 3 {4: } | + {2:~ }|*4 + | + ]]) + feed('l') + screen:expect([[ + line 1 {4: } | + {5:line 2 ^ }| + line 3 {4: } | + {2:~ }|*4 + | + ]]) + end) end) describe('ColorColumn highlight', function() |