aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorluukvbaal <luukvbaal@gmail.com>2025-03-15 16:18:23 +0100
committerGitHub <noreply@github.com>2025-03-15 08:18:23 -0700
commit19fc65acbc670869781fb4148176b8abd94fba29 (patch)
treefd481ac73e6332d1113da11a89269fc32f24e613 /test
parentf8d5811c717bbfa7b7d078211f4a5468eb0ff088 (diff)
downloadrneovim-19fc65acbc670869781fb4148176b8abd94fba29.tar.gz
rneovim-19fc65acbc670869781fb4148176b8abd94fba29.tar.bz2
rneovim-19fc65acbc670869781fb4148176b8abd94fba29.zip
fix(statuscolumn): misleading v:lnum for virtual lines #32912
Problem: Virtual 'statuscolumn' lines are evaluated with a misleading v:(rel)num. Namely set to the line above for `virt_lines_above = true` lines, or even the last drawn line for a partial redraw. Solution: Set `v:lnum` for the first evaluated row of a line, first above virtual line of a row and first non-virtual line of a row.
Diffstat (limited to 'test')
-rw-r--r--test/functional/ui/statuscolumn_spec.lua24
1 files changed, 20 insertions, 4 deletions
diff --git a/test/functional/ui/statuscolumn_spec.lua b/test/functional/ui/statuscolumn_spec.lua
index 6c415b3dfa..2004606b63 100644
--- a/test/functional/ui/statuscolumn_spec.lua
+++ b/test/functional/ui/statuscolumn_spec.lua
@@ -500,7 +500,7 @@ describe('statuscolumn', function()
{8:buffer 0 5}aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
{8:wrapped 1 5}aaaaaaaa |
{8:virtual-2 5}virt_line |
- {8:virtual-1 5}virt_line above |
+ {8:virtual-1 6}virt_line above |
{8:buffer 0 6}aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
{8:wrapped 1 6}aaaaaaaa |
{8:buffer 0 7}aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
@@ -510,10 +510,26 @@ describe('statuscolumn', function()
{8:wrapped 1 9}aaaaaaaa |
|
]])
- -- Also test virt_lines at the end of buffer
- exec_lua([[
- vim.api.nvim_buf_set_extmark(0, ns, 15, 0, { virt_lines = {{{"END", ""}}} })
+ -- Also correct v:lnum with a partial redraw
+ exec_lua('vim.api.nvim_buf_set_extmark(0, ns, 4, 0, { virt_lines = {{{"virt_line", ""}}} })')
+ screen:expect([[
+ {8:buffer 0 4}aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
+ {8:wrapped 1 4}aaaaaaaa |
+ {8:buffer 0 5}aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
+ {8:wrapped 1 5}aaaaaaaa |
+ {8:virtual-3 5}virt_line |
+ {8:virtual-2 5}virt_line |
+ {8:virtual-1 6}virt_line above |
+ {8:buffer 0 6}aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
+ {8:wrapped 1 6}aaaaaaaa |
+ {8:buffer 0 7}aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
+ {8:wrapped 1 7}aaaaaaaa |
+ {15:buffer 0 8}{100:^+-- 1 line: aaaaaaaaaaaaaaaaaaaaaaaaaaaaa}|
+ {8:buffer 0 9}aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa{1:@@@}|
+ |
]])
+ -- Also test virt_lines at the end of buffer
+ exec_lua('vim.api.nvim_buf_set_extmark(0, ns, 15, 0, { virt_lines = {{{"END", ""}}} })')
feed('GkJzz')
screen:expect([[
{8:buffer 0 12}aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|