aboutsummaryrefslogtreecommitdiff
path: root/test/functional/ui
diff options
context:
space:
mode:
authorBjörn Linse <bjorn.linse@gmail.com>2018-11-17 18:23:42 +0100
committerBjörn Linse <bjorn.linse@gmail.com>2018-12-31 16:24:07 +0100
commited3da23cf45f5484e6c62fac9a4d3f2986fc20d5 (patch)
tree40f7d17b466563a98e23a75c52498ba60df04348 /test/functional/ui
parent13f74635fa3ad2030b7452665f389d366a1995cf (diff)
downloadrneovim-ed3da23cf45f5484e6c62fac9a4d3f2986fc20d5.tar.gz
rneovim-ed3da23cf45f5484e6c62fac9a4d3f2986fc20d5.tar.bz2
rneovim-ed3da23cf45f5484e6c62fac9a4d3f2986fc20d5.zip
multigrid: test refactor
Diffstat (limited to 'test/functional/ui')
-rw-r--r--test/functional/ui/multigrid_spec.lua555
-rw-r--r--test/functional/ui/screen.lua67
2 files changed, 356 insertions, 266 deletions
diff --git a/test/functional/ui/multigrid_spec.lua b/test/functional/ui/multigrid_spec.lua
index 6a4d956404..fcc736651f 100644
--- a/test/functional/ui/multigrid_spec.lua
+++ b/test/functional/ui/multigrid_spec.lua
@@ -44,18 +44,18 @@ describe('multigrid screen', function()
it('default initial screen', function()
screen:expect([[
## grid 1
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
{11:[No Name] }|
|
## grid 2
@@ -78,18 +78,18 @@ describe('multigrid screen', function()
command('vsplit')
screen:expect([[
## grid 1
- {12:│} |
- {12:│} |
- {12:│} |
- {12:│} |
- {12:│} |
- {12:│} |
- {12:│} |
- {12:│} |
- {12:│} |
- {12:│} |
- {12:│} |
- {12:│} |
+ [3:--------------------------]{12:│}[2:--------------------------]|
+ [3:--------------------------]{12:│}[2:--------------------------]|
+ [3:--------------------------]{12:│}[2:--------------------------]|
+ [3:--------------------------]{12:│}[2:--------------------------]|
+ [3:--------------------------]{12:│}[2:--------------------------]|
+ [3:--------------------------]{12:│}[2:--------------------------]|
+ [3:--------------------------]{12:│}[2:--------------------------]|
+ [3:--------------------------]{12:│}[2:--------------------------]|
+ [3:--------------------------]{12:│}[2:--------------------------]|
+ [3:--------------------------]{12:│}[2:--------------------------]|
+ [3:--------------------------]{12:│}[2:--------------------------]|
+ [3:--------------------------]{12:│}[2:--------------------------]|
{11:[No Name] }{12:[No Name] }|
|
## grid 2
@@ -128,18 +128,18 @@ describe('multigrid screen', function()
command('split')
screen:expect([[
## grid 1
- {12:│} |
- {12:│} |
- {12:│} |
- {12:│} |
- {12:│} |
- {12:│} |
- {12:│}{11:[No Name] }|
- {12:│} |
- {12:│} |
- {12:│} |
- {12:│} |
- {12:│} |
+ [3:--------------------------]{12:│}[4:--------------------------]|
+ [3:--------------------------]{12:│}[4:--------------------------]|
+ [3:--------------------------]{12:│}[4:--------------------------]|
+ [3:--------------------------]{12:│}[4:--------------------------]|
+ [3:--------------------------]{12:│}[4:--------------------------]|
+ [3:--------------------------]{12:│}[4:--------------------------]|
+ [3:--------------------------]{12:│}{11:[No Name] }|
+ [3:--------------------------]{12:│}[2:--------------------------]|
+ [3:--------------------------]{12:│}[2:--------------------------]|
+ [3:--------------------------]{12:│}[2:--------------------------]|
+ [3:--------------------------]{12:│}[2:--------------------------]|
+ [3:--------------------------]{12:│}[2:--------------------------]|
{12:[No Name] [No Name] }|
|
## grid 2
@@ -179,18 +179,18 @@ describe('multigrid screen', function()
command('q')
screen:expect([[
## grid 1
- {12:│} |
- {12:│} |
- {12:│} |
- {12:│} |
- {12:│} |
- {12:│} |
+ [4:-----------------------------------------------------]|
+ [4:-----------------------------------------------------]|
+ [4:-----------------------------------------------------]|
+ [4:-----------------------------------------------------]|
+ [4:-----------------------------------------------------]|
+ [4:-----------------------------------------------------]|
{11:[No Name] }|
- {12:│} |
- {12:│} |
- {12:│} |
- {12:│} |
- {12:│} |
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
{12:[No Name] }|
|
## grid 2
@@ -220,18 +220,18 @@ describe('multigrid screen', function()
command('sp')
screen:expect([[
## grid 1
- |
- |
- |
- |
- |
- |
+ [3:-----------------------------------------------------]|
+ [3:-----------------------------------------------------]|
+ [3:-----------------------------------------------------]|
+ [3:-----------------------------------------------------]|
+ [3:-----------------------------------------------------]|
+ [3:-----------------------------------------------------]|
{11:[No Name] }|
- |
- |
- |
- |
- |
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
{12:[No Name] }|
|
## grid 2
@@ -253,21 +253,20 @@ describe('multigrid screen', function()
it('resizes grids', function ()
command('sp')
command('resize 8')
- -- see "Note 1" for info about why there are three statuslines
screen:expect([[
## grid 1
- |
- |
- |
- |
- |
- |
+ [3:-----------------------------------------------------]|
+ [3:-----------------------------------------------------]|
+ [3:-----------------------------------------------------]|
+ [3:-----------------------------------------------------]|
+ [3:-----------------------------------------------------]|
+ [3:-----------------------------------------------------]|
+ [3:-----------------------------------------------------]|
+ [3:-----------------------------------------------------]|
{11:[No Name] }|
- |
- {11:[No Name] }|
- |
- |
- |
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
{12:[No Name] }|
|
## grid 2
@@ -292,18 +291,18 @@ describe('multigrid screen', function()
command('vsp')
screen:expect([[
## grid 1
- {12:│} {12:│} |
- {12:│} {12:│} |
- {12:│} {12:│} |
- {12:│} {12:│} |
- {12:│} {12:│} |
- {12:│} {12:│} |
+ [5:--------------------]{12:│}[4:----------------]{12:│}[3:---------------]|
+ [5:--------------------]{12:│}[4:----------------]{12:│}[3:---------------]|
+ [5:--------------------]{12:│}[4:----------------]{12:│}[3:---------------]|
+ [5:--------------------]{12:│}[4:----------------]{12:│}[3:---------------]|
+ [5:--------------------]{12:│}[4:----------------]{12:│}[3:---------------]|
+ [5:--------------------]{12:│}[4:----------------]{12:│}[3:---------------]|
{11:[No Name] }{12:[No Name] [No Name] }|
- |
- |
- |
- |
- |
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
{12:[No Name] }|
|
## grid 2
@@ -337,18 +336,18 @@ describe('multigrid screen', function()
insert('hello')
screen:expect([[
## grid 1
- {12:│} {12:│} |
- {12:│} {12:│} |
- {12:│} {12:│} |
- {12:│} {12:│} |
- {12:│} {12:│} |
- {12:│} {12:│} |
+ [5:--------------------]{12:│}[4:----------------]{12:│}[3:---------------]|
+ [5:--------------------]{12:│}[4:----------------]{12:│}[3:---------------]|
+ [5:--------------------]{12:│}[4:----------------]{12:│}[3:---------------]|
+ [5:--------------------]{12:│}[4:----------------]{12:│}[3:---------------]|
+ [5:--------------------]{12:│}[4:----------------]{12:│}[3:---------------]|
+ [5:--------------------]{12:│}[4:----------------]{12:│}[3:---------------]|
{11:[No Name] [+] }{12:[No Name] [+] [No Name] [+] }|
- |
- |
- |
- |
- |
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
{12:[No Name] [+] }|
|
## grid 2
@@ -382,21 +381,51 @@ describe('multigrid screen', function()
end)
it('closes splits', function ()
command('sp')
- command('q')
screen:expect([[
## grid 1
- |
- |
- |
- |
- |
- |
+ [3:-----------------------------------------------------]|
+ [3:-----------------------------------------------------]|
+ [3:-----------------------------------------------------]|
+ [3:-----------------------------------------------------]|
+ [3:-----------------------------------------------------]|
+ [3:-----------------------------------------------------]|
{11:[No Name] }|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ {12:[No Name] }|
|
+ ## grid 2
|
- |
- |
- |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ ## grid 3
+ ^ |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ ]])
+ command('q')
+ screen:expect([[
+ ## grid 1
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
{11:[No Name] }|
|
## grid 2
@@ -421,18 +450,18 @@ describe('multigrid screen', function()
command('vsp')
screen:expect([[
## grid 1
- {12:│} |
- {12:│} |
- {12:│} |
- {12:│} |
- {12:│} |
- {12:│} |
- {12:│} |
- {12:│} |
- {12:│} |
- {12:│} |
- {12:│} |
- {12:│} |
+ [3:--------------------------]{12:│}[2:--------------------------]|
+ [3:--------------------------]{12:│}[2:--------------------------]|
+ [3:--------------------------]{12:│}[2:--------------------------]|
+ [3:--------------------------]{12:│}[2:--------------------------]|
+ [3:--------------------------]{12:│}[2:--------------------------]|
+ [3:--------------------------]{12:│}[2:--------------------------]|
+ [3:--------------------------]{12:│}[2:--------------------------]|
+ [3:--------------------------]{12:│}[2:--------------------------]|
+ [3:--------------------------]{12:│}[2:--------------------------]|
+ [3:--------------------------]{12:│}[2:--------------------------]|
+ [3:--------------------------]{12:│}[2:--------------------------]|
+ [3:--------------------------]{12:│}[2:--------------------------]|
{11:[No Name] }{12:[No Name] }|
|
## grid 2
@@ -469,18 +498,18 @@ describe('multigrid screen', function()
-- see "Note 1" for info about why there are two vseps
screen:expect([[
## grid 1
- {12:│} {12:│} |
- {12:│} {12:│} |
- {12:│} {12:│} |
- {12:│} {12:│} |
- {12:│} {12:│} |
- {12:│} {12:│} |
- {12:│} {12:│} |
- {12:│} {12:│} |
- {12:│} {12:│} |
- {12:│} {12:│} |
- {12:│} {12:│} |
- {12:│} {12:│} |
+ [3:----------]{12:│}[2:------------------------------------------]|
+ [3:----------]{12:│}[2:------------------------------------------]|
+ [3:----------]{12:│}[2:------------------------------------------]|
+ [3:----------]{12:│}[2:------------------------------------------]|
+ [3:----------]{12:│}[2:------------------------------------------]|
+ [3:----------]{12:│}[2:------------------------------------------]|
+ [3:----------]{12:│}[2:------------------------------------------]|
+ [3:----------]{12:│}[2:------------------------------------------]|
+ [3:----------]{12:│}[2:------------------------------------------]|
+ [3:----------]{12:│}[2:------------------------------------------]|
+ [3:----------]{12:│}[2:------------------------------------------]|
+ [3:----------]{12:│}[2:------------------------------------------]|
{11:<No Name] }{12:[No Name] }|
|
## grid 2
@@ -516,18 +545,18 @@ describe('multigrid screen', function()
command('sp')
screen:expect([[
## grid 1
- {12:│} |
- {12:│} |
- {12:│} |
- {12:│} |
- {12:│} |
- {12:│} |
- {11:[No Name] }{12:│} |
- {12:│} |
- {12:│} |
- {12:│} |
- {12:│} |
- {12:│} |
+ [4:--------------------------]{12:│}[2:--------------------------]|
+ [4:--------------------------]{12:│}[2:--------------------------]|
+ [4:--------------------------]{12:│}[2:--------------------------]|
+ [4:--------------------------]{12:│}[2:--------------------------]|
+ [4:--------------------------]{12:│}[2:--------------------------]|
+ [4:--------------------------]{12:│}[2:--------------------------]|
+ {11:[No Name] }{12:│}[2:--------------------------]|
+ [3:--------------------------]{12:│}[2:--------------------------]|
+ [3:--------------------------]{12:│}[2:--------------------------]|
+ [3:--------------------------]{12:│}[2:--------------------------]|
+ [3:--------------------------]{12:│}[2:--------------------------]|
+ [3:--------------------------]{12:│}[2:--------------------------]|
{12:[No Name] [No Name] }|
|
## grid 2
@@ -560,18 +589,18 @@ describe('multigrid screen', function()
insert('hello')
screen:expect([[
## grid 1
- {12:│} |
- {12:│} |
- {12:│} |
- {12:│} |
- {12:│} |
- {12:│} |
- {11:[No Name] [+] }{12:│} |
- {12:│} |
- {12:│} |
- {12:│} |
- {12:│} |
- {12:│} |
+ [4:--------------------------]{12:│}[2:--------------------------]|
+ [4:--------------------------]{12:│}[2:--------------------------]|
+ [4:--------------------------]{12:│}[2:--------------------------]|
+ [4:--------------------------]{12:│}[2:--------------------------]|
+ [4:--------------------------]{12:│}[2:--------------------------]|
+ [4:--------------------------]{12:│}[2:--------------------------]|
+ {11:[No Name] [+] }{12:│}[2:--------------------------]|
+ [3:--------------------------]{12:│}[2:--------------------------]|
+ [3:--------------------------]{12:│}[2:--------------------------]|
+ [3:--------------------------]{12:│}[2:--------------------------]|
+ [3:--------------------------]{12:│}[2:--------------------------]|
+ [3:--------------------------]{12:│}[2:--------------------------]|
{12:[No Name] [+] [No Name] [+] }|
|
## grid 2
@@ -600,26 +629,68 @@ describe('multigrid screen', function()
{1:~ }|
{1:~ }|
{1:~ }|
- ]])
+ ]])
end)
it('closes splits', function ()
command('vsp')
+ screen:expect([[
+ ## grid 1
+ [3:--------------------------]{12:│}[2:--------------------------]|
+ [3:--------------------------]{12:│}[2:--------------------------]|
+ [3:--------------------------]{12:│}[2:--------------------------]|
+ [3:--------------------------]{12:│}[2:--------------------------]|
+ [3:--------------------------]{12:│}[2:--------------------------]|
+ [3:--------------------------]{12:│}[2:--------------------------]|
+ [3:--------------------------]{12:│}[2:--------------------------]|
+ [3:--------------------------]{12:│}[2:--------------------------]|
+ [3:--------------------------]{12:│}[2:--------------------------]|
+ [3:--------------------------]{12:│}[2:--------------------------]|
+ [3:--------------------------]{12:│}[2:--------------------------]|
+ [3:--------------------------]{12:│}[2:--------------------------]|
+ {11:[No Name] }{12:[No Name] }|
+ |
+ ## grid 2
+ |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ ## grid 3
+ ^ |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ ]])
command('q')
- -- see "Note 1" for info about why there is a vsep
screen:expect([[
## grid 1
- {12:│} |
- {12:│} |
- {12:│} |
- {12:│} |
- {12:│} |
- {12:│} |
- {12:│} |
- {12:│} |
- {12:│} |
- {12:│} |
- {12:│} |
- {12:│} |
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
{11:[No Name] }|
|
## grid 2
@@ -645,10 +716,10 @@ describe('multigrid screen', function()
screen:try_resize(25, 6)
screen:expect([[
## grid 1
- |
- |
- |
- |
+ [2:-------------------------]|
+ [2:-------------------------]|
+ [2:-------------------------]|
+ [2:-------------------------]|
{11:[No Name] }|
|
## grid 2
@@ -663,7 +734,7 @@ describe('multigrid screen', function()
screen:try_resize(1, 1)
screen:expect([[
## grid 1
- |
+ [2:------------]|
{11:[No Name] }|
|
## grid 2
@@ -673,7 +744,7 @@ describe('multigrid screen', function()
feed('<esc>:ls')
screen:expect([[
## grid 1
- |
+ [2:------------]|
{11:[No Name] }|
:ls^ |
## grid 2
@@ -687,18 +758,18 @@ describe('multigrid screen', function()
screen:try_resize_grid(2, 8, 5)
screen:expect([[
## grid 1
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
{11:[No Name] }|
|
## grid 2
@@ -716,18 +787,18 @@ describe('multigrid screen', function()
screen:try_resize_grid(2, 80, 20)
screen:expect([[
## grid 1
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
{11:[No Name] }|
|
## grid 2
@@ -763,18 +834,18 @@ describe('multigrid screen', function()
insert(('a'):rep(60).."\n")
screen:expect([[
## grid 1
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
{11:[No Name] [+] }|
|
## grid 2
@@ -805,18 +876,18 @@ describe('multigrid screen', function()
insert(('b'):rep(80).."\n")
screen:expect([[
## grid 1
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
{11:[No Name] [+] }|
|
## grid 2
@@ -848,18 +919,18 @@ describe('multigrid screen', function()
' long message"')
screen:expect([[
## grid 1
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
{11:[No Name] }|
this is a very very very...ry very very long message |
## grid 2
@@ -891,18 +962,18 @@ describe('multigrid screen', function()
feed('kzfgg')
screen:expect([[
## grid 1
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
{11:[No Name] [+] }|
|
## grid 2
diff --git a/test/functional/ui/screen.lua b/test/functional/ui/screen.lua
index f363068dfc..77b8a3e522 100644
--- a/test/functional/ui/screen.lua
+++ b/test/functional/ui/screen.lua
@@ -704,7 +704,7 @@ end
function Screen:_handle_grid_destroy(grid)
self._grids[grid] = nil
- if self._multigrid then
+ if self._options.ext_multigrid then
assert(self.win_position[grid])
self.win_position[grid] = nil
end
@@ -810,7 +810,6 @@ function Screen:_handle_win_pos(grid, win, startrow, startcol, width, height)
width = width,
height = height
}
- -- TODO(utkarshme): Take apt action
end
function Screen:_handle_win_hide(grid)
@@ -981,31 +980,51 @@ function Screen:_clear_row_section(grid, rownum, startcol, stopcol)
end
end
-function Screen:_row_repr(row, attr_state, cursor)
+function Screen:_row_repr(gridnr, rownr, attr_state, cursor)
local rv = {}
local current_attr_id
- for i = 1, #row do
- local attrs = row[i].attrs
- if self._options.ext_linegrid then
- attrs = attrs[(self._options.rgb and 1) or 2]
- end
- local attr_id = self:_get_attr_id(attr_state, attrs, row[i].hl_id)
- if current_attr_id and attr_id ~= current_attr_id then
- -- close current attribute bracket, add it before any whitespace
- -- up to the current cell
- -- table.insert(rv, backward_find_meaningful(rv, i), '}')
- table.insert(rv, '}')
- current_attr_id = nil
- end
- if not current_attr_id and attr_id then
- -- open a new attribute bracket
- table.insert(rv, '{' .. attr_id .. ':')
- current_attr_id = attr_id
+ local i = 1
+ local has_windows = self._options.ext_multigrid and gridnr == 1
+ local row = self._grids[gridnr].rows[rownr]
+ while i <= #row do
+ local did_window = false
+ if has_windows then
+ for id,pos in pairs(self.win_position) do
+ if i-1 == pos.startcol and pos.startrow <= rownr-1 and rownr-1 < pos.startrow + pos.height then
+ if current_attr_id then
+ -- close current attribute bracket
+ table.insert(rv, '}')
+ current_attr_id = nil
+ end
+ table.insert(rv, '['..id..':'..string.rep('-',pos.width)..']')
+ i = i + pos.width
+ did_window = true
+ end
+ end
end
- if not self._busy and cursor and self._cursor.col == i then
- table.insert(rv, '^')
+
+ if not did_window then
+ local attrs = row[i].attrs
+ if self._options.ext_linegrid then
+ attrs = attrs[(self._options.rgb and 1) or 2]
+ end
+ local attr_id = self:_get_attr_id(attr_state, attrs, row[i].hl_id)
+ if current_attr_id and attr_id ~= current_attr_id then
+ -- close current attribute bracket
+ table.insert(rv, '}')
+ current_attr_id = nil
+ end
+ if not current_attr_id and attr_id then
+ -- open a new attribute bracket
+ table.insert(rv, '{' .. attr_id .. ':')
+ current_attr_id = attr_id
+ end
+ if not self._busy and cursor and self._cursor.col == i then
+ table.insert(rv, '^')
+ end
+ table.insert(rv, row[i].text)
+ i = i + 1
end
- table.insert(rv, row[i].text)
end
if current_attr_id then
table.insert(rv, '}')
@@ -1090,7 +1109,7 @@ function Screen:render(headers, attr_state, preview)
for i = 1, grid.height do
local cursor = self._cursor.grid == igrid and self._cursor.row == i
local prefix = (headers or preview) and " " or ""
- table.insert(rv, prefix..self:_row_repr(grid.rows[i], attr_state, cursor).."|")
+ table.insert(rv, prefix..self:_row_repr(igrid, i, attr_state, cursor).."|")
end
end
return rv