mirror of
https://github.com/neovim/neovim.git
synced 2025-12-15 19:05:40 +00:00
test/ui: update tests for new msg_grid implementation
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user