mirror of
https://github.com/neovim/neovim.git
synced 2025-10-22 17:11:49 +00:00
test/ui: update tests for new msg_grid implementation
This commit is contained in:
@@ -222,6 +222,7 @@ describe('timers', function()
|
||||
let g:val = 0
|
||||
func! MyHandler(timer)
|
||||
echo "evil"
|
||||
redraw
|
||||
let g:val = 1
|
||||
endfunc
|
||||
]])
|
||||
|
@@ -56,6 +56,8 @@ local function screen_setup(extra_rows, command, cols, opts)
|
||||
[8] = {foreground = 15, background = 1}, -- error message
|
||||
[9] = {foreground = 4},
|
||||
[10] = {foreground = 121}, -- "Press ENTER" in embedded :terminal session.
|
||||
[11] = {foreground = tonumber('0x00000b')},
|
||||
[12] = {reverse = true, foreground = tonumber('0x000079')},
|
||||
})
|
||||
|
||||
screen:attach(opts or {rgb=false})
|
||||
|
@@ -89,6 +89,85 @@ describe('TUI', function()
|
||||
eq(2, eval("1+1")) -- Still alive?
|
||||
end)
|
||||
|
||||
it('accepts resize while pager is active', function()
|
||||
child_session:request("nvim_command", [[
|
||||
set more
|
||||
func! ManyErr()
|
||||
for i in range(10)
|
||||
echoerr "FAIL ".i
|
||||
endfor
|
||||
endfunc
|
||||
]])
|
||||
feed_data(':call ManyErr()\r')
|
||||
screen:expect{grid=[[
|
||||
{8:Error detected while processing function ManyErr:} |
|
||||
{11:line 2:} |
|
||||
{8:FAIL 0} |
|
||||
{8:FAIL 1} |
|
||||
{8:FAIL 2} |
|
||||
{10:-- More --}{1: } |
|
||||
{3:-- TERMINAL --} |
|
||||
]]}
|
||||
|
||||
feed_data('d')
|
||||
screen:expect{grid=[[
|
||||
{8:FAIL 1} |
|
||||
{8:FAIL 2} |
|
||||
{8:FAIL 3} |
|
||||
{8:FAIL 4} |
|
||||
{8:FAIL 5} |
|
||||
{10:-- More --}{1: } |
|
||||
{3:-- TERMINAL --} |
|
||||
]]}
|
||||
|
||||
screen:try_resize(50,5)
|
||||
screen:expect{grid=[[
|
||||
{8:FAIL 1} |
|
||||
{8:FAIL 2} |
|
||||
{8:FAIL 3} |
|
||||
{10:-- More -- SPACE/d/j: screen/page/line down, b/u/}{12:k}|
|
||||
{3:-- TERMINAL --} |
|
||||
]]}
|
||||
|
||||
-- TODO(bfredl): messes up the output (just like vim does).
|
||||
feed_data('g')
|
||||
screen:expect{grid=[[
|
||||
{8:FAIL 1} ) |
|
||||
{8:Error detected while processing function ManyErr:} |
|
||||
{11:line 2:} |
|
||||
{10:-- More --}{1: } |
|
||||
{3:-- TERMINAL --} |
|
||||
]]}
|
||||
|
||||
screen:try_resize(50,10)
|
||||
screen:expect{grid=[[
|
||||
{8:FAIL 1} ) |
|
||||
{8:Error detected while processing function ManyErr:} |
|
||||
{11:line 2:} |
|
||||
{10:-- More --} |
|
||||
{10: }|
|
||||
{10: }|
|
||||
{10: }|
|
||||
{10: }|
|
||||
{10:-- More -- SPACE/d/j: screen/page/line down, b/u/}{12:k}|
|
||||
{3:-- TERMINAL --} |
|
||||
]]}
|
||||
|
||||
feed_data('\003')
|
||||
screen:expect{grid=[[
|
||||
{1: } |
|
||||
{4:~ }|
|
||||
{4:~ }|
|
||||
{4:~ }|
|
||||
{4:~ }|
|
||||
{4:~ }|
|
||||
{4:~ }|
|
||||
{5:[No Name] }|
|
||||
|
|
||||
{3:-- TERMINAL --} |
|
||||
]]}
|
||||
end)
|
||||
|
||||
it('accepts basic utf-8 input', function()
|
||||
feed_data('iabc\ntest1\ntest2')
|
||||
screen:expect([[
|
||||
|
@@ -158,7 +158,7 @@ describe(':terminal with multigrid', function()
|
||||
[2:--------------------------------------------------]|
|
||||
[2:--------------------------------------------------]|
|
||||
[2:--------------------------------------------------]|
|
||||
{3:-- TERMINAL --} |
|
||||
[3:--------------------------------------------------]|
|
||||
## grid 2
|
||||
tty ready |
|
||||
{1: } |
|
||||
@@ -166,6 +166,8 @@ describe(':terminal with multigrid', function()
|
||||
|
|
||||
|
|
||||
|
|
||||
## grid 3
|
||||
{3:-- TERMINAL --} |
|
||||
]])
|
||||
|
||||
screen:try_resize_grid(2, 20, 10)
|
||||
@@ -180,7 +182,7 @@ describe(':terminal with multigrid', function()
|
||||
[2:--------------------------------------------------]|
|
||||
[2:--------------------------------------------------]|
|
||||
[2:--------------------------------------------------]|
|
||||
{3:-- TERMINAL --} |
|
||||
[3:--------------------------------------------------]|
|
||||
## grid 2
|
||||
tty ready |
|
||||
rows: 10, cols: 20 |
|
||||
@@ -192,6 +194,8 @@ describe(':terminal with multigrid', function()
|
||||
|
|
||||
|
|
||||
|
|
||||
## grid 3
|
||||
{3:-- TERMINAL --} |
|
||||
]])
|
||||
end
|
||||
|
||||
@@ -207,11 +211,13 @@ describe(':terminal with multigrid', function()
|
||||
[2:--------------------------------------------------]|
|
||||
[2:--------------------------------------------------]|
|
||||
[2:--------------------------------------------------]|
|
||||
{3:-- TERMINAL --} |
|
||||
[3:--------------------------------------------------]|
|
||||
## grid 2
|
||||
rows: 10, cols: 20 |
|
||||
rows: 3, cols: 70 |
|
||||
{1: } |
|
||||
## grid 3
|
||||
{3:-- TERMINAL --} |
|
||||
]])
|
||||
end
|
||||
|
||||
@@ -227,7 +233,7 @@ describe(':terminal with multigrid', function()
|
||||
[2:--------------------------------------------------]|
|
||||
[2:--------------------------------------------------]|
|
||||
[2:--------------------------------------------------]|
|
||||
{3:-- TERMINAL --} |
|
||||
[3:--------------------------------------------------]|
|
||||
## grid 2
|
||||
tty ready |
|
||||
rows: 10, cols: 20 |
|
||||
@@ -235,6 +241,8 @@ describe(':terminal with multigrid', function()
|
||||
rows: 6, cols: 50 |
|
||||
{1: } |
|
||||
|
|
||||
## grid 3
|
||||
{3:-- TERMINAL --} |
|
||||
]])
|
||||
end
|
||||
end)
|
||||
|
@@ -216,10 +216,10 @@ describe('ui/cursor', function()
|
||||
if m.blinkwait then m.blinkwait = 700 end
|
||||
end
|
||||
if m.hl_id then
|
||||
m.hl_id = 54
|
||||
m.hl_id = 55
|
||||
m.attr = {background = Screen.colors.DarkGray}
|
||||
end
|
||||
if m.id_lm then m.id_lm = 55 end
|
||||
if m.id_lm then m.id_lm = 56 end
|
||||
end
|
||||
|
||||
-- Assert the new expectation.
|
||||
|
@@ -18,6 +18,7 @@ local function test_embed(ext_linegrid)
|
||||
[2] = {bold = true, foreground = Screen.colors.SeaGreen4},
|
||||
[3] = {bold = true, foreground = Screen.colors.Blue1},
|
||||
[4] = {bold = true, foreground = Screen.colors.Green},
|
||||
[5] = {bold = true, reverse = true},
|
||||
})
|
||||
end
|
||||
|
||||
@@ -53,7 +54,7 @@ local function test_embed(ext_linegrid)
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
{5: }|
|
||||
Error detected while processing pre-vimrc command line: |
|
||||
foo |
|
||||
{1:bar} |
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -933,17 +933,29 @@ end)
|
||||
|
||||
|
||||
describe("MsgSeparator highlight and msgsep fillchar", function()
|
||||
before_each(clear)
|
||||
it("works", function()
|
||||
local screen = Screen.new(50,5)
|
||||
local screen
|
||||
before_each(function()
|
||||
clear()
|
||||
screen = Screen.new(50,5)
|
||||
screen:set_default_attr_ids({
|
||||
[1] = {bold=true, foreground=Screen.colors.Blue},
|
||||
[2] = {bold=true, reverse=true},
|
||||
[3] = {bold = true, foreground = Screen.colors.SeaGreen4},
|
||||
[4] = {background = Screen.colors.Cyan, bold = true, reverse = true},
|
||||
[5] = {bold = true, background = Screen.colors.Magenta}
|
||||
[5] = {bold = true, background = Screen.colors.Magenta},
|
||||
[6] = {background = Screen.colors.WebGray},
|
||||
[7] = {background = Screen.colors.WebGray, bold = true, foreground = Screen.colors.SeaGreen4},
|
||||
[8] = {foreground = Screen.colors.Grey0, background = Screen.colors.Gray60},
|
||||
[9] = {foreground = Screen.colors.Grey40, background = Screen.colors.Gray60},
|
||||
[10] = {foreground = tonumber('0x000019'), background = Screen.colors.Gray60},
|
||||
[11] = {background = Screen.colors.Gray60, bold = true, foreground = tonumber('0x666699')},
|
||||
[12] = {background = Screen.colors.Gray60, bold = true, foreground = tonumber('0x297d4e')},
|
||||
[13] = {background = tonumber('0xff4cff'), bold = true, foreground = tonumber('0xb200ff')},
|
||||
})
|
||||
screen:attach()
|
||||
end)
|
||||
|
||||
it("works", function()
|
||||
|
||||
-- defaults
|
||||
feed_command("ls")
|
||||
@@ -1000,6 +1012,61 @@ describe("MsgSeparator highlight and msgsep fillchar", function()
|
||||
{3:Press ENTER or type command to continue}^ |
|
||||
]])
|
||||
end)
|
||||
|
||||
it("and MsgArea", function()
|
||||
feed_command("hi MsgArea guibg=Gray")
|
||||
screen:expect{grid=[[
|
||||
^ |
|
||||
{1:~ }|
|
||||
{1:~ }|
|
||||
{1:~ }|
|
||||
{6: }|
|
||||
]]}
|
||||
feed(":ls")
|
||||
screen:expect{grid=[[
|
||||
|
|
||||
{1:~ }|
|
||||
{1:~ }|
|
||||
{1:~ }|
|
||||
{6::ls^ }|
|
||||
]]}
|
||||
feed(":<cr>")
|
||||
screen:expect{grid=[[
|
||||
|
|
||||
{2: }|
|
||||
{6::ls: }|
|
||||
{6: 1 %a "[No Name]" line 1 }|
|
||||
{7:Press ENTER or type command to continue}{6:^ }|
|
||||
]]}
|
||||
|
||||
-- support madness^Wblending of message "overlay"
|
||||
feed_command("hi MsgArea blend=20")
|
||||
feed_command("hi clear MsgSeparator")
|
||||
feed_command("hi MsgSeparator blend=30 guibg=Magenta")
|
||||
screen:expect{grid=[[
|
||||
^ |
|
||||
{1:~ }|
|
||||
{1:~ }|
|
||||
{1:~ }|
|
||||
{8::hi}{9: }{8:MsgSeparator}{9: }{8:blend=30}{9: }{8:guibg=Magenta}{9: }|
|
||||
]]}
|
||||
feed(":ls")
|
||||
screen:expect{grid=[[
|
||||
|
|
||||
{1:~ }|
|
||||
{1:~ }|
|
||||
{1:~ }|
|
||||
{8::ls}{9:^ }|
|
||||
]]}
|
||||
feed("<cr>")
|
||||
screen:expect{grid=[[
|
||||
|
|
||||
{13:~ }|
|
||||
{10::ls}{11: }|
|
||||
{11:~ }{10:1}{11: }{10:%a}{11: }{10:"[No}{11: }{10:Name]"}{11: }{10:line}{11: }{10:1}{11: }|
|
||||
{12:Press}{9: }{12:ENTER}{9: }{12:or}{9: }{12:type}{9: }{12:command}{9: }{12:to}{9: }{12:continue}{9:^ }|
|
||||
]]}
|
||||
end)
|
||||
end)
|
||||
|
||||
describe("'winhighlight' highlight", function()
|
||||
|
@@ -39,7 +39,7 @@ describe('ext_hlstate detailed highlights', function()
|
||||
{5:~ }|
|
||||
{5:~ }|
|
||||
{5:~ }|
|
||||
{6:search hit BOTTOM, continuing at TOP} |
|
||||
{8:search hit BOTTOM, continuing at TOP}{7: }|
|
||||
]], {
|
||||
[1] = {{foreground = Screen.colors.Magenta},
|
||||
{{hi_name = "Constant", kind = "syntax"}}},
|
||||
@@ -52,6 +52,8 @@ describe('ext_hlstate detailed highlights', function()
|
||||
{{hi_name = "NonText", ui_name = "EndOfBuffer", kind = "ui"}}},
|
||||
[6] = {{foreground = Screen.colors.Red},
|
||||
{{hi_name = "WarningMsg", ui_name = "WarningMsg", kind = "ui"}}},
|
||||
[7] = {{}, {{hi_name = "MsgArea", ui_name = "MsgArea", kind = "ui"}}},
|
||||
[8] = {{foreground = Screen.colors.Red}, {7, 6}},
|
||||
})
|
||||
end)
|
||||
|
||||
@@ -66,6 +68,7 @@ describe('ext_hlstate detailed highlights', function()
|
||||
{{hi_name = "StatusLineNC", ui_name = "StatusLineNC" , kind = "ui"}}},
|
||||
[5] = {{}, {{hi_name = "StatusLine", ui_name = "StatusLine", kind = "ui"}}},
|
||||
[6] = {{}, {{hi_name = "StatusLineNC", ui_name = "StatusLineNC", kind = "ui"}}},
|
||||
[7] = {{}, {{hi_name = "MsgArea", ui_name = "MsgArea", kind = "ui"}}},
|
||||
})
|
||||
command("hi clear VertSplit")
|
||||
command("vsplit")
|
||||
@@ -78,7 +81,7 @@ describe('ext_hlstate detailed highlights', function()
|
||||
{2:~ }{1:│}{2:~ }|
|
||||
{2:~ }{1:│}{2:~ }|
|
||||
{3:[No Name] }{4:[No Name] }|
|
||||
|
|
||||
{7: }|
|
||||
]])
|
||||
|
||||
command("hi clear StatusLine | hi clear StatuslineNC")
|
||||
@@ -90,7 +93,7 @@ describe('ext_hlstate detailed highlights', function()
|
||||
{2:~ }{1:│}{2:~ }|
|
||||
{2:~ }{1:│}{2:~ }|
|
||||
{5:[No Name] }{6:[No Name] }|
|
||||
|
|
||||
{7: }|
|
||||
]])
|
||||
|
||||
-- redrawing is done even if visible highlights didn't change
|
||||
@@ -103,7 +106,7 @@ describe('ext_hlstate detailed highlights', function()
|
||||
{2:~ }{1:│}{2:~ }|
|
||||
{2:~ }{1:│}{2:~ }|
|
||||
{6:[No Name] }{5:[No Name] }|
|
||||
|
|
||||
{7: }|
|
||||
]])
|
||||
|
||||
end)
|
||||
@@ -120,7 +123,8 @@ describe('ext_hlstate detailed highlights', function()
|
||||
[8] = {{foreground = Screen.colors.Blue1, bold = true, reverse = true}, {6, 2}},
|
||||
[9] = {{bold = true, foreground = Screen.colors.Brown}, {{hi_name = "Statement", ui_name = "NormalNC", kind = "ui"}}},
|
||||
[10] = {{bold = true, foreground = Screen.colors.Brown}, {9, 1}},
|
||||
[11] = {{bold = true, foreground = Screen.colors.Blue1}, {9, 2}}
|
||||
[11] = {{bold = true, foreground = Screen.colors.Blue1}, {9, 2}},
|
||||
[12] = {{}, {{hi_name = "MsgArea", ui_name = "MsgArea", kind = "ui"}}},
|
||||
})
|
||||
|
||||
command("set number")
|
||||
@@ -134,7 +138,7 @@ describe('ext_hlstate detailed highlights', function()
|
||||
{1: 1 } |
|
||||
{2:~ }|
|
||||
{4:[No Name] }|
|
||||
|
|
||||
{12: }|
|
||||
]])
|
||||
|
||||
command("set winhl=LineNr:ErrorMsg")
|
||||
@@ -146,7 +150,7 @@ describe('ext_hlstate detailed highlights', function()
|
||||
{1: 1 } |
|
||||
{2:~ }|
|
||||
{4:[No Name] }|
|
||||
|
|
||||
{12: }|
|
||||
]])
|
||||
|
||||
command("set winhl=Normal:MsgSeparator,NormalNC:Statement")
|
||||
@@ -158,7 +162,7 @@ describe('ext_hlstate detailed highlights', function()
|
||||
{1: 1 } |
|
||||
{2:~ }|
|
||||
{4:[No Name] }|
|
||||
|
|
||||
{12: }|
|
||||
]])
|
||||
|
||||
command("wincmd w")
|
||||
@@ -170,7 +174,7 @@ describe('ext_hlstate detailed highlights', function()
|
||||
{1: 1 }^ |
|
||||
{2:~ }|
|
||||
{3:[No Name] }|
|
||||
|
|
||||
{12: }|
|
||||
]])
|
||||
end)
|
||||
|
||||
@@ -182,6 +186,7 @@ describe('ext_hlstate detailed highlights', function()
|
||||
[4] = {{foreground = 52479}, {2, 1}},
|
||||
[5] = {{foreground = 4259839}, {{kind = "term"}}},
|
||||
[6] = {{foreground = 4259839}, {5, 1}},
|
||||
[7] = {{}, {{hi_name = "MsgArea", ui_name = "MsgArea", kind = "ui"}}},
|
||||
})
|
||||
command('enew | call termopen(["'..nvim_dir..'/tty-test"])')
|
||||
screen:expect([[
|
||||
@@ -192,7 +197,7 @@ describe('ext_hlstate detailed highlights', function()
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
{7: }|
|
||||
]])
|
||||
|
||||
thelpers.feed_data('x ')
|
||||
@@ -210,7 +215,7 @@ describe('ext_hlstate detailed highlights', function()
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
{7: }|
|
||||
]])
|
||||
else
|
||||
screen:expect([[
|
||||
@@ -221,7 +226,7 @@ describe('ext_hlstate detailed highlights', function()
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
{7: }|
|
||||
]])
|
||||
end
|
||||
|
||||
@@ -236,7 +241,7 @@ describe('ext_hlstate detailed highlights', function()
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
{7: }|
|
||||
]])
|
||||
else
|
||||
screen:expect([[
|
||||
@@ -247,7 +252,7 @@ describe('ext_hlstate detailed highlights', function()
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
{7: }|
|
||||
]])
|
||||
end
|
||||
end)
|
||||
@@ -259,6 +264,7 @@ describe('ext_hlstate detailed highlights', function()
|
||||
screen:set_default_attr_ids({
|
||||
[1] = {{bold = true, foreground = Screen.colors.Blue1}, {foreground = 12}, {{hi_name = "NonText", ui_name = "EndOfBuffer", kind = "ui"}}},
|
||||
[2] = {{reverse = true, foreground = Screen.colors.Red}, {foreground = 10, italic=true}, {{hi_name = "NonText", ui_name = "EndOfBuffer", kind = "ui"}}},
|
||||
[3] = {{}, {}, {{hi_name = "MsgArea", ui_name = "MsgArea", kind = "ui"}}},
|
||||
})
|
||||
screen:expect([[
|
||||
^ |
|
||||
@@ -268,7 +274,7 @@ describe('ext_hlstate detailed highlights', function()
|
||||
{1:~ }|
|
||||
{1:~ }|
|
||||
{1:~ }|
|
||||
|
|
||||
{3: }|
|
||||
]])
|
||||
|
||||
command("hi NonText guifg=Red gui=reverse ctermfg=Green cterm=italic")
|
||||
@@ -280,7 +286,7 @@ describe('ext_hlstate detailed highlights', function()
|
||||
{2:~ }|
|
||||
{2:~ }|
|
||||
{2:~ }|
|
||||
|
|
||||
{3: }|
|
||||
]])
|
||||
|
||||
end)
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -1128,7 +1128,7 @@ describe('builtin popupmenu', function()
|
||||
prefix |
|
||||
bef{n: word } |
|
||||
tex{n: }^ |
|
||||
{2:-- }{s: text } |
|
||||
{2:-- INSERT -} |
|
||||
]])
|
||||
|
||||
-- can't draw the pum, but check we don't crash
|
||||
@@ -1597,6 +1597,54 @@ describe('builtin popupmenu', function()
|
||||
]])
|
||||
end)
|
||||
|
||||
it('works with wildoptions=pum with scrolled mesages ', function()
|
||||
screen:try_resize(40,10)
|
||||
command('set wildmenu')
|
||||
command('set wildoptions=pum')
|
||||
|
||||
feed(':echoerr "fail"|echoerr "error"<cr>')
|
||||
screen:expect{grid=[[
|
||||
|
|
||||
{1:~ }|
|
||||
{1:~ }|
|
||||
{1:~ }|
|
||||
{1:~ }|
|
||||
{1:~ }|
|
||||
{4: }|
|
||||
{6:fail} |
|
||||
{6:error} |
|
||||
{5:Press ENTER or type command to continue}^ |
|
||||
]]}
|
||||
|
||||
feed(':sign <tab>')
|
||||
screen:expect{grid=[[
|
||||
|
|
||||
{1:~ }|
|
||||
{1:~ }|
|
||||
{1:~ }{s: define }{1: }|
|
||||
{1:~ }{n: jump }{1: }|
|
||||
{1:~ }{n: list }{1: }|
|
||||
{4: }{n: place }{4: }|
|
||||
{6:fail} {n: undefine } |
|
||||
{6:error}{n: unplace } |
|
||||
:sign define^ |
|
||||
]]}
|
||||
|
||||
feed('d')
|
||||
screen:expect{grid=[[
|
||||
|
|
||||
{1:~ }|
|
||||
{1:~ }|
|
||||
{1:~ }|
|
||||
{1:~ }|
|
||||
{1:~ }|
|
||||
{4: }|
|
||||
{6:fail} |
|
||||
{6:error} |
|
||||
:sign defined^ |
|
||||
]]}
|
||||
end)
|
||||
|
||||
it("'pumblend' RGB-color", function()
|
||||
screen:try_resize(60,14)
|
||||
screen:set_default_attr_ids({
|
||||
|
@@ -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