Skip to content

Commit

Permalink
Merge pull request #11069 from bfredl/virtualcol
Browse files Browse the repository at this point in the history
screen: fix vcol counting with virtual text.
  • Loading branch information
bfredl committed Sep 21, 2019
2 parents afd576e + 828a6e7 commit d6f658e
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/nvim/screen.c
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -4007,7 +4007,7 @@ win_line (
break; break;
} }


++vcol; vcol += cells;
} }
} }


Expand Down
29 changes: 29 additions & 0 deletions test/functional/ui/bufhl_spec.lua
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ describe('Buffer highlighting', function()
[14] = {background = Screen.colors.Gray90}, [14] = {background = Screen.colors.Gray90},
[15] = {background = Screen.colors.Gray90, bold = true, foreground = Screen.colors.Brown}, [15] = {background = Screen.colors.Gray90, bold = true, foreground = Screen.colors.Brown},
[16] = {foreground = Screen.colors.Magenta, background = Screen.colors.Gray90}, [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) end)


Expand Down Expand Up @@ -516,6 +519,32 @@ describe('Buffer highlighting', function()
| |
]]) ]])
end) 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) end)


it('and virtual text use the same namespace counter', function() it('and virtual text use the same namespace counter', function()
Expand Down

0 comments on commit d6f658e

Please sign in to comment.