tests/ui: Also test character at cursor

This commit is contained in:
Björn Linse
2015-03-05 10:07:55 +01:00
committed by Thiago de Arruda
parent 638452da2a
commit a7aeda8c7a
9 changed files with 57 additions and 58 deletions

View File

@@ -28,7 +28,7 @@ describe(':highlight', function()
gui=bold |
guifg=Blue |
Directory xxx ctermfg=4 |
-- More --^ |
-- More --^ |
]])
feed('q')
wait() -- wait until we're back to normal

View File

@@ -43,7 +43,7 @@ describe('107', function()
start: |
[1, '1 '] |
[50, '50 '] |
^59, '59 '] |
^[59, '59 '] |
~ |
~ |
~ |

View File

@@ -60,7 +60,7 @@ describe('system()', function()
it('`echo` and waits for its return', function()
feed(':call system("echo")<cr>')
screen:expect([[
^ |
^ |
~ |
~ |
~ |
@@ -93,11 +93,11 @@ describe('system()', function()
~ |
~ |
~ |
^call system("yes") |
^:call system("yes") |
]])
feed('<c-c>')
screen:expect([[
^ |
^ |
~ |
~ |
~ |
@@ -226,7 +226,7 @@ describe('systemlist()', function()
it('`echo` and waits for its return', function()
feed(':call systemlist("echo")<cr>')
screen:expect([[
^ |
^ |
~ |
~ |
~ |
@@ -259,11 +259,11 @@ describe('systemlist()', function()
~ |
~ |
~ |
^call systemlist("yes | xargs") |
^:call systemlist("yes | xargs") |
]])
feed('<c-c>')
screen:expect([[
^ |
^ |
~ |
~ |
~ |

View File

@@ -54,7 +54,7 @@ describe('Default highlight groups', function()
})
execute('sp', 'vsp', 'vsp')
screen:expect([[
^ {2:|} {2:|} |
^ {2:|} {2:|} |
~ {2:|}~ {2:|}~ |
~ {2:|}~ {2:|}~ |
~ {2:|}~ {2:|}~ |
@@ -79,7 +79,7 @@ describe('Default highlight groups', function()
~ {2:|}~ {2:|}~ |
~ {2:|}~ {2:|}~ |
{2:[No Name] [No Name] [No Name] }|
^ |
^ |
~ |
~ |
~ |
@@ -92,7 +92,7 @@ describe('Default highlight groups', function()
-- (upstream vim has the same behavior)
feed('<c-w>k<c-w>l')
screen:expect([[
{2:|}^ {2:|} |
{2:|}^ {2:|} |
~ {2:|}~ {2:|}~ |
~ {2:|}~ {2:|}~ |
~ {2:|}~ {2:|}~ |
@@ -109,7 +109,7 @@ describe('Default highlight groups', function()
]])
feed('<c-w>l')
screen:expect([[
{2:|} {2:|}^ |
{2:|} {2:|}^ |
~ {2:|}~ {2:|}~ |
~ {2:|}~ {2:|}~ |
~ {2:|}~ {2:|}~ |
@@ -126,7 +126,7 @@ describe('Default highlight groups', function()
]])
feed('<c-w>h<c-w>h')
screen:expect([[
^ {2:|} {2:|} |
^ {2:|} {2:|} |
~ {2:|}~ {2:|}~ |
~ {2:|}~ {2:|}~ |
~ {2:|}~ {2:|}~ |
@@ -146,7 +146,7 @@ describe('Default highlight groups', function()
it('insert mode text', function()
feed('i')
screen:expect([[
^ |
^ |
~ |
~ |
~ |
@@ -165,7 +165,7 @@ describe('Default highlight groups', function()
it('end of file markers', function()
screen:expect([[
^ |
^ |
{1:~ }|
{1:~ }|
{1:~ }|
@@ -198,7 +198,7 @@ describe('Default highlight groups', function()
~ |
:ls |
1 %a "[No Name]" line 1 |
{1:Press ENTER or type command to continue}^ |
{1:Press ENTER or type command to continue}^ |
]], {[1] = {bold = true, foreground = hlgroup_colors.Question}})
feed('<cr>') -- skip the "Press ENTER..." state or tests will hang
end)

View File

@@ -28,7 +28,7 @@ describe('Mouse input', function()
screen:expect([[
testing |
mouse |
support and selectio^ |
support and selectio^n |
~ |
|
]])
@@ -42,14 +42,14 @@ describe('Mouse input', function()
feed('<LeftMouse><2,1>')
screen:expect([[
testing |
mo^se |
mo^use |
support and selection |
~ |
|
]])
feed('<LeftMouse><0,0>')
screen:expect([[
^esting |
^testing |
mouse |
support and selection |
~ |
@@ -62,7 +62,7 @@ describe('Mouse input', function()
feed('<LeftMouse><2,1>')
screen:expect([[
testing |
mo^se |
mo^use |
support and selection |
~ |
|
@@ -70,7 +70,7 @@ describe('Mouse input', function()
feed('<LeftDrag><4,1>')
screen:expect([[
testing |
mo{1:us}^ |
mo{1:us}^e |
support and selection |
~ |
{2:-- VISUAL --} |
@@ -79,13 +79,13 @@ describe('Mouse input', function()
screen:expect([[
testing |
mo{1:use } |
{1:su}^port and selection |
{1:su}^pport and selection |
~ |
{2:-- VISUAL --} |
]])
feed('<LeftDrag><0,0>')
screen:expect([[
^{1:esting } |
^t{1:esting } |
{1:mou}se |
support and selection |
~ |
@@ -98,7 +98,7 @@ describe('Mouse input', function()
screen:expect([[
testing |
mouse |
{1:suppor}^ and selection |
{1:suppor}^t and selection |
~ |
{2:-- VISUAL --} |
]])
@@ -109,7 +109,7 @@ describe('Mouse input', function()
screen:expect([[
testing |
mouse |
{1:su}^{1:port and selection } |
{1:su}^p{1:port and selection } |
~ |
{2:-- VISUAL LINE --} |
]])
@@ -120,7 +120,7 @@ describe('Mouse input', function()
screen:expect([[
testing |
mouse |
su^port and selection |
su^pport and selection |
~ |
{2:-- VISUAL BLOCK --} |
]])
@@ -129,7 +129,7 @@ describe('Mouse input', function()
it('right click extends visual selection to the clicked location', function()
feed('<LeftMouse><0,0>')
screen:expect([[
^esting |
^testing |
mouse |
support and selection |
~ |
@@ -139,7 +139,7 @@ describe('Mouse input', function()
screen:expect([[
{1:testing } |
{1:mouse } |
{1:su}^port and selection |
{1:su}^pport and selection |
~ |
{2:-- VISUAL --} |
]])
@@ -153,7 +153,7 @@ describe('Mouse input', function()
E426: tag not found: test|
ing |
Press ENTER or type comma|
nd to continue^ |
nd to continue^ |
]],nil,true)
feed('<cr>')
end)
@@ -179,7 +179,7 @@ describe('Mouse input', function()
to |to |
test |test |
mouse scrolling |mouse scrolling |
^ | |
^ | |
~ |~ |
[No Name] [+] [No Name] [+] |
to |
@@ -193,7 +193,7 @@ describe('Mouse input', function()
feed('<MouseUp><0,0>')
screen:expect([[
mouse scrolling |lines |
^ |to |
^ |to |
~ |test |
~ |mouse scrolling |
~ | |
@@ -210,7 +210,7 @@ describe('Mouse input', function()
feed('<MouseDown><27,0>')
screen:expect([[
mouse scrolling |text |
^ |with |
^ |with |
~ |many |
~ |lines |
~ |to |
@@ -227,7 +227,7 @@ describe('Mouse input', function()
feed('<MouseDown><27,7><MouseDown>')
screen:expect([[
mouse scrolling |text |
^ |with |
^ |with |
~ |many |
~ |lines |
~ |to |

View File

@@ -418,9 +418,8 @@ function Screen:_row_repr(row, attr_ids, attr_ignore)
end
if self._rows[self._cursor.row] == row and self._cursor.col == i then
table.insert(rv, '^')
else
table.insert(rv, row[i].text)
end
table.insert(rv, row[i].text)
end
if current_attr_id then
table.insert(rv, '}')

View File

@@ -85,7 +85,7 @@ describe('Screen', function()
it('horizontal', function()
execute('sp')
screen:expect([[
^ |
^ |
~ |
~ |
~ |
@@ -106,7 +106,7 @@ describe('Screen', function()
execute('sp')
execute('resize 8')
screen:expect([[
^ |
^ |
~ |
~ |
~ |
@@ -126,7 +126,7 @@ describe('Screen', function()
it('horizontal and vertical', function()
execute('sp', 'vsp', 'vsp')
screen:expect([[
^ | | |
^ | | |
~ |~ |~ |
~ |~ |~ |
~ |~ |~ |
@@ -143,7 +143,7 @@ describe('Screen', function()
]])
insert('hello')
screen:expect([[
hell^ |hello |hello |
hell^o |hello |hello |
~ |~ |~ |
~ |~ |~ |
~ |~ |~ |
@@ -169,7 +169,7 @@ describe('Screen', function()
execute('sp', 'vsp', 'vsp')
insert('hello')
screen:expect([[
hell^ |hello |hello |
hell^o |hello |hello |
~ |~ |~ |
~ |~ |~ |
~ |~ |~ |
@@ -189,7 +189,7 @@ describe('Screen', function()
feed('h')
screen:expect([[
4+ [No Name] + [No Name] X|
hell^2 |
hell^o2 |
~ |
~ |
~ |
@@ -206,7 +206,7 @@ describe('Screen', function()
execute('tabprevious')
screen:expect([[
4+ [No Name] + [No Name] X|
hell^ |hello |hello |
hell^o |hello |hello |
~ |~ |~ |
~ |~ |~ |
~ |~ |~ |
@@ -229,7 +229,7 @@ describe('Screen', function()
screen:expect([[
line 1 |
line 2 |
^ |
^ |
~ |
~ |
~ |
@@ -262,7 +262,7 @@ describe('Screen', function()
~ |
~ |
~ |
:ls^ |
:ls^ |
]])
end)
@@ -282,7 +282,7 @@ describe('Screen', function()
~ |
:ls |
1 %a "[No Name]" line 1 |
Press ENTER or type command to continue^ |
Press ENTER or type command to continue^ |
]])
feed('<cr>') -- skip the "Press ENTER..." state or tests will hang
end)
@@ -312,7 +312,7 @@ describe('Screen', function()
in |in |in |
split |split |split |
windows |windows |windows |
^ | | |
^ | | |
[No Name] [+] [No Name] [+] [No Name] [+] |
clearing |
in |
@@ -327,7 +327,7 @@ describe('Screen', function()
it('only affects the current scroll region', function()
feed('6k')
screen:expect([[
^crolling |and |and |
^scrolling |and |and |
and |clearing |clearing |
clearing |in |in |
in |split |split |
@@ -349,7 +349,7 @@ describe('Screen', function()
clearing |in |in |
in |split |split |
split |windows |windows |
windows |^ | |
windows |^ | |
[No Name] [+] [No Name] [+] <Name] [+] |
clearing |
in |
@@ -361,7 +361,7 @@ describe('Screen', function()
]])
feed('gg')
screen:expect([[
scrolling |^nserting |and |
scrolling |^Inserting |and |
and |text |clearing |
clearing |with |in |
in |many |split |
@@ -383,7 +383,7 @@ describe('Screen', function()
clearing |lines |in |
in |to |split |
split |test |windows |
windows |^crolling | |
windows |^scrolling | |
[No Name] [+] [No Name] [+] <Name] [+] |
clearing |
in |
@@ -400,7 +400,7 @@ describe('Screen', function()
clearing |test |in |
in |scrolling |split |
split |and |windows |
windows |^learing | |
windows |^clearing | |
[No Name] [+] [No Name] [+] <Name] [+] |
clearing |
in |
@@ -412,7 +412,7 @@ describe('Screen', function()
]])
feed('5k')
screen:expect([[
scrolling |^ines |and |
scrolling |^lines |and |
and |to |clearing |
clearing |test |in |
in |scrolling |split |
@@ -429,7 +429,7 @@ describe('Screen', function()
]])
feed('k')
screen:expect([[
scrolling |^any |and |
scrolling |^many |and |
and |lines |clearing |
clearing |to |in |
in |test |split |
@@ -455,7 +455,7 @@ describe('Screen', function()
it('rebuilds the whole screen', function()
screen:expect([[
resize^ |
resize^ |
~ |
~ |
~ |
@@ -466,13 +466,13 @@ describe('Screen', function()
it('has minimum width/height values', function()
screen:try_resize(1, 1)
screen:expect([[
-- INS^RT --|
-- INS^ERT --|
|
]])
feed('<esc>:ls')
screen:expect([[
resize |
:ls^ |
:ls^ |
]])
end)
end)

View File

@@ -28,7 +28,7 @@ describe('Signs', function()
>!a |
b |
>>c |
^ |
^ |
~ |
~ |
~ |

View File

@@ -25,7 +25,7 @@ describe("'wildmode'", function()
~ |
~ |
define jump list > |
:sign define^ |
:sign define^ |
]])
end)
end)