Merge #22382 has('gui_running')

This commit is contained in:
Justin M. Keyes
2023-02-28 06:24:23 -05:00
committed by GitHub
12 changed files with 110 additions and 30 deletions

View File

@@ -2549,20 +2549,26 @@ describe('API', function()
{
chan = 1,
ext_cmdline = false,
ext_hlstate = false,
ext_linegrid = screen._options.ext_linegrid or false,
ext_messages = false,
ext_multigrid = false,
ext_popupmenu = false,
ext_tabline = false,
ext_wildmenu = false,
ext_linegrid = screen._options.ext_linegrid or false,
ext_multigrid = false,
ext_hlstate = false,
ext_termcolors = false,
ext_messages = false,
ext_wildmenu = false,
height = 4,
rgb = true,
override = true,
rgb = true,
stdin_tty = false,
stdout_tty = false,
term_background = '',
term_colors = 0,
term_name = '',
width = 20,
}
}
eq(expected, nvim("list_uis"))
screen:detach()

View File

@@ -1398,17 +1398,34 @@ describe('TUI', function()
]]}
end)
it('is included in nvim_list_uis()', function()
feed_data(':echo map(nvim_list_uis(), {k,v -> sort(items(filter(v, {k,v -> k[:3] !=# "ext_" })))})\r')
screen:expect([=[
|
{4:~ }|
{5: }|
[[['chan', 1], ['height', 6], ['override', v:false|
], ['rgb', v:false], ['width', 50]]] |
{10:Press ENTER or type command to continue}{1: } |
{3:-- TERMINAL --} |
]=])
it('in nvim_list_uis()', function()
-- $TERM in :terminal.
local exp_term = is_os('bsd') and 'builtin_xterm' or 'xterm-256color'
local expected = {
{
chan = 1,
ext_cmdline = false,
ext_hlstate = false,
ext_linegrid = true,
ext_messages = false,
ext_multigrid = false,
ext_popupmenu = false,
ext_tabline = false,
ext_termcolors = true,
ext_wildmenu = false,
height = 6,
override = false,
rgb = false,
stdin_tty = true,
stdout_tty = true,
term_background = '',
term_colors = 256,
term_name = exp_term,
width = 50
},
}
local _, rv = child_session:request('nvim_list_uis')
eq(expected, rv)
end)
it('allows grid to assume wider ambiguous-width characters than host terminal #19686', function()

View File

@@ -1,8 +1,11 @@
local helpers = require('test.functional.helpers')(after_each)
local eq = helpers.eq
local Screen = require('test.functional.ui.screen')
local clear = helpers.clear
local connect = helpers.connect
local eq = helpers.eq
local funcs = helpers.funcs
local is_os = helpers.is_os
local nvim_prog = helpers.nvim_prog
describe('has()', function()
before_each(clear)
@@ -69,8 +72,22 @@ describe('has()', function()
end
end)
it('"gui_running"', function()
eq(0, funcs.has('gui_running'))
local tui = Screen.new(50,15)
local gui_session = connect(funcs.serverstart())
local gui = Screen.new(50,15)
eq(0, funcs.has('gui_running'))
tui:attach({ext_linegrid=true, rgb=true, stdin_tty=true, stdout_tty=true})
gui:attach({ext_multigrid=true, rgb=true}, gui_session)
eq(1, funcs.has('gui_running'))
tui:detach()
eq(1, funcs.has('gui_running'))
gui:detach()
eq(0, funcs.has('gui_running'))
end)
it('does not change v:shell_error', function()
local nvim_prog = helpers.nvim_prog
funcs.system({nvim_prog, '-es', '+73cquit'})
funcs.has('python3') -- use a call whose implementation shells out
eq(73, funcs.eval('v:shell_error'))