aboutsummaryrefslogtreecommitdiff
path: root/test/functional/ui
diff options
context:
space:
mode:
authorbfredl <bjorn.linse@gmail.com>2022-04-22 20:56:31 +0200
committerbfredl <bjorn.linse@gmail.com>2022-05-02 22:19:41 +0200
commitad63b94b03c166f37bda477db6cbac2a9583d586 (patch)
tree49ee0ca3d359e52630d7e30e5dbb5a53275640b1 /test/functional/ui
parent619c8f4b9143e4dea0fb967ccdce594e14956ed3 (diff)
downloadrneovim-ad63b94b03c166f37bda477db6cbac2a9583d586.tar.gz
rneovim-ad63b94b03c166f37bda477db6cbac2a9583d586.tar.bz2
rneovim-ad63b94b03c166f37bda477db6cbac2a9583d586.zip
refactor(ui): simplify stdin handling
Diffstat (limited to 'test/functional/ui')
-rw-r--r--test/functional/ui/embed_spec.lua48
1 files changed, 48 insertions, 0 deletions
diff --git a/test/functional/ui/embed_spec.lua b/test/functional/ui/embed_spec.lua
index 8218c8e12d..92f5beebf5 100644
--- a/test/functional/ui/embed_spec.lua
+++ b/test/functional/ui/embed_spec.lua
@@ -1,3 +1,5 @@
+local uv = require'luv'
+
local helpers = require('test.functional.helpers')(after_each)
local Screen = require('test.functional.ui.screen')
@@ -98,3 +100,49 @@ end
describe('--embed UI on startup (ext_linegrid=true)', function() test_embed(true) end)
describe('--embed UI on startup (ext_linegrid=false)', function() test_embed(false) end)
+
+describe('--embed UI', function()
+ it('can pass stdin', function()
+ local pipe = assert(uv.pipe())
+
+ local writer = assert(uv.new_pipe(false))
+ writer:open(pipe.write)
+
+ clear {args_rm={'--headless'}, io_extra=pipe.read}
+
+ -- attach immediately after startup, for early UI
+ local screen = Screen.new(40, 8)
+ screen:attach {stdin_fd=3}
+ screen:set_default_attr_ids {
+ [1] = {bold = true, foreground = Screen.colors.Blue1};
+ [2] = {bold = true};
+ }
+
+ writer:write "hello nvim\nfrom external input\n"
+ writer:shutdown(function() writer:close() end)
+
+ screen:expect{grid=[[
+ ^hello nvim |
+ from external input |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ |
+ ]]}
+
+ -- stdin (rpc input) still works
+ feed 'o'
+ screen:expect{grid=[[
+ hello nvim |
+ ^ |
+ from external input |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {2:-- INSERT --} |
+ ]]}
+ end)
+end)