feat(ui): sign/statuscolumn can combine highlight attrs #31575

Problem:
Since e049c6e4c0, most statusline-like UI elements can combine
highlight attrs, except for sign/statuscolumn.

Solution:
Implement for sign/statuscolumn.
This commit is contained in:
luukvbaal
2024-12-14 19:21:50 +01:00
committed by GitHub
parent f9dd682621
commit 433b342baa
8 changed files with 265 additions and 239 deletions

View File

@@ -307,7 +307,7 @@ UI
which controls the tool used to open the given path or URL. If you want to which controls the tool used to open the given path or URL. If you want to
globally set this, you can override vim.ui.open using the same approach globally set this, you can override vim.ui.open using the same approach
described at |vim.paste()|. described at |vim.paste()|.
- `vim.ui.open()` now supports `vim.ui.open()` now supports
[lemonade](https://github.com/lemonade-command/lemonade) as an option for [lemonade](https://github.com/lemonade-command/lemonade) as an option for
opening urls/files. This is handy if you are in an ssh connection and use opening urls/files. This is handy if you are in an ssh connection and use
`lemonade`. `lemonade`.
@@ -317,7 +317,6 @@ UI
|hl-PmenuMatch|. |hl-PmenuMatch|.
• |vim.diagnostic.setqflist()| updates an existing quickfix list with the • |vim.diagnostic.setqflist()| updates an existing quickfix list with the
given title if found given title if found
• |ui-messages| content chunks now also contain the highlight group ID. • |ui-messages| content chunks now also contain the highlight group ID.
============================================================================== ==============================================================================
@@ -339,9 +338,9 @@ These existing features changed their behavior.
more emoji characters than before, including those encoded with multiple more emoji characters than before, including those encoded with multiple
emoji codepoints combined with ZWJ (zero width joiner) codepoints. emoji codepoints combined with ZWJ (zero width joiner) codepoints.
Text in the 'statusline', 'tabline', and 'winbar' now inherits highlights Custom highlights in 'rulerformat', 'statuscolumn', 'statusline', 'tabline',
from the respective |hl-StatusLine|, |hl-TabLine|, and |hl-WinBar| highlight 'winbar' and the number column (through |:sign-define| `numhl`) now combine
groups. with their respective highlight groups, as opposed to |hl-Normal|.
• |vim.on_key()| callbacks won't be invoked recursively when a callback itself • |vim.on_key()| callbacks won't be invoked recursively when a callback itself
consumes input. consumes input.

View File

@@ -462,10 +462,12 @@ void fill_foldcolumn(win_T *wp, foldinfo_T foldinfo, linenr_T lnum, int attr, in
static void draw_sign(bool nrcol, win_T *wp, winlinevars_T *wlv, int sign_idx, int sign_cul_attr) static void draw_sign(bool nrcol, win_T *wp, winlinevars_T *wlv, int sign_idx, int sign_cul_attr)
{ {
SignTextAttrs sattr = wlv->sattrs[sign_idx]; SignTextAttrs sattr = wlv->sattrs[sign_idx];
int scl_attr = win_hl_attr(wp, use_cursor_line_highlight(wp, wlv->lnum) ? HLF_CLS : HLF_SC);
if (sattr.text[0] && wlv->row == wlv->startrow + wlv->filler_lines && wlv->filler_todo <= 0) { if (sattr.text[0] && wlv->row == wlv->startrow + wlv->filler_lines && wlv->filler_todo <= 0) {
int attr = (use_cursor_line_highlight(wp, wlv->lnum) && sign_cul_attr) int attr = (use_cursor_line_highlight(wp, wlv->lnum) && sign_cul_attr)
? sign_cul_attr : sattr.hl_id ? syn_id2attr(sattr.hl_id) : 0; ? sign_cul_attr : sattr.hl_id ? syn_id2attr(sattr.hl_id) : 0;
attr = hl_combine_attr(scl_attr, attr);
int fill = nrcol ? number_width(wp) + 1 : SIGN_WIDTH; int fill = nrcol ? number_width(wp) + 1 : SIGN_WIDTH;
draw_col_fill(wlv, schar_from_ascii(' '), fill, attr); draw_col_fill(wlv, schar_from_ascii(' '), fill, attr);
int sign_pos = wlv->off - SIGN_WIDTH - (int)nrcol; int sign_pos = wlv->off - SIGN_WIDTH - (int)nrcol;
@@ -474,8 +476,7 @@ static void draw_sign(bool nrcol, win_T *wp, winlinevars_T *wlv, int sign_idx, i
linebuf_char[sign_pos + 1] = sattr.text[1]; linebuf_char[sign_pos + 1] = sattr.text[1];
} else { } else {
assert(!nrcol); // handled in draw_lnum_col() assert(!nrcol); // handled in draw_lnum_col()
int attr = win_hl_attr(wp, use_cursor_line_highlight(wp, wlv->lnum) ? HLF_CLS : HLF_SC); draw_col_fill(wlv, schar_from_ascii(' '), SIGN_WIDTH, scl_attr);
draw_col_fill(wlv, schar_from_ascii(' '), SIGN_WIDTH, attr);
} }
} }
@@ -559,8 +560,8 @@ static void draw_lnum_col(win_T *wp, winlinevars_T *wlv, int sign_num_attr, int
} else { } else {
// Draw the line number (empty space after wrapping). // Draw the line number (empty space after wrapping).
int width = number_width(wp) + 1; int width = number_width(wp) + 1;
int attr = (sign_num_attr > 0 && wlv->filler_todo <= 0) int attr = hl_combine_attr(get_line_number_attr(wp, wlv),
? sign_num_attr : get_line_number_attr(wp, wlv); wlv->filler_todo <= 0 ? sign_num_attr : 0);
if (wlv->row == wlv->startrow + wlv->filler_lines if (wlv->row == wlv->startrow + wlv->filler_lines
&& (wp->w_skipcol == 0 || wlv->row > 0 || (wp->w_p_nu && wp->w_p_rnu))) { && (wp->w_skipcol == 0 || wlv->row > 0 || (wp->w_p_nu && wp->w_p_rnu))) {
char buf[32]; char buf[32];
@@ -640,7 +641,7 @@ static void draw_statuscol(win_T *wp, winlinevars_T *wlv, linenr_T lnum, int vir
draw_col_buf(wp, wlv, transbuf, translen, attr, false); draw_col_buf(wp, wlv, transbuf, translen, attr, false);
p = sp->start; p = sp->start;
int hl = sp->userhl; int hl = sp->userhl;
attr = hl < 0 ? syn_id2attr(-hl) : stcp->num_attr; attr = hl < 0 ? hl_combine_attr(stcp->num_attr, syn_id2attr(-hl)) : stcp->num_attr;
} }
size_t translen = transstr_buf(p, buf + len - p, transbuf, MAXPATHL, true); size_t translen = transstr_buf(p, buf + len - p, transbuf, MAXPATHL, true);
draw_col_buf(wp, wlv, transbuf, translen, attr, false); draw_col_buf(wp, wlv, transbuf, translen, attr, false);

View File

@@ -1731,7 +1731,7 @@ describe('API/extmarks', function()
-- mark with invalidate is removed -- mark with invalidate is removed
command('d2') command('d2')
screen:expect([[ screen:expect([[
S2^aaa bbb ccc | {7:S2}^aaa bbb ccc |
{7: }aaa bbb ccc |*3 {7: }aaa bbb ccc |*3
{7: } | {7: } |
| |
@@ -1739,9 +1739,9 @@ describe('API/extmarks', function()
-- mark is restored with undo_restore == true -- mark is restored with undo_restore == true
command('silent undo') command('silent undo')
screen:expect([[ screen:expect([[
S1{7: }^aaa bbb ccc | {7:S1 }^aaa bbb ccc |
S2S1aaa bbb ccc | {7:S2S1}aaa bbb ccc |
S2{7: }aaa bbb ccc | {7:S2 }aaa bbb ccc |
{7: }aaa bbb ccc |*2 {7: }aaa bbb ccc |*2
| |
]]) ]])

View File

@@ -26,6 +26,9 @@ describe('signs', function()
-- oldtest: Test_sign_cursor_position() -- oldtest: Test_sign_cursor_position()
it('are drawn correctly', function() it('are drawn correctly', function()
local screen = Screen.new(75, 6) local screen = Screen.new(75, 6)
screen:add_extra_attr_ids({
[100] = { foreground = Screen.colors.Blue4, background = Screen.colors.Yellow },
})
exec([[ exec([[
call setline(1, [repeat('x', 75), 'mmmm', 'yyyy']) call setline(1, [repeat('x', 75), 'mmmm', 'yyyy'])
call cursor(2,1) call cursor(2,1)
@@ -37,7 +40,7 @@ describe('signs', function()
screen:expect([[ screen:expect([[
{7: }xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx| {7: }xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx|
{7: }xx | {7: }xx |
{10:=>}^mmmm | {100:=>}^mmmm |
{7: }yyyy | {7: }yyyy |
{1:~ }| {1:~ }|
| |
@@ -48,7 +51,7 @@ describe('signs', function()
screen:expect([[ screen:expect([[
{7: }xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx| {7: }xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx|
{7: }xx | {7: }xx |
{10:-)}^mmmm | {100:-)}^mmmm |
{7: }yyyy | {7: }yyyy |
{1:~ }| {1:~ }|
| |
@@ -59,7 +62,7 @@ describe('signs', function()
screen:expect([[ screen:expect([[
{7: }xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx| {7: }xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx|
{7: }xx | {7: }xx |
{10:-)}{4:^mmmm }| {100:-)}{4:^mmmm }|
{7: }yyyy | {7: }yyyy |
{1:~ }| {1:~ }|
| |

View File

@@ -631,7 +631,7 @@ describe('decorations providers', function()
{14: }hello97 | {14: }hello97 |
{14: }hello98 | {14: }hello98 |
{14: }hello99 | {14: }hello99 |
X ^hello100 | {14:X }^hello100 |
{14: }hello101 | {14: }hello101 |
{14: }hello102 | {14: }hello102 |
{14: }hello103 | {14: }hello103 |
@@ -2301,13 +2301,16 @@ describe('extmark decorations', function()
it('works with both hl_group and sign_hl_group', function() it('works with both hl_group and sign_hl_group', function()
screen:try_resize(50, 3) screen:try_resize(50, 3)
screen:add_extra_attr_ids({
[100] = { background = Screen.colors.WebGray, foreground = Screen.colors.Blue, bold = true },
})
insert('abcdefghijklmn') insert('abcdefghijklmn')
api.nvim_buf_set_extmark(0, ns, 0, 0, {sign_text='S', sign_hl_group='NonText', hl_group='Error', end_col=14}) api.nvim_buf_set_extmark(0, ns, 0, 0, {sign_text='S', sign_hl_group='NonText', hl_group='Error', end_col=14})
screen:expect{grid=[[ screen:expect([[
{1:S }{4:abcdefghijklm^n} | {100:S }{9:abcdefghijklm^n} |
{1:~ }| {1:~ }|
| |
]]} ]])
end) end)
it('virt_text_repeat_linebreak repeats virtual text on wrapped lines', function() it('virt_text_repeat_linebreak repeats virtual text on wrapped lines', function()
@@ -5064,16 +5067,16 @@ l5
api.nvim_buf_set_extmark(0, ns, 1, -1, {sign_text='S'}) api.nvim_buf_set_extmark(0, ns, 1, -1, {sign_text='S'})
screen:expect{grid=[[ screen:expect([[
{7: }^l1 | {7: }^l1 |
S l2 | {7:S }l2 |
{7: }l3 | {7: }l3 |
{7: }l4 | {7: }l4 |
{7: }l5 | {7: }l5 |
{7: } | {7: } |
{1:~ }|*3 {1:~ }|*3
| |
]]} ]])
end) end)
it('can add a single sign (with end row)', function() it('can add a single sign (with end row)', function()
@@ -5082,16 +5085,16 @@ l5
api.nvim_buf_set_extmark(0, ns, 1, -1, {sign_text='S', end_row=1}) api.nvim_buf_set_extmark(0, ns, 1, -1, {sign_text='S', end_row=1})
screen:expect{grid=[[ screen:expect([[
{7: }^l1 | {7: }^l1 |
S l2 | {7:S }l2 |
{7: }l3 | {7: }l3 |
{7: }l4 | {7: }l4 |
{7: }l5 | {7: }l5 |
{7: } | {7: } |
{1:~ }|*3 {1:~ }|*3
| |
]]} ]])
end) end)
it('can add a single sign and text highlight', function() it('can add a single sign and text highlight', function()
@@ -5099,16 +5102,16 @@ l5
feed 'gg' feed 'gg'
api.nvim_buf_set_extmark(0, ns, 1, 0, {sign_text='S', hl_group='Todo', end_col=1}) api.nvim_buf_set_extmark(0, ns, 1, 0, {sign_text='S', hl_group='Todo', end_col=1})
screen:expect{grid=[[ screen:expect([[
{7: }^l1 | {7: }^l1 |
S {100:l}2 | {7:S }{100:l}2 |
{7: }l3 | {7: }l3 |
{7: }l4 | {7: }l4 |
{7: }l5 | {7: }l5 |
{7: } | {7: } |
{1:~ }|*3 {1:~ }|*3
| |
]]} ]])
api.nvim_buf_clear_namespace(0, ns, 0, -1) api.nvim_buf_clear_namespace(0, ns, 0, -1)
end) end)
@@ -5119,16 +5122,16 @@ l5
api.nvim_buf_set_extmark(0, ns, 1, -1, {sign_text='S', end_row = 2}) api.nvim_buf_set_extmark(0, ns, 1, -1, {sign_text='S', end_row = 2})
screen:expect{grid=[[ screen:expect([[
{7: }^l1 | {7: }^l1 |
S l2 | {7:S }l2 |
S l3 | {7:S }l3 |
{7: }l4 | {7: }l4 |
{7: }l5 | {7: }l5 |
{7: } | {7: } |
{1:~ }|*3 {1:~ }|*3
| |
]]} ]])
end) end)
it('can add multiple signs (multiple extmarks)', function() it('can add multiple signs (multiple extmarks)', function()
@@ -5138,16 +5141,16 @@ l5
api.nvim_buf_set_extmark(0, ns, 1, -1, {sign_text='S1'}) api.nvim_buf_set_extmark(0, ns, 1, -1, {sign_text='S1'})
api.nvim_buf_set_extmark(0, ns, 3, -1, {sign_text='S2', end_row = 4}) api.nvim_buf_set_extmark(0, ns, 3, -1, {sign_text='S2', end_row = 4})
screen:expect{grid=[[ screen:expect([[
{7: }^l1 | {7: }^l1 |
S1l2 | {7:S1}l2 |
{7: }l3 | {7: }l3 |
S2l4 | {7:S2}l4 |
S2l5 | {7:S2}l5 |
{7: } | {7: } |
{1:~ }|*3 {1:~ }|*3
| |
]]} ]])
end) end)
it('can add multiple signs (multiple extmarks) 2', function() it('can add multiple signs (multiple extmarks) 2', function()
@@ -5156,16 +5159,16 @@ l5
api.nvim_buf_set_extmark(0, ns, 3, -1, {sign_text='S1'}) api.nvim_buf_set_extmark(0, ns, 3, -1, {sign_text='S1'})
api.nvim_buf_set_extmark(0, ns, 1, -1, {sign_text='S2', end_row = 3}) api.nvim_buf_set_extmark(0, ns, 1, -1, {sign_text='S2', end_row = 3})
screen:expect{grid=[[ screen:expect([[
{7: }^l1 | {7: }^l1 |
S2{7: }l2 | {7:S2 }l2 |
S2{7: }l3 | {7:S2 }l3 |
S2S1l4 | {7:S2S1}l4 |
{7: }l5 | {7: }l5 |
{7: } | {7: } |
{1:~ }|*3 {1:~ }|*3
| |
]]} ]])
end) end)
it('can add multiple signs (multiple extmarks) 3', function() it('can add multiple signs (multiple extmarks) 3', function()
@@ -5176,16 +5179,16 @@ l5
api.nvim_buf_set_extmark(0, ns, 1, -1, {sign_text='S1', end_row=2}) api.nvim_buf_set_extmark(0, ns, 1, -1, {sign_text='S1', end_row=2})
api.nvim_buf_set_extmark(0, ns, 2, -1, {sign_text='S2', end_row=3}) api.nvim_buf_set_extmark(0, ns, 2, -1, {sign_text='S2', end_row=3})
screen:expect{grid=[[ screen:expect([[
{7: }^l1 | {7: }^l1 |
S1{7: }l2 | {7:S1 }l2 |
S2S1l3 | {7:S2S1}l3 |
S2{7: }l4 | {7:S2 }l4 |
{7: }l5 | {7: }l5 |
{7: } | {7: } |
{1:~ }|*3 {1:~ }|*3
| |
]]} ]])
end) end)
it('can add multiple signs (multiple extmarks) 4', function() it('can add multiple signs (multiple extmarks) 4', function()
@@ -5195,16 +5198,16 @@ l5
api.nvim_buf_set_extmark(0, ns, 0, -1, {sign_text='S1', end_row=0}) api.nvim_buf_set_extmark(0, ns, 0, -1, {sign_text='S1', end_row=0})
api.nvim_buf_set_extmark(0, ns, 1, -1, {sign_text='S2', end_row=1}) api.nvim_buf_set_extmark(0, ns, 1, -1, {sign_text='S2', end_row=1})
screen:expect{grid=[[ screen:expect([[
S1^l1 | {7:S1}^l1 |
S2l2 | {7:S2}l2 |
{7: }l3 | {7: }l3 |
{7: }l4 | {7: }l4 |
{7: }l5 | {7: }l5 |
{7: } | {7: } |
{1:~ }|*3 {1:~ }|*3
| |
]]} ]])
end) end)
it('works with old signs', function() it('works with old signs', function()
@@ -5219,16 +5222,16 @@ l5
api.nvim_buf_set_extmark(0, ns, 0, -1, {sign_text='S4'}) api.nvim_buf_set_extmark(0, ns, 0, -1, {sign_text='S4'})
api.nvim_buf_set_extmark(0, ns, 2, -1, {sign_text='S5'}) api.nvim_buf_set_extmark(0, ns, 2, -1, {sign_text='S5'})
screen:expect{grid=[[ screen:expect([[
S4S1^l1 | {7:S4S1}^l1 |
S2x l2 | {7:S2x }l2 |
S5{7: }l3 | {7:S5 }l3 |
{7: }l4 | {7: }l4 |
{7: }l5 | {7: }l5 |
{7: } | {7: } |
{1:~ }|*3 {1:~ }|*3
| |
]]} ]])
end) end)
it('works with old signs (with range)', function() it('works with old signs (with range)', function()
@@ -5244,16 +5247,16 @@ l5
api.nvim_buf_set_extmark(0, ns, 0, -1, {sign_text='S4'}) api.nvim_buf_set_extmark(0, ns, 0, -1, {sign_text='S4'})
api.nvim_buf_set_extmark(0, ns, 2, -1, {sign_text='S5'}) api.nvim_buf_set_extmark(0, ns, 2, -1, {sign_text='S5'})
screen:expect{grid=[[ screen:expect([[
S4S3S1^l1 | {7:S4S3S1}^l1 |
S3S2x l2 | {7:S3S2x }l2 |
S5S3{7: }l3 | {7:S5S3 }l3 |
S3{7: }l4 | {7:S3 }l4 |
S3{7: }l5 | {7:S3 }l5 |
{7: } | {7: } |
{1:~ }|*3 {1:~ }|*3
| |
]]} ]])
end) end)
it('can add a ranged sign (with start out of view)', function() it('can add a ranged sign (with start out of view)', function()
@@ -5264,14 +5267,14 @@ l5
api.nvim_buf_set_extmark(0, ns, 1, -1, {sign_text='X', end_row=3}) api.nvim_buf_set_extmark(0, ns, 1, -1, {sign_text='X', end_row=3})
screen:expect{grid=[[ screen:expect([[
X {7: }^l3 | {7:X }^l3 |
X {7: }l4 | {7:X }l4 |
{7: }l5 | {7: }l5 |
{7: } | {7: } |
{1:~ }|*5 {1:~ }|*5
| |
]]} ]])
end) end)
it('can add lots of signs', function() it('can add lots of signs', function()
@@ -5293,11 +5296,11 @@ l5
api.nvim_buf_set_extmark(0, ns, i, -1, { sign_text='Z' }) api.nvim_buf_set_extmark(0, ns, i, -1, { sign_text='Z' })
end end
screen:expect{grid=[[ screen:expect([[
Z Y X W {100:a} {100:b} {100:c} {100:d} {100:e} {100:f} {100:g} {100:h} |*8 {7:Z Y X W }{100:a} {100:b} {100:c} {100:d} {100:e} {100:f} {100:g} {100:h} |*8
Z Y X W {100:a} {100:b} {100:c} {100:d} {100:e} {100:f} {100:g} {100:^h} | {7:Z Y X W }{100:a} {100:b} {100:c} {100:d} {100:e} {100:f} {100:g} {100:^h} |
| |
]]} ]])
end) end)
it('works with priority #19716', function() it('works with priority #19716', function()
@@ -5313,20 +5316,20 @@ l5
api.nvim_buf_set_extmark(0, ns, 0, -1, {sign_text='S5', priority=200}) api.nvim_buf_set_extmark(0, ns, 0, -1, {sign_text='S5', priority=200})
api.nvim_buf_set_extmark(0, ns, 0, -1, {sign_text='S1', priority=1}) api.nvim_buf_set_extmark(0, ns, 0, -1, {sign_text='S1', priority=1})
screen:expect{grid=[[ screen:expect([[
S5S4O3S2S1^l1 | {7:S5S4O3S2S1}^l1 |
{7: }l2 | {7: }l2 |
| |
]]} ]])
-- Check truncation works too -- Check truncation works too
api.nvim_set_option_value('signcolumn', 'auto', {}) api.nvim_set_option_value('signcolumn', 'auto', {})
screen:expect{grid=[[ screen:expect([[
S5^l1 | {7:S5}^l1 |
{7: }l2 | {7: }l2 |
| |
]]} ]])
end) end)
it('does not overflow with many old signs #23852', function() it('does not overflow with many old signs #23852', function()
@@ -5343,21 +5346,21 @@ l5
command([[exe 'sign place 07 line=1 name=Oldsign priority=10 buffer=' . bufnr('')]]) command([[exe 'sign place 07 line=1 name=Oldsign priority=10 buffer=' . bufnr('')]])
command([[exe 'sign place 08 line=1 name=Oldsign priority=10 buffer=' . bufnr('')]]) command([[exe 'sign place 08 line=1 name=Oldsign priority=10 buffer=' . bufnr('')]])
command([[exe 'sign place 09 line=1 name=Oldsign priority=10 buffer=' . bufnr('')]]) command([[exe 'sign place 09 line=1 name=Oldsign priority=10 buffer=' . bufnr('')]])
screen:expect{grid=[[ screen:expect([[
O3O3O3O3O3O3O3O3O3^ | {7:O3O3O3O3O3O3O3O3O3}^ |
{1:~ }| {1:~ }|
| |
]]} ]])
api.nvim_buf_set_extmark(0, ns, 0, -1, {sign_text='S1', priority=1}) api.nvim_buf_set_extmark(0, ns, 0, -1, {sign_text='S1', priority=1})
screen:expect_unchanged() screen:expect_unchanged()
api.nvim_buf_set_extmark(0, ns, 0, -1, {sign_text='S5', priority=200}) api.nvim_buf_set_extmark(0, ns, 0, -1, {sign_text='S5', priority=200})
screen:expect{grid=[[ screen:expect([[
S5O3O3O3O3O3O3O3O3^ | {7:S5O3O3O3O3O3O3O3O3}^ |
{1:~ }| {1:~ }|
| |
]]} ]])
assert_alive() assert_alive()
end) end)
@@ -5383,12 +5386,12 @@ l5
api.nvim_buf_set_extmark(0, ns, 1, -1, {invalidate = true, sign_text='S3'}) api.nvim_buf_set_extmark(0, ns, 1, -1, {invalidate = true, sign_text='S3'})
feed('2Gdd') feed('2Gdd')
screen:expect{grid=[[ screen:expect([[
S1l1 | {7:S1}l1 |
S1^l3 | {7:S1}^l3 |
S1l4 | {7:S1}l4 |
| |
]]} ]])
end) end)
it('correct width with multiple overlapping signs', function() it('correct width with multiple overlapping signs', function()
@@ -5400,36 +5403,36 @@ l5
feed('gg') feed('gg')
local s1 = [[ local s1 = [[
S2S1^l1 | {7:S2S1}^l1 |
S3S2l2 | {7:S3S2}l2 |
S3S2l3 | {7:S3S2}l3 |
| |
]] ]]
screen:expect{grid=s1} screen:expect(s1)
-- Correct width when :move'ing a line with signs -- Correct width when :move'ing a line with signs
command('move2') command('move2')
screen:expect{grid=[[ screen:expect([[
S3{7: }l2 | {7:S3 }l2 |
S3S2S1^l1 | {7:S3S2S1}^l1 |
{7: }l3 | {7: }l3 |
| |
]]} ]])
command('silent undo') command('silent undo')
screen:expect{grid=s1} screen:expect{grid=s1}
command('d') command('d')
screen:expect{grid=[[ screen:expect([[
S3S2S1^l2 | {7:S3S2S1}^l2 |
S3S2{7: }l3 | {7:S3S2 }l3 |
{7: }l4 | {7: }l4 |
| |
]]} ]])
command('d') command('d')
screen:expect{grid=[[ screen:expect([[
S3S2S1^l3 | {7:S3S2S1}^l3 |
{7: }l4 | {7: }l4 |
{7: }l5 | {7: }l5 |
| |
]]} ]])
end) end)
it('correct width when adding and removing multiple signs', function() it('correct width when adding and removing multiple signs', function()
@@ -5452,12 +5455,12 @@ l5
redraw! redraw!
call nvim_buf_del_extmark(0, ns, s1) call nvim_buf_del_extmark(0, ns, s1)
]]) ]])
screen:expect{grid=[[ screen:expect([[
S1^l1 | {7:S1}^l1 |
S1l2 | {7:S1}l2 |
S1l3 | {7:S1}l3 |
| |
]]} ]])
end) end)
it('correct width when deleting lines', function() it('correct width when deleting lines', function()
@@ -5472,12 +5475,12 @@ l5
call nvim_buf_del_extmark(0, ns, s3) call nvim_buf_del_extmark(0, ns, s3)
norm 4Gdd norm 4Gdd
]]) ]])
screen:expect{grid=[[ screen:expect([[
{7: }l3 | {7: }l3 |
S2S1l5 | {7:S2S1}l5 |
{7: }^ | {7: }^ |
| |
]]} ]])
end) end)
it('correct width when splitting lines with signs on different columns', function() it('correct width when splitting lines with signs on different columns', function()
@@ -5487,12 +5490,12 @@ l5
api.nvim_buf_set_extmark(0, ns, 0, 0, {sign_text='S1'}) api.nvim_buf_set_extmark(0, ns, 0, 0, {sign_text='S1'})
api.nvim_buf_set_extmark(0, ns, 0, 1, {sign_text='S2'}) api.nvim_buf_set_extmark(0, ns, 0, 1, {sign_text='S2'})
feed('a<cr><esc>') feed('a<cr><esc>')
screen:expect{grid=[[ screen:expect([[
S1l | {7:S1}l |
S2^1 | {7:S2}^1 |
{7: }l2 | {7: }l2 |
| |
]]} ]])
end) end)
it('correct width after wiping a buffer', function() it('correct width after wiping a buffer', function()
@@ -5501,12 +5504,12 @@ l5
feed('gg') feed('gg')
local buf = api.nvim_get_current_buf() local buf = api.nvim_get_current_buf()
api.nvim_buf_set_extmark(buf, ns, 0, 0, { sign_text = 'h' }) api.nvim_buf_set_extmark(buf, ns, 0, 0, { sign_text = 'h' })
screen:expect{grid=[[ screen:expect([[
h ^l1 | {7:h }^l1 |
{7: }l2 | {7: }l2 |
{7: }l3 | {7: }l3 |
| |
]]} ]])
api.nvim_win_set_buf(0, api.nvim_create_buf(false, true)) api.nvim_win_set_buf(0, api.nvim_create_buf(false, true))
api.nvim_buf_delete(buf, {unload=true, force=true}) api.nvim_buf_delete(buf, {unload=true, force=true})
api.nvim_buf_set_lines(buf, 0, -1, false, {''}) api.nvim_buf_set_lines(buf, 0, -1, false, {''})
@@ -5537,12 +5540,12 @@ l5
end) end)
]]) ]])
screen:expect{grid=[[ screen:expect([[
S1^l1 | {7:S1}^l1 |
S2l2 | {7:S2}l2 |
S4l3 | {7:S4}l3 |
| |
]]} ]])
end) end)
it('no crash with sign after many marks #27137', function() it('no crash with sign after many marks #27137', function()
@@ -5553,11 +5556,11 @@ l5
end end
api.nvim_buf_set_extmark(0, ns, 0, 0, {sign_text = 'S1'}) api.nvim_buf_set_extmark(0, ns, 0, 0, {sign_text = 'S1'})
screen:expect{grid=[[ screen:expect([[
S1{9:^a} | {7:S1}{9:^a} |
{1:~ }|*2 {1:~ }|*2
| |
]]} ]])
end) end)
it('correct sort order with multiple namespaces and same id', function() it('correct sort order with multiple namespaces and same id', function()
@@ -5565,11 +5568,11 @@ l5
api.nvim_buf_set_extmark(0, ns, 0, 0, {sign_text = 'S1', id = 1}) api.nvim_buf_set_extmark(0, ns, 0, 0, {sign_text = 'S1', id = 1})
api.nvim_buf_set_extmark(0, ns2, 0, 0, {sign_text = 'S2', id = 1}) api.nvim_buf_set_extmark(0, ns2, 0, 0, {sign_text = 'S2', id = 1})
screen:expect{grid=[[ screen:expect([[
S2S1^ | {7:S2S1}^ |
{1:~ }|*8 {1:~ }|*8
| |
]]} ]])
end) end)
it('correct number of signs after deleting text (#27046)', function() it('correct number of signs after deleting text (#27046)', function()
@@ -5586,12 +5589,12 @@ l5
api.nvim_buf_set_extmark(0, ns, 30, 0, {end_row = 30, end_col = 3, hl_group = 'Error'}) api.nvim_buf_set_extmark(0, ns, 30, 0, {end_row = 30, end_col = 3, hl_group = 'Error'})
command('0d29') command('0d29')
screen:expect{grid=[[ screen:expect([[
S4S3S2S1{9:^foo} | {7:S4S3S2S1}{9:^foo} |
S5{7: }{9:foo} | {7:S5 }{9:foo} |
{1:~ }|*7 {1:~ }|*7
29 fewer lines | 29 fewer lines |
]]} ]])
api.nvim_buf_clear_namespace(0, ns, 0, -1) api.nvim_buf_clear_namespace(0, ns, 0, -1)
end) end)
@@ -5599,21 +5602,17 @@ l5
it([[correct numberwidth with 'signcolumn' set to "number" #28984]], function() it([[correct numberwidth with 'signcolumn' set to "number" #28984]], function()
command('set number numberwidth=1 signcolumn=number') command('set number numberwidth=1 signcolumn=number')
api.nvim_buf_set_extmark(0, ns, 0, 0, { sign_text = 'S1' }) api.nvim_buf_set_extmark(0, ns, 0, 0, { sign_text = 'S1' })
screen:expect({ screen:expect([[
grid = [[ {7:S1 }^ |
S1 ^ |
{1:~ }|*8 {1:~ }|*8
| |
]] ]])
})
api.nvim_buf_del_extmark(0, ns, 1) api.nvim_buf_del_extmark(0, ns, 1)
screen:expect({ screen:expect([[
grid = [[
{8:1 }^ | {8:1 }^ |
{1:~ }|*8 {1:~ }|*8
| |
]] ]])
})
end) end)
it('supports emoji as signs', function() it('supports emoji as signs', function()
@@ -5626,10 +5625,10 @@ l5
api.nvim_buf_set_extmark(0, ns, 4, 0, {sign_text='❤x'}) api.nvim_buf_set_extmark(0, ns, 4, 0, {sign_text='❤x'})
screen:expect([[ screen:expect([[
{7: }^l1 | {7: }^l1 |
🧑🌾l2 | {7:🧑‍🌾}l2 |
l3 | {7:❤️}l3 |
❤ l4 | {7:}l4 |
❤xl5 | {7:❤x}l5 |
{7: } | {7: } |
{1:~ }|*3 {1:~ }|*3
| |

View File

@@ -1046,6 +1046,8 @@ describe('float window', function()
[26] = {blend = 80, background = Screen.colors.Gray0}; [26] = {blend = 80, background = Screen.colors.Gray0};
[27] = {foreground = Screen.colors.Black, background = Screen.colors.LightGrey}; [27] = {foreground = Screen.colors.Black, background = Screen.colors.LightGrey};
[28] = {foreground = Screen.colors.DarkBlue, background = Screen.colors.LightGrey}; [28] = {foreground = Screen.colors.DarkBlue, background = Screen.colors.LightGrey};
[29] = {background = Screen.colors.Yellow1, foreground = Screen.colors.Blue4};
[30] = {background = Screen.colors.Grey, foreground = Screen.colors.Blue4, bold = true};
} }
screen:set_default_attr_ids(attrs) screen:set_default_attr_ids(attrs)
end) end)
@@ -1451,14 +1453,14 @@ describe('float window', function()
[2:----------------------------------------]|*6 [2:----------------------------------------]|*6
[3:----------------------------------------]| [3:----------------------------------------]|
## grid 2 ## grid 2
{19: }{17:𐌢̀́̂̃̅̄𐌢̀́̂̃̅̄}{20: 1 }{22:^x}{21: }| {19: }{29:𐌢̀́̂̃̅̄𐌢̀́̂̃̅̄}{20: 1 }{22:^x}{21: }|
{19: }{14: 2 }{22:y} | {19: }{14: 2 }{22:y} |
{19: }{14: 3 }{22: } | {19: }{14: 3 }{22: } |
{0:~ }|*3 {0:~ }|*3
## grid 3 ## grid 3
| |
## grid 4 ## grid 4
{17:𐌢̀́̂̃̅̄𐌢̀́̂̃̅̄}{15:x }| {29:𐌢̀́̂̃̅̄𐌢̀́̂̃̅̄}{15:x }|
{19: }{15:y }| {19: }{15:y }|
{19: }{15: }| {19: }{15: }|
{15: }| {15: }|
@@ -1466,9 +1468,9 @@ describe('float window', function()
else else
screen:expect([[ screen:expect([[
{19: }{17:𐌢̀́̂̃̅̄𐌢̀́̂̃̅̄}{20: 1 }{22:^x}{21: }| {19: }{29:𐌢̀́̂̃̅̄𐌢̀́̂̃̅̄}{20: 1 }{22:^x}{21: }|
{19: }{14: 2 }{22:y} | {19: }{14: 2 }{22:y} |
{19: }{14: 3 }{22: } {17:𐌢̀́̂̃̅̄𐌢̀́̂̃̅̄}{15:x } | {19: }{14: 3 }{22: } {29:𐌢̀́̂̃̅̄𐌢̀́̂̃̅̄}{15:x } |
{0:~ }{19: }{15:y }{0: }| {0:~ }{19: }{15:y }{0: }|
{0:~ }{19: }{15: }{0: }| {0:~ }{19: }{15: }{0: }|
{0:~ }{15: }{0: }| {0:~ }{15: }{0: }|
@@ -1551,14 +1553,14 @@ describe('float window', function()
[2:----------------------------------------]|*6 [2:----------------------------------------]|*6
[3:----------------------------------------]| [3:----------------------------------------]|
## grid 2 ## grid 2
{19: }{17:𐌢̀́̂̃̅̄𐌢̀́̂̃̅̄}{20: 1 }{22:^x}{21: }| {19: }{29:𐌢̀́̂̃̅̄𐌢̀́̂̃̅̄}{20: 1 }{22:^x}{21: }|
{19: }{14: 2 }{22:y} | {19: }{14: 2 }{22:y} |
{19: }{14: 3 }{22: } | {19: }{14: 3 }{22: } |
{0:~ }|*3 {0:~ }|*3
## grid 3 ## grid 3
| |
## grid 4 ## grid 4
{17:𐌢̀́̂̃̅̄𐌢̀́̂̃̅̄}{15:x }| {29:𐌢̀́̂̃̅̄𐌢̀́̂̃̅̄}{15:x }|
{19: }{15:y }| {19: }{15:y }|
{19: }{15: }| {19: }{15: }|
{15: }| {15: }|
@@ -1566,9 +1568,9 @@ describe('float window', function()
else else
screen:expect([[ screen:expect([[
{19: }{17:𐌢̀́̂̃̅̄𐌢̀́̂̃̅̄}{20: 1 }{22:^x}{21: }| {19: }{29:𐌢̀́̂̃̅̄𐌢̀́̂̃̅̄}{20: 1 }{22:^x}{21: }|
{19: }{14: 2 }{22:y} | {19: }{14: 2 }{22:y} |
{19: }{14: 3 }{22: } {17:𐌢̀́̂̃̅̄𐌢̀́̂̃̅̄}{15:x } | {19: }{14: 3 }{22: } {29:𐌢̀́̂̃̅̄𐌢̀́̂̃̅̄}{15:x } |
{0:~ }{19: }{15:y }{0: }| {0:~ }{19: }{15:y }{0: }|
{0:~ }{19: }{15: }{0: }| {0:~ }{19: }{15: }{0: }|
{0:~ }{15: }{0: }| {0:~ }{15: }{0: }|
@@ -1621,7 +1623,7 @@ describe('float window', function()
[2:----------------------------------------]|*6 [2:----------------------------------------]|*6
[3:----------------------------------------]| [3:----------------------------------------]|
## grid 2 ## grid 2
{20: 1}{19: }{22:^x}{21: }| {20: 1}{30: }{22:^x}{21: }|
{14: 2}{19: }{22:y} | {14: 2}{19: }{22:y} |
{14: 3}{19: }{22: } | {14: 3}{19: }{22: } |
{0:~ }|*3 {0:~ }|*3
@@ -1634,7 +1636,7 @@ describe('float window', function()
]], float_pos={[4] = {1001, "NW", 1, 4, 10, true}}} ]], float_pos={[4] = {1001, "NW", 1, 4, 10, true}}}
else else
screen:expect{grid=[[ screen:expect{grid=[[
{20: 1}{19: }{22:^x}{21: }| {20: 1}{30: }{22:^x}{21: }|
{14: 2}{19: }{22:y} | {14: 2}{19: }{22:y} |
{14: 3}{19: }{22: } {15:x } | {14: 3}{19: }{22: } {15:x } |
{0:~ }{15:y }{0: }| {0:~ }{15:y }{0: }|

View File

@@ -14,6 +14,12 @@ describe('Signs', function()
screen = Screen.new() screen = Screen.new()
screen:add_extra_attr_ids { screen:add_extra_attr_ids {
[100] = { bold = true, foreground = Screen.colors.Magenta1 }, [100] = { bold = true, foreground = Screen.colors.Magenta1 },
[101] = { foreground = Screen.colors.DarkBlue, background = Screen.colors.Yellow1 },
[102] = { foreground = Screen.colors.Brown, background = Screen.colors.Yellow },
[103] = { background = Screen.colors.Yellow, reverse = true },
[104] = { reverse = true, foreground = Screen.colors.Grey100, background = Screen.colors.Red },
[105] = { bold = true, background = Screen.colors.Red1, foreground = Screen.colors.Gray100 },
[106] = { foreground = Screen.colors.Brown, reverse = true },
} }
end) end)
@@ -27,8 +33,8 @@ describe('Signs', function()
sign place 2 line=2 name=piet2 buffer=1 sign place 2 line=2 name=piet2 buffer=1
]]) ]])
screen:expect([[ screen:expect([[
{10:𐌢̀́̂̃̅̄𐌢̀́̂̃̅̄}a | {101:𐌢̀́̂̃̅̄𐌢̀́̂̃̅̄}a |
{10:𠜎̀́̂̃̄̅}b | {101:𠜎̀́̂̃̄̅}b |
{7: }^ | {7: }^ |
{1:~ }|*10 {1:~ }|*10
| |
@@ -45,9 +51,9 @@ describe('Signs', function()
sign place 3 line=1 name=pietx buffer=1 sign place 3 line=1 name=pietx buffer=1
]]) ]])
screen:expect([[ screen:expect([[
{10:>!}a | {101:>!}a |
{7: }b | {7: }b |
{10:>>}c | {101:>>}c |
{7: }^ | {7: }^ |
{1:~ }|*9 {1:~ }|*9
| |
@@ -80,13 +86,13 @@ describe('Signs', function()
]]) ]])
screen:expect([[ screen:expect([[
{7: }{21:^a }| {7: }{21:^a }|
{10:>>}b | {101:>>}b |
{7: }c | {7: }c |
{7: } | {7: } |
{1:~ }|*2 {1:~ }|*2
{3:[No Name] [+] }| {3:[No Name] [+] }|
{7: }{21:a }| {7: }{21:a }|
{10:>>}b | {101:>>}b |
{7: }c | {7: }c |
{7: } | {7: } |
{1:~ }| {1:~ }|
@@ -110,16 +116,23 @@ describe('Signs', function()
sign place 6 line=4 name=pietxx buffer=1 sign place 6 line=4 name=pietxx buffer=1
]]) ]])
screen:expect([[ screen:expect([[
{10:>>}{8: 1 }a | {101:>>}{8: 1 }a |
{7: }{8: 2 }{9:b }| {7: }{8: 2 }{9:b }|
{7: }{13: 3 }c | {7: }{13: 3 }c |
{10:>>}{13: 4 }{9:^ }| {101:>>}{13: 4 }{9:^ }|
{1:~ }|*9 {1:~ }|*9
| |
]]) ]])
-- Check that 'statuscolumn' correctly applies numhl -- Check that 'statuscolumn' correctly applies numhl
exec('set statuscolumn=%s%=%l\\ ') exec('set statuscolumn=%s%=%l\\ ')
screen:expect_unchanged() screen:expect([[
{102:>>}{8: 1 }a |
{7: }{8: 2 }{9:b }|
{7: }{13: 3 }c |
{101:>>}{13: 4 }{9:^ }|
{1:~ }|*9
|
]])
end) end)
it('highlights the cursorline sign with culhl', function() it('highlights the cursorline sign with culhl', function()
@@ -132,33 +145,33 @@ describe('Signs', function()
set cursorline set cursorline
]]) ]])
screen:expect([[ screen:expect([[
{10:>>}a | {101:>>}a |
{10:>>}b | {101:>>}b |
{9:>>}{21:^c }| {9:>>}{21:^c }|
{1:~ }|*10 {1:~ }|*10
| |
]]) ]])
feed('k') feed('k')
screen:expect([[ screen:expect([[
{10:>>}a | {101:>>}a |
{9:>>}{21:^b }| {9:>>}{21:^b }|
{10:>>}c | {101:>>}c |
{1:~ }|*10 {1:~ }|*10
| |
]]) ]])
exec('set nocursorline') exec('set nocursorline')
screen:expect([[ screen:expect([[
{10:>>}a | {101:>>}a |
{10:>>}^b | {101:>>}^b |
{10:>>}c | {101:>>}c |
{1:~ }|*10 {1:~ }|*10
| |
]]) ]])
exec('set cursorline cursorlineopt=line') exec('set cursorline cursorlineopt=line')
screen:expect([[ screen:expect([[
{10:>>}a | {101:>>}a |
{10:>>}{21:^b }| {101:>>}{21:^b }|
{10:>>}c | {101:>>}c |
{1:~ }|*10 {1:~ }|*10
| |
]]) ]])
@@ -166,16 +179,24 @@ describe('Signs', function()
exec('hi! link SignColumn IncSearch') exec('hi! link SignColumn IncSearch')
feed('Go<esc>2G') feed('Go<esc>2G')
screen:expect([[ screen:expect([[
{10:>>}a | {103:>>}a |
{9:>>}^b | {104:>>}^b |
{10:>>}c | {103:>>}c |
{2: } | {2: } |
{1:~ }|*9 {1:~ }|*9
| |
]]) ]])
-- Check that 'statuscolumn' cursorline/signcolumn highlights are the same (#21726) -- Check that 'statuscolumn' cursorline/signcolumn highlights are the same (#21726)
exec('set statuscolumn=%s') exec('set statuscolumn=%s')
screen:expect_unchanged() screen:expect([[
{102:>>}a |
{105:>>}^b |
{102:>>}c |
{106: } |
{1:~ }|*9
|
]])
end) end)
it('multiple signs #9295', function() it('multiple signs #9295', function()
@@ -196,7 +217,7 @@ describe('Signs', function()
screen:expect([[ screen:expect([[
{7: }{8: 1 }a | {7: }{8: 1 }a |
{7: }{8: 2 }b | {7: }{8: 2 }b |
WW{10:>>}{8: 3 }c | {7:WW}{101:>>}{8: 3 }c |
{7: }{8: 4 }^ | {7: }{8: 4 }^ |
{1:~ }|*9 {1:~ }|*9
| |
@@ -209,9 +230,9 @@ describe('Signs', function()
sign place 3 line=2 name=pietError buffer=1 sign place 3 line=2 name=pietError buffer=1
]]) ]])
screen:expect([[ screen:expect([[
{9:XX}{10:>>}{8: 1 }a | {9:XX}{101:>>}{8: 1 }a |
{10:>>}{9:XX}{8: 2 }b | {101:>>}{9:XX}{8: 2 }b |
WW{10:>>}{8: 3 }c | {7:WW}{101:>>}{8: 3 }c |
{7: }{8: 4 }^ | {7: }{8: 4 }^ |
{1:~ }|*9 {1:~ }|*9
| |
@@ -220,8 +241,8 @@ describe('Signs', function()
exec('set signcolumn=yes:1') exec('set signcolumn=yes:1')
screen:expect([[ screen:expect([[
{9:XX}{8: 1 }a | {9:XX}{8: 1 }a |
{10:>>}{8: 2 }b | {101:>>}{8: 2 }b |
WW{8: 3 }c | {7:WW}{8: 3 }c |
{7: }{8: 4 }^ | {7: }{8: 4 }^ |
{1:~ }|*9 {1:~ }|*9
| |
@@ -229,9 +250,9 @@ describe('Signs', function()
-- "auto:3" accommodates all the signs we defined so far. -- "auto:3" accommodates all the signs we defined so far.
exec('set signcolumn=auto:3') exec('set signcolumn=auto:3')
local s3 = [[ local s3 = [[
{9:XX}{10:>>}{7: }{8: 1 }a | {9:XX}{101:>>}{7: }{8: 1 }a |
{10:>>}{9:XX}{7: }{8: 2 }b | {101:>>}{9:XX}{7: }{8: 2 }b |
WW{10:>>}{9:XX}{8: 3 }c | {7:WW}{101:>>}{9:XX}{8: 3 }c |
{7: }{8: 4 }^ | {7: }{8: 4 }^ |
{1:~ }|*9 {1:~ }|*9
| |
@@ -240,9 +261,9 @@ describe('Signs', function()
-- Check "yes:9". -- Check "yes:9".
exec('set signcolumn=yes:9') exec('set signcolumn=yes:9')
screen:expect([[ screen:expect([[
{9:XX}{10:>>}{7: }{8: 1 }a | {9:XX}{101:>>}{7: }{8: 1 }a |
{10:>>}{9:XX}{7: }{8: 2 }b | {101:>>}{9:XX}{7: }{8: 2 }b |
WW{10:>>}{9:XX}{7: }{8: 3 }c | {7:WW}{101:>>}{9:XX}{7: }{8: 3 }c |
{7: }{8: 4 }^ | {7: }{8: 4 }^ |
{1:~ }|*9 {1:~ }|*9
| |
@@ -255,8 +276,8 @@ describe('Signs', function()
exec('3move1') exec('3move1')
exec('2d') exec('2d')
screen:expect([[ screen:expect([[
{9:XX}{10:>>}{8: 1 }a | {9:XX}{101:>>}{8: 1 }a |
{10:>>}{9:XX}{8: 2 }^b | {101:>>}{9:XX}{8: 2 }^b |
{7: }{8: 3 } | {7: }{8: 3 } |
{1:~ }|*10 {1:~ }|*10
| |
@@ -264,8 +285,8 @@ describe('Signs', function()
-- character deletion does not delete signs. -- character deletion does not delete signs.
feed('x') feed('x')
screen:expect([[ screen:expect([[
{9:XX}{10:>>}{8: 1 }a | {9:XX}{101:>>}{8: 1 }a |
{10:>>}{9:XX}{8: 2 }^ | {101:>>}{9:XX}{8: 2 }^ |
{7: }{8: 3 } | {7: }{8: 3 } |
{1:~ }|*10 {1:~ }|*10
| |
@@ -301,7 +322,7 @@ describe('Signs', function()
exec('sign define pietSearch text=>> texthl=Search') exec('sign define pietSearch text=>> texthl=Search')
exec('sign place 1 line=1 name=pietSearch buffer=1') exec('sign place 1 line=1 name=pietSearch buffer=1')
screen:expect([[ screen:expect([[
{10:>>}{7: }{8: 1 }a | {101:>>}{7: }{8: 1 }a |
{7: }{8: 2 }b | {7: }{8: 2 }b |
{7: }{8: 3 }c | {7: }{8: 3 }c |
{7: }{8: 4 }^ | {7: }{8: 4 }^ |
@@ -316,7 +337,7 @@ describe('Signs', function()
sign place 4 line=1 name=pietSearch buffer=1 sign place 4 line=1 name=pietSearch buffer=1
]]) ]])
screen:expect([[ screen:expect([[
{10:>>>>>>>>}{8: 1 }a | {101:>>>>>>>>}{8: 1 }a |
{7: }{8: 2 }b | {7: }{8: 2 }b |
{7: }{8: 3 }c | {7: }{8: 3 }c |
{7: }{8: 4 }^ | {7: }{8: 4 }^ |
@@ -328,7 +349,7 @@ describe('Signs', function()
screen:expect_unchanged() screen:expect_unchanged()
exec('sign unplace 4') exec('sign unplace 4')
screen:expect([[ screen:expect([[
{10:>>>>>>}{8: 1 }a | {101:>>>>>>}{8: 1 }a |
{7: }{8: 2 }b | {7: }{8: 2 }b |
{7: }{8: 3 }c | {7: }{8: 3 }c |
{7: }{8: 4 }^ | {7: }{8: 4 }^ |
@@ -345,7 +366,7 @@ describe('Signs', function()
sign place 8 line=1 name=pietSearch buffer=1 sign place 8 line=1 name=pietSearch buffer=1
]]) ]])
screen:expect([[ screen:expect([[
{10:>>>>>>>>>>}{8: 1 }a | {101:>>>>>>>>>>}{8: 1 }a |
{7: }{8: 2 }b | {7: }{8: 2 }b |
{7: }{8: 3 }c | {7: }{8: 3 }c |
{7: }{8: 4 }^ | {7: }{8: 4 }^ |
@@ -375,7 +396,7 @@ describe('Signs', function()
-- single column with 1 sign with text and one sign without -- single column with 1 sign with text and one sign without
exec('sign place 1 line=1 name=pietSearch buffer=1') exec('sign place 1 line=1 name=pietSearch buffer=1')
screen:expect([[ screen:expect([[
{10:>>}{8: 1 }a | {101:>>}{8: 1 }a |
{7: }{8: 2 }b | {7: }{8: 2 }b |
{7: }{8: 3 }c | {7: }{8: 3 }c |
{7: }{8: 4 }^ | {7: }{8: 4 }^ |
@@ -396,7 +417,7 @@ describe('Signs', function()
-- line number should be drawn if sign has no text -- line number should be drawn if sign has no text
-- no signcolumn, line number for "a" is Search, for "b" is Error, for "c" is LineNr -- no signcolumn, line number for "a" is Search, for "b" is Error, for "c" is LineNr
screen:expect([[ screen:expect([[
{10: >> }a | {101: >> }a |
{9: 2 }b | {9: 2 }b |
{8: 3 }c | {8: 3 }c |
{8: 4 }^ | {8: 4 }^ |
@@ -406,7 +427,7 @@ describe('Signs', function()
-- number column on wrapped part of a line should be empty -- number column on wrapped part of a line should be empty
feed('gg100aa<Esc>') feed('gg100aa<Esc>')
screen:expect([[ screen:expect([[
{10: >> }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa| {101: >> }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
{9: }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa| {9: }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
{9: }aa^a | {9: }aa^a |
{9: 2 }b | {9: 2 }b |
@@ -423,7 +444,7 @@ describe('Signs', function()
-- number column on virtual lines should be empty -- number column on virtual lines should be empty
screen:expect([[ screen:expect([[
{8: }VIRT LINES | {8: }VIRT LINES |
{10: >> }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa| {101: >> }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
{9: }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa| {9: }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
{9: }aa^a | {9: }aa^a |
{9: 2 }b | {9: 2 }b |
@@ -439,7 +460,7 @@ describe('Signs', function()
exec('sign place 100000 line=1 name=piet buffer=1') exec('sign place 100000 line=1 name=piet buffer=1')
feed(':sign place<cr>') feed(':sign place<cr>')
screen:expect([[ screen:expect([[
{10:>>} | {101:>>} |
{1:~ }|*6 {1:~ }|*6
{3: }| {3: }|
:sign place | :sign place |
@@ -452,7 +473,7 @@ describe('Signs', function()
feed('<cr>') feed('<cr>')
screen:expect([[ screen:expect([[
{10:>>}^ | {101:>>}^ |
{1:~ }|*12 {1:~ }|*12
| |
]]) ]])
@@ -470,7 +491,7 @@ describe('Signs', function()
{7: }a | {7: }a |
{7: }^c | {7: }^c |
{7: }d | {7: }d |
>>e | {7:>>}e |
{1:~ }|*9 {1:~ }|*9
| |
]]) ]])
@@ -498,7 +519,7 @@ describe('Signs', function()
{7: }b | {7: }b |
{7: }c | {7: }c |
{7: }d | {7: }d |
>>e | {7:>>}e |
{1:~ }|*7 {1:~ }|*7
| |
]]) ]])
@@ -550,7 +571,7 @@ describe('Signs', function()
exec('silent undo') exec('silent undo')
screen:expect([[ screen:expect([[
{7: }1 | {7: }1 |
S1^2 | {7:S1}^2 |
{7: }3 | {7: }3 |
{7: }4 | {7: }4 |
{1:~ }|*9 {1:~ }|*9
@@ -575,23 +596,19 @@ describe('Signs', function()
sign place 2 line=9 name=S2 sign place 2 line=9 name=S2
]]) ]])
-- Now placed at end of buffer -- Now placed at end of buffer
local s1 = { local s1 = [[
grid = [[ {7:S2}^ |
S2^ |
{1:~ }|*12 {1:~ }|*12
| |
]], ]]
}
screen:expect(s1) screen:expect(s1)
-- Signcolumn tracking used to not count signs placed beyond end of buffer here -- Signcolumn tracking used to not count signs placed beyond end of buffer here
exec('set signcolumn=auto:9') exec('set signcolumn=auto:9')
screen:expect({ screen:expect([[
grid = [[ {7:S2S1}^ |
S2S1^ |
{1:~ }|*12 {1:~ }|*12
| |
]], ]])
})
-- Unplacing the sign does not crash by decrementing tracked signs below zero -- Unplacing the sign does not crash by decrementing tracked signs below zero
exec('sign unplace 1') exec('sign unplace 1')
screen:expect(s1) screen:expect(s1)
@@ -658,7 +675,7 @@ describe('Signs', function()
{7: }497 │{7: }2 | {7: }497 │{7: }2 |
{7: }498 │{7: }3 | {7: }498 │{7: }3 |
{7: }499 │{7: }4 | {7: }499 │{7: }4 |
! ^500 │{7: }5 | {7:! }^500 │{7: }5 |
{3:[No Name] [+] }{2:[No Name] [+] }| {3:[No Name] [+] }{2:[No Name] [+] }|
| |
]]) ]])
@@ -675,7 +692,7 @@ describe('Signs', function()
{7: }497 │{7: }2 | {7: }497 │{7: }2 |
{7: }498 │{7: }3 | {7: }498 │{7: }3 |
{7: }499 │{7: }4 | {7: }499 │{7: }4 |
! ^500 │{7: }5 | {7:! }^500 │{7: }5 |
{3:[No Name] [+] }{2:[No Name] [+] }| {3:[No Name] [+] }{2:[No Name] [+] }|
:lua log, needs_clear = {}, true | :lua log, needs_clear = {}, true |
]]) ]])

View File

@@ -236,6 +236,11 @@ describe('statuscolumn', function()
command("call setline(1,repeat([repeat('aaaaa',10)],16))") command("call setline(1,repeat([repeat('aaaaa',10)],16))")
screen:add_extra_attr_ids { screen:add_extra_attr_ids {
[100] = { foreground = Screen.colors.Red, background = Screen.colors.LightGray }, [100] = { foreground = Screen.colors.Red, background = Screen.colors.LightGray },
[101] = {
bold = true,
background = Screen.colors.WebGray,
foreground = Screen.colors.DarkBlue,
},
} }
command('hi! CursorLine guifg=Red guibg=NONE') command('hi! CursorLine guifg=Red guibg=NONE')
screen:expect([[ screen:expect([[
@@ -308,7 +313,7 @@ describe('statuscolumn', function()
{7: }{8: │}{7: }{8: }aaaaaa | {7: }{8: │}{7: }{8: }aaaaaa |
{7: }{8: 7│}{7: }{8: }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa| {7: }{8: 7│}{7: }{8: }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
{7: }{8: │}{7: }{8: }aaaaaa | {7: }{8: │}{7: }{8: }aaaaaa |
{7:+}{15: 8│}{7: }{15: }{100:^+-- 1 line: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa}| {101:+}{15: 8│}{101: }{15: }{100:^+-- 1 line: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa}|
{7: }{8: 9│}{7: }{8: }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa| {7: }{8: 9│}{7: }{8: }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
{7: }{8: │}{7: }{8: }aaaaaa | {7: }{8: │}{7: }{8: }aaaaaa |
{7: }{8:10│}{7: }{8: }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa| {7: }{8:10│}{7: }{8: }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
@@ -326,7 +331,7 @@ describe('statuscolumn', function()
{7: }{8: 6│}{7: }{8: }aaaaaa | {7: }{8: 6│}{7: }{8: }aaaaaa |
{7: }{8: 7│}{7: }{8: }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa| {7: }{8: 7│}{7: }{8: }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
{7: }{8: 7│}{7: }{8: }aaaaaa | {7: }{8: 7│}{7: }{8: }aaaaaa |
{7:+}{15: 8│}{7: }{15: }{100:^+-- 1 line: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa}| {101:+}{15: 8│}{101: }{15: }{100:^+-- 1 line: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa}|
{7: }{8: 9│}{7: }{8: }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa| {7: }{8: 9│}{7: }{8: }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
{7: }{8: 9│}{7: }{8: }aaaaaa | {7: }{8: 9│}{7: }{8: }aaaaaa |
{7: }{8:10│}{7: }{8: }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa| {7: }{8:10│}{7: }{8: }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
@@ -344,7 +349,7 @@ describe('statuscolumn', function()
{7: }{8: 2│}{7: }{8: }aaaaaaa | {7: }{8: 2│}{7: }{8: }aaaaaaa |
{7: }{8: 1│}{7: }{8: }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa| {7: }{8: 1│}{7: }{8: }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
{7: }{8: 1│}{7: }{8: }aaaaaaa | {7: }{8: 1│}{7: }{8: }aaaaaaa |
{7:+}{15: 0│}{7: }{15: }{100:^+-- 1 line: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa}| {101:+}{15: 0│}{101: }{15: }{100:^+-- 1 line: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa}|
{7: }{8: 1│}{7: }{8: }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa| {7: }{8: 1│}{7: }{8: }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
{7: }{8: 1│}{7: }{8: }aaaaaaa | {7: }{8: 1│}{7: }{8: }aaaaaaa |
{7: }{8: 2│}{7: }{8: }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa| {7: }{8: 2│}{7: }{8: }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
@@ -361,7 +366,7 @@ describe('statuscolumn', function()
{7: }{8: │}{7: }{8: }aaaaaaa | {7: }{8: │}{7: }{8: }aaaaaaa |
{7: }{8: 1│}{7: }{8: }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa| {7: }{8: 1│}{7: }{8: }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
{7: }{8: │}{7: }{8: }aaaaaaa | {7: }{8: │}{7: }{8: }aaaaaaa |
{7:+}{15: 0│}{7: }{15: }{100:^+-- 1 line: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa}| {101:+}{15: 0│}{101: }{15: }{100:^+-- 1 line: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa}|
{7: }{8: 1│}{7: }{8: }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa| {7: }{8: 1│}{7: }{8: }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
{7: }{8: │}{7: }{8: }aaaaaaa | {7: }{8: │}{7: }{8: }aaaaaaa |
{7: }{8: 2│}{7: }{8: }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa| {7: }{8: 2│}{7: }{8: }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
@@ -386,7 +391,7 @@ describe('statuscolumn', function()
{7: }{8: │}{7: }{8: }aaaaaaaaaaaaaaaaaaaaa | {7: }{8: │}{7: }{8: }aaaaaaaaaaaaaaaaaaaaa |
{7: }{8: 1│}{7: }{8: }aaaaaaaaaaaaaaaaaaaaaaaaaaaaa| {7: }{8: 1│}{7: }{8: }aaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
{7: }{8: │}{7: }{8: }aaaaaaaaaaaaaaaaaaaaa | {7: }{8: │}{7: }{8: }aaaaaaaaaaaaaaaaaaaaa |
{7:+}{15: 0│}{7: }{15: }{100:^+-- 1 line: aaaaaaaaaaaaaaaa}| {101:+}{15: 0│}{101: }{15: }{100:^+-- 1 line: aaaaaaaaaaaaaaaa}|
{7: }{8: 1│}{7: }{8: }aaaaaaaaaaaaaaaaaaaaaaaaaaaaa| {7: }{8: 1│}{7: }{8: }aaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
{7: }{8: │}{7: }{8: }aaaaaaaaaaaaaaaaaaaaa | {7: }{8: │}{7: }{8: }aaaaaaaaaaaaaaaaaaaaa |
{7: }{8: 2│}{7: }{8: }aaaaaaaaaaaaaaaaaaaaaaaaaaaaa| {7: }{8: 2│}{7: }{8: }aaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
@@ -397,7 +402,7 @@ describe('statuscolumn', function()
command('set cpoptions+=n') command('set cpoptions+=n')
feed('Hgjg0') feed('Hgjg0')
screen:expect([[ screen:expect([[
{7: }{15: 0│}{8:>>}{7: }{15: }{19:aaaaaaaaaaaaaaaaaaaaaaaaaaaaa}| {101: }{15: 0│>>}{101: }{15: }{19:aaaaaaaaaaaaaaaaaaaaaaaaaaaaa}|
{7: }{19:^aaaaaaaaaaaaaaaaaaaaa }| {7: }{19:^aaaaaaaaaaaaaaaaaaaaa }|
{7: }{8: 3│}{1:>!}{7: }{8: }aaaaaaaaaaaaaaaaaaaaaaaaaaaaa| {7: }{8: 3│}{1:>!}{7: }{8: }aaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
{7: }aaaaaaaaaaaaaaaaaaaaa | {7: }aaaaaaaaaaaaaaaaaaaaa |
@@ -416,7 +421,7 @@ describe('statuscolumn', function()
command('sign unplace 2') command('sign unplace 2')
feed('J2gjg0') feed('J2gjg0')
screen:expect([[ screen:expect([[
{7: }{15: 0│}{8:>>}{7: }{15: }{19:aaaaaaaaaaaaaaaaaaaaaaaaaaaaa}| {101: }{15: 0│>>}{101: }{15: }{19:aaaaaaaaaaaaaaaaaaaaaaaaaaaaa}|
{7: } {19:aaaaaaaaaaaaaaaaaaaaa aaaaaaa}| {7: } {19:aaaaaaaaaaaaaaaaaaaaa aaaaaaa}|
{7: } {19:aaaaaaaaaaaaaaaaaaaaaaaaaaaaa}| {7: } {19:aaaaaaaaaaaaaaaaaaaaaaaaaaaaa}|
{7: } {19:^aaaaaaaaaaaaaa }| {7: } {19:^aaaaaaaaaaaaaa }|
@@ -434,7 +439,7 @@ describe('statuscolumn', function()
command('set nobreakindent') command('set nobreakindent')
feed('$g0') feed('$g0')
screen:expect([[ screen:expect([[
{7: }{15: 0│}{8:>>}{7: }{15: }{19:aaaaaaaaaaaaaaaaaaaaaaaaaaaaa}| {101: }{15: 0│>>}{101: }{15: }{19:aaaaaaaaaaaaaaaaaaaaaaaaaaaaa}|
{7: }{19:aaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaa}| {7: }{19:aaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaa}|
{7: }{19:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa}| {7: }{19:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa}|
{7: }{19:^aaaa }| {7: }{19:^aaaa }|