aboutsummaryrefslogtreecommitdiff
path: root/test/functional/api/buffer_spec.lua
diff options
context:
space:
mode:
authorBjörn Linse <bjorn.linse@gmail.com>2019-03-04 17:53:41 +0100
committerBjörn Linse <bjorn.linse@gmail.com>2019-03-05 15:05:23 +0100
commitf5d5da391715f3b1d4c3d36c522e39b94866b93f (patch)
tree33fb008f256d8974bfb7cd0cc942656c5bc88181 /test/functional/api/buffer_spec.lua
parent2816bc8620ca373145842641ce77805f4321b2bc (diff)
downloadrneovim-f5d5da391715f3b1d4c3d36c522e39b94866b93f.tar.gz
rneovim-f5d5da391715f3b1d4c3d36c522e39b94866b93f.tar.bz2
rneovim-f5d5da391715f3b1d4c3d36c522e39b94866b93f.zip
buffer: use aucmd_prepbuf() instead of switch_to_win_for_buf()
Diffstat (limited to 'test/functional/api/buffer_spec.lua')
-rw-r--r--test/functional/api/buffer_spec.lua35
1 files changed, 35 insertions, 0 deletions
diff --git a/test/functional/api/buffer_spec.lua b/test/functional/api/buffer_spec.lua
index d9412f0f13..93599c04f1 100644
--- a/test/functional/api/buffer_spec.lua
+++ b/test/functional/api/buffer_spec.lua
@@ -1,7 +1,9 @@
local helpers = require('test.functional.helpers')(after_each)
+local Screen = require('test.functional.ui.screen')
local clear, nvim, buffer = helpers.clear, helpers.nvim, helpers.buffer
local curbuf, curwin, eq = helpers.curbuf, helpers.curwin, helpers.eq
local curbufmeths, ok = helpers.curbufmeths, helpers.ok
+local meths = helpers.meths
local funcs = helpers.funcs
local request = helpers.request
local exc_exec = helpers.exc_exec
@@ -11,6 +13,7 @@ local NIL = helpers.NIL
local meth_pcall = helpers.meth_pcall
local command = helpers.command
local bufmeths = helpers.bufmeths
+local feed = helpers.feed
describe('api/buf', function()
before_each(clear)
@@ -299,6 +302,38 @@ describe('api/buf', function()
local retval = exc_exec("call nvim_buf_set_lines(1, 0, 1, v:false, ['test'])")
eq(0, retval)
end)
+
+ it("set_lines of invisible buffer doesn't move cursor in current window", function()
+ local screen = Screen.new(20, 5)
+ screen:set_default_attr_ids({
+ [1] = {bold = true, foreground = Screen.colors.Blue1},
+ [2] = {bold = true},
+ })
+ screen:attach()
+
+ insert([[
+ Who would win?
+ A real window
+ with proper text]])
+ local buf = meths.create_buf(false,true)
+ screen:expect([[
+ Who would win? |
+ A real window |
+ with proper tex^t |
+ {1:~ }|
+ |
+ ]])
+
+ meths.buf_set_lines(buf, 0, -1, true, {'or some', 'scratchy text'})
+ feed('i') -- provoke redraw
+ screen:expect([[
+ Who would win? |
+ A real window |
+ with proper tex^t |
+ {1:~ }|
+ {2:-- INSERT --} |
+ ]])
+ end)
end)
describe('get_offset', function()