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

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

View File

@@ -93,7 +93,7 @@ describe('system()', function()
~ | ~ |
~ | ~ |
~ | ~ |
^call system("yes") | ^:call system("yes") |
]]) ]])
feed('<c-c>') feed('<c-c>')
screen:expect([[ screen:expect([[
@@ -259,7 +259,7 @@ describe('systemlist()', function()
~ | ~ |
~ | ~ |
~ | ~ |
^call systemlist("yes | xargs") | ^:call systemlist("yes | xargs") |
]]) ]])
feed('<c-c>') feed('<c-c>')
screen:expect([[ screen:expect([[

View File

@@ -28,7 +28,7 @@ describe('Mouse input', function()
screen:expect([[ screen:expect([[
testing | testing |
mouse | mouse |
support and selectio^ | support and selectio^n |
~ | ~ |
| |
]]) ]])
@@ -42,14 +42,14 @@ describe('Mouse input', function()
feed('<LeftMouse><2,1>') feed('<LeftMouse><2,1>')
screen:expect([[ screen:expect([[
testing | testing |
mo^se | mo^use |
support and selection | support and selection |
~ | ~ |
| |
]]) ]])
feed('<LeftMouse><0,0>') feed('<LeftMouse><0,0>')
screen:expect([[ screen:expect([[
^esting | ^testing |
mouse | mouse |
support and selection | support and selection |
~ | ~ |
@@ -62,7 +62,7 @@ describe('Mouse input', function()
feed('<LeftMouse><2,1>') feed('<LeftMouse><2,1>')
screen:expect([[ screen:expect([[
testing | testing |
mo^se | mo^use |
support and selection | support and selection |
~ | ~ |
| |
@@ -70,7 +70,7 @@ describe('Mouse input', function()
feed('<LeftDrag><4,1>') feed('<LeftDrag><4,1>')
screen:expect([[ screen:expect([[
testing | testing |
mo{1:us}^ | mo{1:us}^e |
support and selection | support and selection |
~ | ~ |
{2:-- VISUAL --} | {2:-- VISUAL --} |
@@ -79,13 +79,13 @@ describe('Mouse input', function()
screen:expect([[ screen:expect([[
testing | testing |
mo{1:use } | mo{1:use } |
{1:su}^port and selection | {1:su}^pport and selection |
~ | ~ |
{2:-- VISUAL --} | {2:-- VISUAL --} |
]]) ]])
feed('<LeftDrag><0,0>') feed('<LeftDrag><0,0>')
screen:expect([[ screen:expect([[
^{1:esting } | ^t{1:esting } |
{1:mou}se | {1:mou}se |
support and selection | support and selection |
~ | ~ |
@@ -98,7 +98,7 @@ describe('Mouse input', function()
screen:expect([[ screen:expect([[
testing | testing |
mouse | mouse |
{1:suppor}^ and selection | {1:suppor}^t and selection |
~ | ~ |
{2:-- VISUAL --} | {2:-- VISUAL --} |
]]) ]])
@@ -109,7 +109,7 @@ describe('Mouse input', function()
screen:expect([[ screen:expect([[
testing | testing |
mouse | mouse |
{1:su}^{1:port and selection } | {1:su}^p{1:port and selection } |
~ | ~ |
{2:-- VISUAL LINE --} | {2:-- VISUAL LINE --} |
]]) ]])
@@ -120,7 +120,7 @@ describe('Mouse input', function()
screen:expect([[ screen:expect([[
testing | testing |
mouse | mouse |
su^port and selection | su^pport and selection |
~ | ~ |
{2:-- VISUAL BLOCK --} | {2:-- VISUAL BLOCK --} |
]]) ]])
@@ -129,7 +129,7 @@ describe('Mouse input', function()
it('right click extends visual selection to the clicked location', function() it('right click extends visual selection to the clicked location', function()
feed('<LeftMouse><0,0>') feed('<LeftMouse><0,0>')
screen:expect([[ screen:expect([[
^esting | ^testing |
mouse | mouse |
support and selection | support and selection |
~ | ~ |
@@ -139,7 +139,7 @@ describe('Mouse input', function()
screen:expect([[ screen:expect([[
{1:testing } | {1:testing } |
{1:mouse } | {1:mouse } |
{1:su}^port and selection | {1:su}^pport and selection |
~ | ~ |
{2:-- VISUAL --} | {2:-- VISUAL --} |
]]) ]])

View File

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

View File

@@ -143,7 +143,7 @@ describe('Screen', function()
]]) ]])
insert('hello') insert('hello')
screen:expect([[ screen:expect([[
hell^ |hello |hello | hell^o |hello |hello |
~ |~ |~ | ~ |~ |~ |
~ |~ |~ | ~ |~ |~ |
~ |~ |~ | ~ |~ |~ |
@@ -169,7 +169,7 @@ describe('Screen', function()
execute('sp', 'vsp', 'vsp') execute('sp', 'vsp', 'vsp')
insert('hello') insert('hello')
screen:expect([[ screen:expect([[
hell^ |hello |hello | hell^o |hello |hello |
~ |~ |~ | ~ |~ |~ |
~ |~ |~ | ~ |~ |~ |
~ |~ |~ | ~ |~ |~ |
@@ -189,7 +189,7 @@ describe('Screen', function()
feed('h') feed('h')
screen:expect([[ screen:expect([[
4+ [No Name] + [No Name] X| 4+ [No Name] + [No Name] X|
hell^2 | hell^o2 |
~ | ~ |
~ | ~ |
~ | ~ |
@@ -206,7 +206,7 @@ describe('Screen', function()
execute('tabprevious') execute('tabprevious')
screen:expect([[ screen:expect([[
4+ [No Name] + [No Name] X| 4+ [No Name] + [No Name] X|
hell^ |hello |hello | hell^o |hello |hello |
~ |~ |~ | ~ |~ |~ |
~ |~ |~ | ~ |~ |~ |
~ |~ |~ | ~ |~ |~ |
@@ -327,7 +327,7 @@ describe('Screen', function()
it('only affects the current scroll region', function() it('only affects the current scroll region', function()
feed('6k') feed('6k')
screen:expect([[ screen:expect([[
^crolling |and |and | ^scrolling |and |and |
and |clearing |clearing | and |clearing |clearing |
clearing |in |in | clearing |in |in |
in |split |split | in |split |split |
@@ -361,7 +361,7 @@ describe('Screen', function()
]]) ]])
feed('gg') feed('gg')
screen:expect([[ screen:expect([[
scrolling |^nserting |and | scrolling |^Inserting |and |
and |text |clearing | and |text |clearing |
clearing |with |in | clearing |with |in |
in |many |split | in |many |split |
@@ -383,7 +383,7 @@ describe('Screen', function()
clearing |lines |in | clearing |lines |in |
in |to |split | in |to |split |
split |test |windows | split |test |windows |
windows |^crolling | | windows |^scrolling | |
[No Name] [+] [No Name] [+] <Name] [+] | [No Name] [+] [No Name] [+] <Name] [+] |
clearing | clearing |
in | in |
@@ -400,7 +400,7 @@ describe('Screen', function()
clearing |test |in | clearing |test |in |
in |scrolling |split | in |scrolling |split |
split |and |windows | split |and |windows |
windows |^learing | | windows |^clearing | |
[No Name] [+] [No Name] [+] <Name] [+] | [No Name] [+] [No Name] [+] <Name] [+] |
clearing | clearing |
in | in |
@@ -412,7 +412,7 @@ describe('Screen', function()
]]) ]])
feed('5k') feed('5k')
screen:expect([[ screen:expect([[
scrolling |^ines |and | scrolling |^lines |and |
and |to |clearing | and |to |clearing |
clearing |test |in | clearing |test |in |
in |scrolling |split | in |scrolling |split |
@@ -429,7 +429,7 @@ describe('Screen', function()
]]) ]])
feed('k') feed('k')
screen:expect([[ screen:expect([[
scrolling |^any |and | scrolling |^many |and |
and |lines |clearing | and |lines |clearing |
clearing |to |in | clearing |to |in |
in |test |split | in |test |split |
@@ -466,7 +466,7 @@ describe('Screen', function()
it('has minimum width/height values', function() it('has minimum width/height values', function()
screen:try_resize(1, 1) screen:try_resize(1, 1)
screen:expect([[ screen:expect([[
-- INS^RT --| -- INS^ERT --|
| |
]]) ]])
feed('<esc>:ls') feed('<esc>:ls')