aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjörn Linse <bjorn.linse@gmail.com>2019-09-21 10:40:41 +0200
committerDaniel Hahler <git@thequod.de>2019-10-01 02:15:24 +0200
commit43f4955f70480e3a6a094fef356770807f163029 (patch)
tree304ae975f80a8e579826ef36a8195169cec996d4
parent6f693be1ee80d11e7a2a42f22470103467abac71 (diff)
downloadrneovim-43f4955f70480e3a6a094fef356770807f163029.tar.gz
rneovim-43f4955f70480e3a6a094fef356770807f163029.tar.bz2
rneovim-43f4955f70480e3a6a094fef356770807f163029.zip
[release-0.4] Merge pull request #11069 from bfredl/virtualcol
screen: fix vcol counting with virtual text.
-rw-r--r--src/nvim/screen.c2
-rw-r--r--test/functional/ui/bufhl_spec.lua29
2 files changed, 30 insertions, 1 deletions
diff --git a/src/nvim/screen.c b/src/nvim/screen.c
index 5bcd2c808d..5ccf9cfad6 100644
--- a/src/nvim/screen.c
+++ b/src/nvim/screen.c
@@ -4007,7 +4007,7 @@ win_line (
break;
}
- ++vcol;
+ vcol += cells;
}
}
diff --git a/test/functional/ui/bufhl_spec.lua b/test/functional/ui/bufhl_spec.lua
index bcccef84b6..d8ca947645 100644
--- a/test/functional/ui/bufhl_spec.lua
+++ b/test/functional/ui/bufhl_spec.lua
@@ -31,6 +31,9 @@ describe('Buffer highlighting', function()
[14] = {background = Screen.colors.Gray90},
[15] = {background = Screen.colors.Gray90, bold = true, foreground = Screen.colors.Brown},
[16] = {foreground = Screen.colors.Magenta, background = Screen.colors.Gray90},
+ [17] = {foreground = Screen.colors.Magenta, background = Screen.colors.LightRed},
+ [18] = {background = Screen.colors.LightRed},
+ [19] = {foreground = Screen.colors.Blue1, background = Screen.colors.LightRed},
})
end)
@@ -516,6 +519,32 @@ describe('Buffer highlighting', function()
|
]])
end)
+
+ it('works with color column', function()
+ eq(-1, set_virtual_text(-1, 3, {{"暗x事", "Comment"}}, {}))
+ screen:expect{grid=[[
+ ^1 + 2 {3:=}{2: 3} |
+ 3 + {11:ERROR:} invalid syntax |
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5|
+ , 5, 5, 5, 5, 5, 5, Lorem ipsum dolor s|
+ x = 4 {12:暗x事} |
+ {1:~ }|
+ {1:~ }|
+ |
+ ]]}
+
+ command("set colorcolumn=9")
+ screen:expect{grid=[[
+ ^1 + 2 {3:=}{2: }{17:3} |
+ 3 + {11:ERROR:} invalid syntax |
+ 5, 5, 5,{18: }5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5|
+ , 5, 5, 5, 5, 5, 5, Lorem ipsum dolor s|
+ x = 4 {12:暗}{19:x}{12:事} |
+ {1:~ }|
+ {1:~ }|
+ |
+ ]]}
+ end)
end)
it('and virtual text use the same namespace counter', function()