diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2023-02-27 16:31:05 +0100 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2023-02-27 19:50:59 +0100 |
commit | ce597235a26839826de88ecd8b949ec54c310fbd (patch) | |
tree | 145d03f0f47afef4fa7df2c6d1976de9c97049c3 /test/functional/vimscript/has_spec.lua | |
parent | 7f424e2b65779c59fc0cac3cc7508ba2ec07f200 (diff) | |
download | rneovim-ce597235a26839826de88ecd8b949ec54c310fbd.tar.gz rneovim-ce597235a26839826de88ecd8b949ec54c310fbd.tar.bz2 rneovim-ce597235a26839826de88ecd8b949ec54c310fbd.zip |
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.
https://github.com/vimpostor/vim-tpipeline/commit/95a6ccbe9f33bc42dd4cee45731d8bc3fbcd92d1
Solution:
Use stdin_tty/stdout_tty to decide if a UI is (not) a GUI.
Diffstat (limited to 'test/functional/vimscript/has_spec.lua')
-rw-r--r-- | test/functional/vimscript/has_spec.lua | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/test/functional/vimscript/has_spec.lua b/test/functional/vimscript/has_spec.lua index 2e26d603b3..78a761d370 100644 --- a/test/functional/vimscript/has_spec.lua +++ b/test/functional/vimscript/has_spec.lua @@ -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')) |