diff options
Diffstat (limited to 'test/functional/ui/sign_spec.lua')
-rw-r--r-- | test/functional/ui/sign_spec.lua | 358 |
1 files changed, 173 insertions, 185 deletions
diff --git a/test/functional/ui/sign_spec.lua b/test/functional/ui/sign_spec.lua index 30da79af47..7874c04c39 100644 --- a/test/functional/ui/sign_spec.lua +++ b/test/functional/ui/sign_spec.lua @@ -12,21 +12,9 @@ describe('Signs', function() before_each(function() clear() screen = Screen.new() - screen:attach() - screen:set_default_attr_ids({ - [0] = { bold = true, foreground = 255 }, - [1] = { background = Screen.colors.Yellow }, - [2] = { foreground = Screen.colors.DarkBlue, background = Screen.colors.Grey }, - [3] = { background = Screen.colors.Gray90 }, - [4] = { bold = true, reverse = true }, - [5] = { reverse = true }, - [6] = { foreground = Screen.colors.Brown }, - [7] = { foreground = Screen.colors.DarkBlue, background = Screen.colors.LightGrey }, - [8] = { foreground = Screen.colors.Grey100, background = Screen.colors.Red }, - [9] = { bold = true, foreground = Screen.colors.Magenta }, - [10] = { foreground = Screen.colors.Blue1 }, - [11] = { bold = true, foreground = Screen.colors.SeaGreen4 }, - }) + screen:add_extra_attr_ids { + [100] = { bold = true, foreground = Screen.colors.Magenta1 }, + } end) describe(':sign place', function() @@ -39,10 +27,10 @@ describe('Signs', function() sign place 2 line=2 name=piet2 buffer=1 ]]) screen:expect([[ - {1:𐌢̀́̂̃̅̄𐌢̀́̂̃̅̄}a | - {1:𠜎̀́̂̃̄̅}b | - {2: }^ | - {0:~ }|*10 + {10:𐌢̀́̂̃̅̄𐌢̀́̂̃̅̄}a | + {10:𠜎̀́̂̃̄̅}b | + {7: }^ | + {1:~ }|*10 | ]]) end) @@ -57,11 +45,11 @@ describe('Signs', function() sign place 3 line=1 name=pietx buffer=1 ]]) screen:expect([[ - {1:>!}a | - {2: }b | - {1:>>}c | - {2: }^ | - {0:~ }|*9 + {10:>!}a | + {7: }b | + {10:>>}c | + {7: }^ | + {1:~ }|*9 | ]]) end) @@ -74,7 +62,7 @@ describe('Signs', function() a | b | ^ | - {0:~ }|*10 + {1:~ }|*10 | ]]) end) @@ -91,18 +79,18 @@ describe('Signs', function() sign place 3 line=2 name=piet buffer=1 ]]) screen:expect([[ - {2: }{3:^a }| - {1:>>}b | - {2: }c | - {2: } | - {0:~ }|*2 - {4:[No Name] [+] }| - {2: }{3:a }| - {1:>>}b | - {2: }c | - {2: } | - {0:~ }| - {5:[No Name] [+] }| + {7: }{21:^a }| + {10:>>}b | + {7: }c | + {7: } | + {1:~ }|*2 + {3:[No Name] [+] }| + {7: }{21:a }| + {10:>>}b | + {7: }c | + {7: } | + {1:~ }| + {2:[No Name] [+] }| | ]]) end) @@ -122,11 +110,11 @@ describe('Signs', function() sign place 6 line=4 name=pietxx buffer=1 ]]) screen:expect([[ - {1:>>}{6: 1 }a | - {2: }{6: 2 }{8:b }| - {2: }{7: 3 }c | - {1:>>}{7: 4 }{8:^ }| - {0:~ }|*9 + {10:>>}{8: 1 }a | + {7: }{8: 2 }{9:b }| + {7: }{13: 3 }c | + {10:>>}{13: 4 }{9:^ }| + {1:~ }|*9 | ]]) -- Check that 'statuscolumn' correctly applies numhl @@ -144,45 +132,45 @@ describe('Signs', function() set cursorline ]]) screen:expect([[ - {1:>>}a | - {1:>>}b | - {8:>>}{3:^c }| - {0:~ }|*10 + {10:>>}a | + {10:>>}b | + {9:>>}{21:^c }| + {1:~ }|*10 | ]]) feed('k') screen:expect([[ - {1:>>}a | - {8:>>}{3:^b }| - {1:>>}c | - {0:~ }|*10 + {10:>>}a | + {9:>>}{21:^b }| + {10:>>}c | + {1:~ }|*10 | ]]) exec('set nocursorline') screen:expect([[ - {1:>>}a | - {1:>>}^b | - {1:>>}c | - {0:~ }|*10 + {10:>>}a | + {10:>>}^b | + {10:>>}c | + {1:~ }|*10 | ]]) exec('set cursorline cursorlineopt=line') screen:expect([[ - {1:>>}a | - {1:>>}{3:^b }| - {1:>>}c | - {0:~ }|*10 + {10:>>}a | + {10:>>}{21:^b }| + {10:>>}c | + {1:~ }|*10 | ]]) exec('set cursorlineopt=number') exec('hi! link SignColumn IncSearch') feed('Go<esc>2G') screen:expect([[ - {1:>>}a | - {8:>>}^b | - {1:>>}c | - {5: } | - {0:~ }|*9 + {10:>>}a | + {9:>>}^b | + {10:>>}c | + {2: } | + {1:~ }|*9 | ]]) -- Check that 'statuscolumn' cursorline/signcolumn highlights are the same (#21726) @@ -206,11 +194,11 @@ describe('Signs', function() -- of signs, the ones with the highest Ids are being picked, -- and presented by their sorted Id order. screen:expect([[ - {2: }{6: 1 }a | - {2: }{6: 2 }b | - WW{1:>>}{6: 3 }c | - {2: }{6: 4 }^ | - {0:~ }|*9 + {7: }{8: 1 }a | + {7: }{8: 2 }b | + WW{10:>>}{8: 3 }c | + {7: }{8: 4 }^ | + {1:~ }|*9 | ]]) exec([[ @@ -221,42 +209,42 @@ describe('Signs', function() sign place 3 line=2 name=pietError buffer=1 ]]) screen:expect([[ - {8:XX}{1:>>}{6: 1 }a | - {1:>>}{8:XX}{6: 2 }b | - WW{1:>>}{6: 3 }c | - {2: }{6: 4 }^ | - {0:~ }|*9 + {9:XX}{10:>>}{8: 1 }a | + {10:>>}{9:XX}{8: 2 }b | + WW{10:>>}{8: 3 }c | + {7: }{8: 4 }^ | + {1:~ }|*9 | ]]) -- With the default setting, we get the sign with the top id. exec('set signcolumn=yes:1') screen:expect([[ - {8:XX}{6: 1 }a | - {1:>>}{6: 2 }b | - WW{6: 3 }c | - {2: }{6: 4 }^ | - {0:~ }|*9 + {9:XX}{8: 1 }a | + {10:>>}{8: 2 }b | + WW{8: 3 }c | + {7: }{8: 4 }^ | + {1:~ }|*9 | ]]) -- "auto:3" accommodates all the signs we defined so far. exec('set signcolumn=auto:3') local s3 = [[ - {8:XX}{1:>>}{2: }{6: 1 }a | - {1:>>}{8:XX}{2: }{6: 2 }b | - WW{1:>>}{8:XX}{6: 3 }c | - {2: }{6: 4 }^ | - {0:~ }|*9 + {9:XX}{10:>>}{7: }{8: 1 }a | + {10:>>}{9:XX}{7: }{8: 2 }b | + WW{10:>>}{9:XX}{8: 3 }c | + {7: }{8: 4 }^ | + {1:~ }|*9 | ]] screen:expect(s3) -- Check "yes:9". exec('set signcolumn=yes:9') screen:expect([[ - {8:XX}{1:>>}{2: }{6: 1 }a | - {1:>>}{8:XX}{2: }{6: 2 }b | - WW{1:>>}{8:XX}{2: }{6: 3 }c | - {2: }{6: 4 }^ | - {0:~ }|*9 + {9:XX}{10:>>}{7: }{8: 1 }a | + {10:>>}{9:XX}{7: }{8: 2 }b | + WW{10:>>}{9:XX}{7: }{8: 3 }c | + {7: }{8: 4 }^ | + {1:~ }|*9 | ]]) -- Check "auto:N" larger than the maximum number of signs defined in @@ -267,19 +255,19 @@ describe('Signs', function() exec('3move1') exec('2d') screen:expect([[ - {8:XX}{1:>>}{6: 1 }a | - {1:>>}{8:XX}{6: 2 }^b | - {2: }{6: 3 } | - {0:~ }|*10 + {9:XX}{10:>>}{8: 1 }a | + {10:>>}{9:XX}{8: 2 }^b | + {7: }{8: 3 } | + {1:~ }|*10 | ]]) -- character deletion does not delete signs. feed('x') screen:expect([[ - {8:XX}{1:>>}{6: 1 }a | - {1:>>}{8:XX}{6: 2 }^ | - {2: }{6: 3 } | - {0:~ }|*10 + {9:XX}{10:>>}{8: 1 }a | + {10:>>}{9:XX}{8: 2 }^ | + {7: }{8: 3 } | + {1:~ }|*10 | ]]) end) @@ -290,21 +278,21 @@ describe('Signs', function() -- sign column should always accommodate at the minimum size exec('set signcolumn=auto:1-3') screen:expect([[ - {2: }{6: 1 }a | - {2: }{6: 2 }b | - {2: }{6: 3 }c | - {2: }{6: 4 }^ | - {0:~ }|*9 + {7: }{8: 1 }a | + {7: }{8: 2 }b | + {7: }{8: 3 }c | + {7: }{8: 4 }^ | + {1:~ }|*9 | ]]) -- should support up to 8 signs at minimum exec('set signcolumn=auto:8-9') screen:expect([[ - {2: }{6: 1 }a | - {2: }{6: 2 }b | - {2: }{6: 3 }c | - {2: }{6: 4 }^ | - {0:~ }|*9 + {7: }{8: 1 }a | + {7: }{8: 2 }b | + {7: }{8: 3 }c | + {7: }{8: 4 }^ | + {1:~ }|*9 | ]]) -- should keep the same sign size when signs are not exceeding @@ -313,11 +301,11 @@ describe('Signs', function() exec('sign define pietSearch text=>> texthl=Search') exec('sign place 1 line=1 name=pietSearch buffer=1') screen:expect([[ - {1:>>}{2: }{6: 1 }a | - {2: }{6: 2 }b | - {2: }{6: 3 }c | - {2: }{6: 4 }^ | - {0:~ }|*9 + {10:>>}{7: }{8: 1 }a | + {7: }{8: 2 }b | + {7: }{8: 3 }c | + {7: }{8: 4 }^ | + {1:~ }|*9 | ]]) -- should resize itself when signs are exceeding minimum but @@ -328,11 +316,11 @@ describe('Signs', function() sign place 4 line=1 name=pietSearch buffer=1 ]]) screen:expect([[ - {1:>>>>>>>>}{6: 1 }a | - {2: }{6: 2 }b | - {2: }{6: 3 }c | - {2: }{6: 4 }^ | - {0:~ }|*9 + {10:>>>>>>>>}{8: 1 }a | + {7: }{8: 2 }b | + {7: }{8: 3 }c | + {7: }{8: 4 }^ | + {1:~ }|*9 | ]]) -- should not increase size because sign with existing id is moved @@ -340,11 +328,11 @@ describe('Signs', function() screen:expect_unchanged() exec('sign unplace 4') screen:expect([[ - {1:>>>>>>}{6: 1 }a | - {2: }{6: 2 }b | - {2: }{6: 3 }c | - {2: }{6: 4 }^ | - {0:~ }|*9 + {10:>>>>>>}{8: 1 }a | + {7: }{8: 2 }b | + {7: }{8: 3 }c | + {7: }{8: 4 }^ | + {1:~ }|*9 | ]]) exec('sign place 4 line=1 name=pietSearch buffer=1') @@ -357,11 +345,11 @@ describe('Signs', function() sign place 8 line=1 name=pietSearch buffer=1 ]]) screen:expect([[ - {1:>>>>>>>>>>}{6: 1 }a | - {2: }{6: 2 }b | - {2: }{6: 3 }c | - {2: }{6: 4 }^ | - {0:~ }|*9 + {10:>>>>>>>>>>}{8: 1 }a | + {7: }{8: 2 }b | + {7: }{8: 3 }c | + {7: }{8: 4 }^ | + {1:~ }|*9 | ]]) end) @@ -377,21 +365,21 @@ describe('Signs', function() ]]) -- no signcolumn with only empty sign screen:expect([[ - {6: 1 }a | - {6: 2 }b | - {6: 3 }c | - {6: 4 }^ | - {0:~ }|*9 + {8: 1 }a | + {8: 2 }b | + {8: 3 }c | + {8: 4 }^ | + {1:~ }|*9 | ]]) -- single column with 1 sign with text and one sign without exec('sign place 1 line=1 name=pietSearch buffer=1') screen:expect([[ - {1:>>}{6: 1 }a | - {2: }{6: 2 }b | - {2: }{6: 3 }c | - {2: }{6: 4 }^ | - {0:~ }|*9 + {10:>>}{8: 1 }a | + {7: }{8: 2 }b | + {7: }{8: 3 }c | + {7: }{8: 4 }^ | + {1:~ }|*9 | ]]) end) @@ -408,23 +396,23 @@ 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([[ - {1: >> }a | - {8: 2 }b | - {6: 3 }c | - {6: 4 }^ | - {0:~ }|*9 + {10: >> }a | + {9: 2 }b | + {8: 3 }c | + {8: 4 }^ | + {1:~ }|*9 | ]]) -- number column on wrapped part of a line should be empty feed('gg100aa<Esc>') screen:expect([[ - {1: >> }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa| - {8: }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa| - {8: }aa^a | - {8: 2 }b | - {6: 3 }c | - {6: 4 } | - {0:~ }|*7 + {10: >> }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa| + {9: }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa| + {9: }aa^a | + {9: 2 }b | + {8: 3 }c | + {8: 4 } | + {1:~ }|*7 | ]]) api.nvim_buf_set_extmark(0, api.nvim_create_namespace('test'), 0, 0, { @@ -434,14 +422,14 @@ describe('Signs', function() feed('<C-Y>') -- number column on virtual lines should be empty screen:expect([[ - {6: }VIRT LINES | - {1: >> }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa| - {8: }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa| - {8: }aa^a | - {8: 2 }b | - {6: 3 }c | - {6: 4 } | - {0:~ }|*6 + {8: }VIRT LINES | + {10: >> }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa| + {9: }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa| + {9: }aa^a | + {9: 2 }b | + {8: 3 }c | + {8: 4 } | + {1:~ }|*6 | ]]) end) @@ -451,21 +439,21 @@ describe('Signs', function() exec('sign place 100000 line=1 name=piet buffer=1') feed(':sign place<cr>') screen:expect([[ - {1:>>} | - {0:~ }|*6 - {4: }| + {10:>>} | + {1:~ }|*6 + {3: }| :sign place | - {9:--- Signs ---} | - {10:Signs for [NULL]:} | + {100:--- Signs ---} | + {18:Signs for [NULL]:} | line=1 id=100000 name=piet priority=10 | | - {11:Press ENTER or type command to continue}^ | + {6:Press ENTER or type command to continue}^ | ]]) feed('<cr>') screen:expect([[ - {1:>>}^ | - {0:~ }|*12 + {10:>>}^ | + {1:~ }|*12 | ]]) end) @@ -479,11 +467,11 @@ describe('Signs', function() exec('2delete') exec('sign unplace 10001') screen:expect([[ - {2: }a | - {2: }^c | - {2: }d | + {7: }a | + {7: }^c | + {7: }d | >>e | - {0:~ }|*9 + {1:~ }|*9 | ]]) exec('sign unplace 10002') @@ -492,7 +480,7 @@ describe('Signs', function() ^c | d | e | - {0:~ }|*9 + {1:~ }|*9 | ]]) end) @@ -505,13 +493,13 @@ describe('Signs', function() exec('copy .') exec('sign unplace 10001') screen:expect([[ - {2: }a | - {2: }^a | - {2: }b | - {2: }c | - {2: }d | + {7: }a | + {7: }^a | + {7: }b | + {7: }c | + {7: }d | >>e | - {0:~ }|*7 + {1:~ }|*7 | ]]) exec('sign unplace 10002') @@ -522,7 +510,7 @@ describe('Signs', function() c | d | e | - {0:~ }|*7 + {1:~ }|*7 | ]]) end) @@ -537,9 +525,9 @@ describe('Signs', function() call sign_place(0, '', 'foo', bufnr(''), { 'lnum':2 }) ]]) screen:expect([[ - {8: 1 }^line1 | - {8: 2 }line2 | - {6: 3 }line3 | + {9: 1 }^line1 | + {9: 2 }line2 | + {8: 3 }line3 | | ]]) end) @@ -561,11 +549,11 @@ describe('Signs', function() exec('norm 2Gdd') exec('silent undo') screen:expect([[ - {2: }1 | + {7: }1 | S1^2 | - {2: }3 | - {2: }4 | - {0:~ }|*9 + {7: }3 | + {7: }4 | + {1:~ }|*9 | ]]) end) @@ -590,7 +578,7 @@ describe('Signs', function() local s1 = { grid = [[ S2^ | - {0:~ }|*12 + {1:~ }|*12 | ]], } @@ -600,7 +588,7 @@ describe('Signs', function() screen:expect({ grid = [[ S2S1^ | - {0:~ }|*12 + {1:~ }|*12 | ]], }) |