Skip to content

Commit

Permalink
test(statuscolumn): add virt_lines test for filler lines
Browse files Browse the repository at this point in the history
  • Loading branch information
luukvbaal committed Jan 12, 2023
1 parent 2aabe9b commit 0dd3e35
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/nvim/drawline.c
Original file line number Diff line number Diff line change
Expand Up @@ -2820,7 +2820,7 @@ int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, bool nochange,
need_showbreak = true;
}
if (statuscol.draw) {
if (row == startrow + 1 || row == startrow + filler_lines) {
if (row == startrow + filler_lines + 1 || row == startrow + filler_lines) {
// Re-evaluate 'statuscolumn' for the first wrapped row and non filler line
statuscol.textp = NULL;
} else { // Otherwise just reset the text/hlrec pointers
Expand Down
24 changes: 24 additions & 0 deletions test/functional/ui/statuscolumn_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ local helpers = require('test.functional.helpers')(after_each)
local Screen = require('test.functional.ui.screen')
local clear = helpers.clear
local command = helpers.command
local exec = helpers.exec_lua
local eq = helpers.eq
local eval = helpers.eval
local meths = helpers.meths
Expand Down Expand Up @@ -337,6 +338,29 @@ describe('statuscolumn', function()
{2: }{1: │}{2: }{1: }aaaaaaaaaaaaaaaaaaaa |
|
]])
-- Status column in filler lines is drawn correctly
exec([[
local ns = vim.api.nvim_create_namespace("ns")
vim.api.nvim_buf_set_extmark(0, ns, 4, 0, {
virt_lines = {{{"", ""}}, {{"", ""}}, {{"", ""}}}
})
]])
screen:expect([[
{2: }{1: 4│>>}{2: }{1: }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
{2: }{1: │}{2: }{1: }aaaaaaaaaaaaaaaaaaaa |
{2: }{1: 3│}{0:>!}{2: }{1: }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
{2: }{1: │}{2: }{1: }aaaaaaaaaaaaaaaaaaaa |
{2: }{1: │}{2: }{1: } |
{2: }{1: │}{2: }{1: } |
{2: }{1: │}{2: }{1: } |
{2: }{1: 2│>>}{0:>!}{1:>>}{0:>!}{1:>>}{0:>!}{1:>>}{0:>!}{1:>> }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
{2: }{1: │}{2: }{1: }^aaaaaaaaaaaaaaaaaaaa |
{2: }{1: 1│}{2: }{1: }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
{2: }{1: │}{2: }{1: }aaaaaaaaaaaaaaaaaaaa |
{2:+}{4: 0│}{2: }{4: }{5:+-- 1 line: aaaaaaaaaaaaaaaaa}|
{2: }{1: 1│}{2: }{1: }aaaaaaaaaaaaaaaaaaaaaaaaaaa{0:@@@}|
|
]])
end)

it('works with \'statuscolumn\' clicks', function()
Expand Down

0 comments on commit 0dd3e35

Please sign in to comment.