aboutsummaryrefslogtreecommitdiff
path: root/test/functional/ui/screen.lua
diff options
context:
space:
mode:
authorBjörn Linse <bjorn.linse@gmail.com>2019-09-01 11:25:00 +0200
committerBjörn Linse <bjorn.linse@gmail.com>2019-09-01 15:55:10 +0200
commite04b9e7c78bdcf40cce5b5533ce8d7695691dfd6 (patch)
tree39dd100dccde24ce0b8af578e134b5d2b945faa9 /test/functional/ui/screen.lua
parentb51ba122c1edfb769e72c25c4f14f469f59f1b8e (diff)
downloadrneovim-e04b9e7c78bdcf40cce5b5533ce8d7695691dfd6.tar.gz
rneovim-e04b9e7c78bdcf40cce5b5533ce8d7695691dfd6.tar.bz2
rneovim-e04b9e7c78bdcf40cce5b5533ce8d7695691dfd6.zip
test/ui: update tests for new msg_grid implementation
Diffstat (limited to 'test/functional/ui/screen.lua')
-rw-r--r--test/functional/ui/screen.lua33
1 files changed, 18 insertions, 15 deletions
diff --git a/test/functional/ui/screen.lua b/test/functional/ui/screen.lua
index 36fe46fd13..02be714e0d 100644
--- a/test/functional/ui/screen.lua
+++ b/test/functional/ui/screen.lua
@@ -159,6 +159,8 @@ function Screen.new(width, height)
wildmenu_selected = nil,
win_position = {},
float_pos = {},
+ msg_grid = nil,
+ msg_grid_pos = nil,
_session = nil,
messages = {},
msg_history = {},
@@ -676,13 +678,12 @@ function Screen:_handle_grid_resize(grid, width, height)
}
end
-function Screen:_handle_win_scroll_over_start()
- self.scroll_over = true
- self.scroll_over_pos = self._grids[1].height
-end
-function Screen:_handle_win_scroll_over_reset()
- self.scroll_over = false
+function Screen:_handle_msg_set_pos(grid, row, scrolled, char)
+ self.msg_grid = grid
+ self.msg_grid_pos = row
+ self.msg_scrolled = scrolled
+ self.msg_sep_char = char
end
function Screen:_handle_flush()
@@ -823,10 +824,6 @@ function Screen:_handle_scroll(count)
end
function Screen:_handle_grid_scroll(g, top, bot, left, right, rows, cols)
- if self.scroll_over and g == 1 and top < self.scroll_over_pos then
- self.scroll_over_pos = top
- end
-
top = top+1
left = left+1
assert(cols == 0)
@@ -1076,10 +1073,10 @@ function Screen:_row_repr(gridnr, rownr, attr_state, cursor)
local current_attr_id
local i = 1
local has_windows = self._options.ext_multigrid and gridnr == 1
- if self.scroll_over and self.scroll_over_pos < rownr then
- has_windows = false
- end
local row = self._grids[gridnr].rows[rownr]
+ if has_windows and self.msg_grid and self.msg_grid_pos < rownr then
+ return '['..self.msg_grid..':'..string.rep('-',#row)..']'
+ end
while i <= #row do
local did_window = false
if has_windows then
@@ -1218,12 +1215,17 @@ function Screen:render(headers, attr_state, preview)
for igrid,grid in pairs(self._grids) do
if headers then
local suffix = ""
- if igrid > 1 and self.win_position[igrid] == nil and self.float_pos[igrid] == nil then
+ if igrid > 1 and self.win_position[igrid] == nil
+ and self.float_pos[igrid] == nil and self.msg_grid ~= igrid then
suffix = " (hidden)"
end
table.insert(rv, "## grid "..igrid..suffix)
end
- for i = 1, grid.height do
+ local height = grid.height
+ if igrid == self.msg_grid then
+ height = self._grids[1].height - self.msg_grid_pos
+ end
+ for i = 1, 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(igrid, i, attr_state, cursor).."|")
@@ -1302,6 +1304,7 @@ function Screen:print_snapshot(attrs, ignore)
end
attrstr = (", attr_ids={\n"..table.concat(attrstrs, "\n").."\n}")
end
+
print( "\nscreen:expect{grid=[[")
print(kwargs.grid)
io.stdout:write( "]]"..attrstr)