mirror of
https://github.com/neovim/neovim.git
synced 2025-10-21 09:12:07 +00:00
feat(ui): restore has('gui_running')
Problem:
has('gui_running') is still common in the wild and our answer has
changed over time, causing frustration.
95a6ccbe9f
Solution:
Use stdin_tty/stdout_tty to decide if a UI is (not) a GUI.
This commit is contained in:
@@ -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'))
|
||||
|
Reference in New Issue
Block a user