diff options
author | luukvbaal <luukvbaal@gmail.com> | 2024-12-14 19:21:50 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-12-14 10:21:50 -0800 |
commit | 433b342baa04b35fb1ab24d4ef38f126d12ea714 (patch) | |
tree | 8200471944a5219b299f540b4766b827bac7fe8d /test/functional/ui/sign_spec.lua | |
parent | f9dd6826210335d8b37455002d767d1b37c09ce4 (diff) | |
download | rneovim-433b342baa04b35fb1ab24d4ef38f126d12ea714.tar.gz rneovim-433b342baa04b35fb1ab24d4ef38f126d12ea714.tar.bz2 rneovim-433b342baa04b35fb1ab24d4ef38f126d12ea714.zip |
feat(ui): sign/statuscolumn can combine highlight attrs #31575
Problem:
Since e049c6e4c08a, most statusline-like UI elements can combine
highlight attrs, except for sign/statuscolumn.
Solution:
Implement for sign/statuscolumn.
Diffstat (limited to 'test/functional/ui/sign_spec.lua')
-rw-r--r-- | test/functional/ui/sign_spec.lua | 153 |
1 files changed, 85 insertions, 68 deletions
diff --git a/test/functional/ui/sign_spec.lua b/test/functional/ui/sign_spec.lua index b7a2429ada..bd3887b44f 100644 --- a/test/functional/ui/sign_spec.lua +++ b/test/functional/ui/sign_spec.lua @@ -14,6 +14,12 @@ describe('Signs', function() screen = Screen.new() screen:add_extra_attr_ids { [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) @@ -27,8 +33,8 @@ describe('Signs', function() sign place 2 line=2 name=piet2 buffer=1 ]]) screen:expect([[ - {10:𐌢̀́̂̃̅̄𐌢̀́̂̃̅̄}a | - {10:𠜎̀́̂̃̄̅}b | + {101:𐌢̀́̂̃̅̄𐌢̀́̂̃̅̄}a | + {101:𠜎̀́̂̃̄̅}b | {7: }^ | {1:~ }|*10 | @@ -45,9 +51,9 @@ describe('Signs', function() sign place 3 line=1 name=pietx buffer=1 ]]) screen:expect([[ - {10:>!}a | + {101:>!}a | {7: }b | - {10:>>}c | + {101:>>}c | {7: }^ | {1:~ }|*9 | @@ -80,13 +86,13 @@ describe('Signs', function() ]]) screen:expect([[ {7: }{21:^a }| - {10:>>}b | + {101:>>}b | {7: }c | {7: } | {1:~ }|*2 {3:[No Name] [+] }| {7: }{21:a }| - {10:>>}b | + {101:>>}b | {7: }c | {7: } | {1:~ }| @@ -110,16 +116,23 @@ describe('Signs', function() sign place 6 line=4 name=pietxx buffer=1 ]]) screen:expect([[ - {10:>>}{8: 1 }a | + {101:>>}{8: 1 }a | {7: }{8: 2 }{9:b }| {7: }{13: 3 }c | - {10:>>}{13: 4 }{9:^ }| + {101:>>}{13: 4 }{9:^ }| {1:~ }|*9 | ]]) -- Check that 'statuscolumn' correctly applies numhl 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) it('highlights the cursorline sign with culhl', function() @@ -132,33 +145,33 @@ describe('Signs', function() set cursorline ]]) screen:expect([[ - {10:>>}a | - {10:>>}b | + {101:>>}a | + {101:>>}b | {9:>>}{21:^c }| {1:~ }|*10 | ]]) feed('k') screen:expect([[ - {10:>>}a | + {101:>>}a | {9:>>}{21:^b }| - {10:>>}c | + {101:>>}c | {1:~ }|*10 | ]]) exec('set nocursorline') screen:expect([[ - {10:>>}a | - {10:>>}^b | - {10:>>}c | + {101:>>}a | + {101:>>}^b | + {101:>>}c | {1:~ }|*10 | ]]) exec('set cursorline cursorlineopt=line') screen:expect([[ - {10:>>}a | - {10:>>}{21:^b }| - {10:>>}c | + {101:>>}a | + {101:>>}{21:^b }| + {101:>>}c | {1:~ }|*10 | ]]) @@ -166,16 +179,24 @@ describe('Signs', function() exec('hi! link SignColumn IncSearch') feed('Go<esc>2G') screen:expect([[ - {10:>>}a | - {9:>>}^b | - {10:>>}c | + {103:>>}a | + {104:>>}^b | + {103:>>}c | {2: } | {1:~ }|*9 | ]]) + -- Check that 'statuscolumn' cursorline/signcolumn highlights are the same (#21726) exec('set statuscolumn=%s') - screen:expect_unchanged() + screen:expect([[ + {102:>>}a | + {105:>>}^b | + {102:>>}c | + {106: } | + {1:~ }|*9 + | + ]]) end) it('multiple signs #9295', function() @@ -196,7 +217,7 @@ describe('Signs', function() screen:expect([[ {7: }{8: 1 }a | {7: }{8: 2 }b | - WW{10:>>}{8: 3 }c | + {7:WW}{101:>>}{8: 3 }c | {7: }{8: 4 }^ | {1:~ }|*9 | @@ -209,9 +230,9 @@ describe('Signs', function() sign place 3 line=2 name=pietError buffer=1 ]]) screen:expect([[ - {9:XX}{10:>>}{8: 1 }a | - {10:>>}{9:XX}{8: 2 }b | - WW{10:>>}{8: 3 }c | + {9:XX}{101:>>}{8: 1 }a | + {101:>>}{9:XX}{8: 2 }b | + {7:WW}{101:>>}{8: 3 }c | {7: }{8: 4 }^ | {1:~ }|*9 | @@ -220,8 +241,8 @@ describe('Signs', function() exec('set signcolumn=yes:1') screen:expect([[ {9:XX}{8: 1 }a | - {10:>>}{8: 2 }b | - WW{8: 3 }c | + {101:>>}{8: 2 }b | + {7:WW}{8: 3 }c | {7: }{8: 4 }^ | {1:~ }|*9 | @@ -229,9 +250,9 @@ describe('Signs', function() -- "auto:3" accommodates all the signs we defined so far. exec('set signcolumn=auto:3') local s3 = [[ - {9:XX}{10:>>}{7: }{8: 1 }a | - {10:>>}{9:XX}{7: }{8: 2 }b | - WW{10:>>}{9:XX}{8: 3 }c | + {9:XX}{101:>>}{7: }{8: 1 }a | + {101:>>}{9:XX}{7: }{8: 2 }b | + {7:WW}{101:>>}{9:XX}{8: 3 }c | {7: }{8: 4 }^ | {1:~ }|*9 | @@ -240,9 +261,9 @@ describe('Signs', function() -- Check "yes:9". exec('set signcolumn=yes:9') screen:expect([[ - {9:XX}{10:>>}{7: }{8: 1 }a | - {10:>>}{9:XX}{7: }{8: 2 }b | - WW{10:>>}{9:XX}{7: }{8: 3 }c | + {9:XX}{101:>>}{7: }{8: 1 }a | + {101:>>}{9:XX}{7: }{8: 2 }b | + {7:WW}{101:>>}{9:XX}{7: }{8: 3 }c | {7: }{8: 4 }^ | {1:~ }|*9 | @@ -255,8 +276,8 @@ describe('Signs', function() exec('3move1') exec('2d') screen:expect([[ - {9:XX}{10:>>}{8: 1 }a | - {10:>>}{9:XX}{8: 2 }^b | + {9:XX}{101:>>}{8: 1 }a | + {101:>>}{9:XX}{8: 2 }^b | {7: }{8: 3 } | {1:~ }|*10 | @@ -264,8 +285,8 @@ describe('Signs', function() -- character deletion does not delete signs. feed('x') screen:expect([[ - {9:XX}{10:>>}{8: 1 }a | - {10:>>}{9:XX}{8: 2 }^ | + {9:XX}{101:>>}{8: 1 }a | + {101:>>}{9:XX}{8: 2 }^ | {7: }{8: 3 } | {1:~ }|*10 | @@ -301,7 +322,7 @@ describe('Signs', function() exec('sign define pietSearch text=>> texthl=Search') exec('sign place 1 line=1 name=pietSearch buffer=1') screen:expect([[ - {10:>>}{7: }{8: 1 }a | + {101:>>}{7: }{8: 1 }a | {7: }{8: 2 }b | {7: }{8: 3 }c | {7: }{8: 4 }^ | @@ -316,7 +337,7 @@ describe('Signs', function() sign place 4 line=1 name=pietSearch buffer=1 ]]) screen:expect([[ - {10:>>>>>>>>}{8: 1 }a | + {101:>>>>>>>>}{8: 1 }a | {7: }{8: 2 }b | {7: }{8: 3 }c | {7: }{8: 4 }^ | @@ -328,7 +349,7 @@ describe('Signs', function() screen:expect_unchanged() exec('sign unplace 4') screen:expect([[ - {10:>>>>>>}{8: 1 }a | + {101:>>>>>>}{8: 1 }a | {7: }{8: 2 }b | {7: }{8: 3 }c | {7: }{8: 4 }^ | @@ -345,7 +366,7 @@ describe('Signs', function() sign place 8 line=1 name=pietSearch buffer=1 ]]) screen:expect([[ - {10:>>>>>>>>>>}{8: 1 }a | + {101:>>>>>>>>>>}{8: 1 }a | {7: }{8: 2 }b | {7: }{8: 3 }c | {7: }{8: 4 }^ | @@ -375,7 +396,7 @@ describe('Signs', function() -- single column with 1 sign with text and one sign without exec('sign place 1 line=1 name=pietSearch buffer=1') screen:expect([[ - {10:>>}{8: 1 }a | + {101:>>}{8: 1 }a | {7: }{8: 2 }b | {7: }{8: 3 }c | {7: }{8: 4 }^ | @@ -396,7 +417,7 @@ describe('Signs', function() -- 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 screen:expect([[ - {10: >> }a | + {101: >> }a | {9: 2 }b | {8: 3 }c | {8: 4 }^ | @@ -406,7 +427,7 @@ describe('Signs', function() -- number column on wrapped part of a line should be empty feed('gg100aa<Esc>') screen:expect([[ - {10: >> }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa| + {101: >> }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa| {9: }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa| {9: }aa^a | {9: 2 }b | @@ -423,7 +444,7 @@ describe('Signs', function() -- number column on virtual lines should be empty screen:expect([[ {8: }VIRT LINES | - {10: >> }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa| + {101: >> }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa| {9: }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa| {9: }aa^a | {9: 2 }b | @@ -439,7 +460,7 @@ describe('Signs', function() exec('sign place 100000 line=1 name=piet buffer=1') feed(':sign place<cr>') screen:expect([[ - {10:>>} | + {101:>>} | {1:~ }|*6 {3: }| :sign place | @@ -452,7 +473,7 @@ describe('Signs', function() feed('<cr>') screen:expect([[ - {10:>>}^ | + {101:>>}^ | {1:~ }|*12 | ]]) @@ -470,7 +491,7 @@ describe('Signs', function() {7: }a | {7: }^c | {7: }d | - >>e | + {7:>>}e | {1:~ }|*9 | ]]) @@ -498,7 +519,7 @@ describe('Signs', function() {7: }b | {7: }c | {7: }d | - >>e | + {7:>>}e | {1:~ }|*7 | ]]) @@ -550,7 +571,7 @@ describe('Signs', function() exec('silent undo') screen:expect([[ {7: }1 | - S1^2 | + {7:S1}^2 | {7: }3 | {7: }4 | {1:~ }|*9 @@ -575,23 +596,19 @@ describe('Signs', function() sign place 2 line=9 name=S2 ]]) -- Now placed at end of buffer - local s1 = { - grid = [[ - S2^ | - {1:~ }|*12 - | - ]], - } + local s1 = [[ + {7:S2}^ | + {1:~ }|*12 + | + ]] screen:expect(s1) -- Signcolumn tracking used to not count signs placed beyond end of buffer here exec('set signcolumn=auto:9') - screen:expect({ - grid = [[ - S2S1^ | - {1:~ }|*12 - | - ]], - }) + screen:expect([[ + {7:S2S1}^ | + {1:~ }|*12 + | + ]]) -- Unplacing the sign does not crash by decrementing tracked signs below zero exec('sign unplace 1') screen:expect(s1) @@ -658,7 +675,7 @@ describe('Signs', function() {7: }497 │{7: }2 | {7: }498 │{7: }3 | {7: }499 │{7: }4 | - ! ^500 │{7: }5 | + {7:! }^500 │{7: }5 | {3:[No Name] [+] }{2:[No Name] [+] }| | ]]) @@ -675,7 +692,7 @@ describe('Signs', function() {7: }497 │{7: }2 | {7: }498 │{7: }3 | {7: }499 │{7: }4 | - ! ^500 │{7: }5 | + {7:! }^500 │{7: }5 | {3:[No Name] [+] }{2:[No Name] [+] }| :lua log, needs_clear = {}, true | ]]) |