aboutsummaryrefslogtreecommitdiff
path: root/test/functional/api/vim_spec.lua
diff options
context:
space:
mode:
authorBjörn Linse <bjorn.linse@gmail.com>2020-12-20 16:52:01 +0100
committerBjörn Linse <bjorn.linse@gmail.com>2021-03-12 14:44:47 +0100
commited0893698777ae13c06cb3c76a8b7b4b9a967d5f (patch)
treeda476ca57309c5a8006d48c4bc546d4c3799b212 /test/functional/api/vim_spec.lua
parent097ec71bd82840996e4ba06d0006850b0ad7b5d1 (diff)
downloadrneovim-ed0893698777ae13c06cb3c76a8b7b4b9a967d5f.tar.gz
rneovim-ed0893698777ae13c06cb3c76a8b7b4b9a967d5f.tar.bz2
rneovim-ed0893698777ae13c06cb3c76a8b7b4b9a967d5f.zip
api: allow open non-current buffer as terminal (+ xmas bonus)
vim.api.nvim_chan_send(vim.api.nvim_open_term(0), io.open("/path/to/smile.cat", "r"):read("*a"))
Diffstat (limited to 'test/functional/api/vim_spec.lua')
-rw-r--r--test/functional/api/vim_spec.lua63
1 files changed, 63 insertions, 0 deletions
diff --git a/test/functional/api/vim_spec.lua b/test/functional/api/vim_spec.lua
index 437a1858f3..3db44f3f11 100644
--- a/test/functional/api/vim_spec.lua
+++ b/test/functional/api/vim_spec.lua
@@ -2087,4 +2087,67 @@ describe('API', function()
eq("", meths.exec("messages", true))
end)
end)
+
+
+ describe('nvim_open_term', function()
+ local screen
+
+ before_each(function()
+ clear()
+ screen = Screen.new(100, 35)
+ screen:attach()
+ screen:set_default_attr_ids({
+ [0] = {bold=true, foreground=Screen.colors.Blue},
+ [1] = {background = Screen.colors.Plum1};
+ [2] = {background = tonumber('0xffff40'), bg_indexed = true};
+ [3] = {background = Screen.colors.Plum1, fg_indexed = true, foreground = tonumber('0x00e000')};
+ [4] = {bold = true, reverse = true, background = Screen.colors.Plum1};
+ })
+ end)
+
+ it('can batch process sequences', function()
+ local b = meths.create_buf(true,true)
+ meths.open_win(b, false, {width=79, height=31, row=1, col=1, relative='editor'})
+ local t = meths.open_term(b, {})
+
+ meths.chan_send(t, io.open("test/functional/fixtures/smile2.cat", "r"):read("*a"))
+ screen:expect{grid=[[
+ ^ |
+ {0:~}{1::smile }{0: }|
+ {0:~}{1: }{2:oooo$$$$$$$$$$$$oooo}{1: }{0: }|
+ {0:~}{1: }{2:oo$$$$$$$$$$$$$$$$$$$$$$$$o}{1: }{0: }|
+ {0:~}{1: }{2:oo$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$o}{1: }{2:o$}{1: }{2:$$}{1: }{2:o$}{1: }{0: }|
+ {0:~}{1: }{2:o}{1: }{2:$}{1: }{2:oo}{1: }{2:o$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$o}{1: }{2:$$}{1: }{2:$$}{1: }{2:$$o$}{1: }{0: }|
+ {0:~}{1: }{2:oo}{1: }{2:$}{1: }{2:$}{1: "}{2:$}{1: }{2:o$$$$$$$$$}{1: }{2:$$$$$$$$$$$$$}{1: }{2:$$$$$$$$$o}{1: }{2:$$$o$$o$}{1: }{0: }|
+ {0:~}{1: "}{2:$$$$$$o$}{1: }{2:o$$$$$$$$$}{1: }{2:$$$$$$$$$$$}{1: }{2:$$$$$$$$$$o}{1: }{2:$$$$$$$$}{1: }{0: }|
+ {0:~}{1: }{2:$$$$$$$}{1: }{2:$$$$$$$$$$$}{1: }{2:$$$$$$$$$$$}{1: }{2:$$$$$$$$$$$$$$$$$$$$$$$}{1: }{0: }|
+ {0:~}{1: }{2:$$$$$$$$$$$$$$$$$$$$$$$}{1: }{2:$$$$$$$$$$$$$}{1: }{2:$$$$$$$$$$$$$$}{1: """}{2:$$$}{1: }{0: }|
+ {0:~}{1: "}{2:$$$}{1:""""}{2:$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$}{1: "}{2:$$$}{1: }{0: }|
+ {0:~}{1: }{2:$$$}{1: }{2:o$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$}{1: "}{2:$$$o}{1: }{0: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}|
+ {0:~}{1: }{2:$$$$$$$$$$}{1:" }{0: }|
+ {0:~}{1: "}{2:$$$}{1:"""" }{0: }|
+ {0:~}{1: }{0: }|
+ {0:~}{3:Press ENTER or type command to continue}{1: }{0: }|
+ {0:~}{4:term://~/config2/docs/pres//32693:vim --clean +smile 29,39 All}{0: }|
+ {0:~}{1::call nvim__screenshot("smile2.cat") }{0: }|
+ {0:~ }|
+ {0:~ }|
+ |
+ ]]}
+ end)
+ end)
end)