aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/functional/api/buffer_spec.lua35
-rw-r--r--test/functional/api/vim_spec.lua22
-rw-r--r--test/functional/ui/float_spec.lua34
3 files changed, 68 insertions, 23 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()
diff --git a/test/functional/api/vim_spec.lua b/test/functional/api/vim_spec.lua
index b10076c6da..75b9fb71c9 100644
--- a/test/functional/api/vim_spec.lua
+++ b/test/functional/api/vim_spec.lua
@@ -1359,6 +1359,9 @@ describe('API', function()
eq({id=1}, meths.get_current_buf())
local screen = Screen.new(20, 4)
+ screen:set_default_attr_ids({
+ [1] = {bold = true, foreground = Screen.colors.Blue1},
+ })
screen:attach()
--
@@ -1373,7 +1376,7 @@ describe('API', function()
end
--
- -- Visiting a scratch-buffer DOES change its properties.
+ -- Visiting a scratch-buffer DOES NOT change its properties.
--
meths.set_current_buf(edited_buf)
screen:expect([[
@@ -1381,12 +1384,19 @@ describe('API', function()
{1:~ }|
{1:~ }|
|
- ]], {
- [1] = {bold = true, foreground = Screen.colors.Blue1},
- })
- eq('', meths.buf_get_option(edited_buf, 'buftype'))
- eq('', meths.buf_get_option(edited_buf, 'bufhidden'))
+ ]])
+ eq('nofile', meths.buf_get_option(edited_buf, 'buftype'))
+ eq('hide', meths.buf_get_option(edited_buf, 'bufhidden'))
eq(false, meths.buf_get_option(edited_buf, 'swapfile'))
+
+ -- scratch buffer can be wiped without error
+ command('bwipe')
+ screen:expect([[
+ ^ |
+ {1:~ }|
+ {1:~ }|
+ |
+ ]])
end)
end)
end)
diff --git a/test/functional/ui/float_spec.lua b/test/functional/ui/float_spec.lua
index 784c2d98f5..2ed3606491 100644
--- a/test/functional/ui/float_spec.lua
+++ b/test/functional/ui/float_spec.lua
@@ -504,7 +504,7 @@ describe('floating windows', function()
local win = meths.open_win(buf, false, 15, 4, {relative='editor', row=2, col=10})
meths.win_set_option(win , 'winhl', 'Normal:PMenu')
local expected_pos = {
- [3]={{id=1001}, 'NW', 1, 2, 10, true},
+ [4]={{id=1002}, 'NW', 1, 2, 10, true},
}
if multigrid then
screen:expect{grid=[[
@@ -523,7 +523,7 @@ describe('floating windows', function()
{0:~ }|
{0:~ }|
{0:~ }|
- ## grid 3
+ ## grid 4
{1:such }|
{1:very }|
{1:float }|
@@ -555,7 +555,7 @@ describe('floating windows', function()
{0:~ }|
{0:~ }|
{0:~ }|
- ## grid 3
+ ## grid 4
{1:such }|
{1:very }|
{1:float }|
@@ -583,7 +583,7 @@ describe('floating windows', function()
^ |
{0:~ }|
{0:~ }|
- ## grid 3
+ ## grid 4
{1:such }|
{1:very }|
{1:float }|
@@ -608,7 +608,7 @@ describe('floating windows', function()
## grid 2
^ |
{0:~ }|
- ## grid 3
+ ## grid 4
{1:such }|
{1:very }|
{1:float }|
@@ -631,7 +631,7 @@ describe('floating windows', function()
## grid 2
|
{0:~ }|
- ## grid 3
+ ## grid 4
{1:such }|
{1:very }|
{1:^float }|
@@ -663,7 +663,7 @@ describe('floating windows', function()
{0:~ }|
{0:~ }|
{0:~ }|
- ## grid 3
+ ## grid 4
{1:such }|
{1:very }|
{1:^float }|
@@ -700,7 +700,7 @@ describe('floating windows', function()
{0:~ }|
{0:~ }|
{0:~ }|
- ## grid 3
+ ## grid 4
{1:^such }|
{1:very }|
{1:float }|
@@ -735,7 +735,7 @@ describe('floating windows', function()
{0:~ }|
{0:~ }|
{0:~ }|
- ## grid 3
+ ## grid 4
{1:^such }|
{1:very }|
{1:float }|
@@ -770,7 +770,7 @@ describe('floating windows', function()
{0:~ }|
{0:~ }|
{0:~ }|
- ## grid 3
+ ## grid 4
{1:^such }|
{1:very }|
{1:float }|
@@ -805,7 +805,7 @@ describe('floating windows', function()
{0:~ }|
{0:~ }|
{0:~ }|
- ## grid 3
+ ## grid 4
{1:^such }|
{1:very }|
{1:float }|
@@ -840,7 +840,7 @@ describe('floating windows', function()
{0:~ }|
{0:~ }|
{0:~ }|
- ## grid 3
+ ## grid 4
{1:^such }|
{1:very }|
{1:float }|
@@ -875,7 +875,7 @@ describe('floating windows', function()
{0:~ }|
{0:~ }|
{0:~ }|
- ## grid 3
+ ## grid 4
{1:^such }|
{1:very }|
{1:float }|
@@ -910,7 +910,7 @@ describe('floating windows', function()
{0:~ }|
{0:~ }|
{0:~ }|
- ## grid 3
+ ## grid 4
{1:^such }|
{1:very }|
{1:float }|
@@ -945,7 +945,7 @@ describe('floating windows', function()
{0:~ }|
{0:~ }|
{0:~ }|
- ## grid 3
+ ## grid 4
{1:^such }|
{1:very }|
{1:float }|
@@ -971,7 +971,7 @@ describe('floating windows', function()
|
## grid 2
|
- ## grid 3
+ ## grid 4
{1:^such }|
{1:very }|
{1:float }|
@@ -1001,7 +1001,7 @@ describe('floating windows', function()
{0:~ }|
{0:~ }|
{0:~ }|
- ## grid 3
+ ## grid 4
{1:^such }|
{1:very }|
{1:float }|