aboutsummaryrefslogtreecommitdiff
path: root/test/functional/api/buffer_spec.lua
diff options
context:
space:
mode:
Diffstat (limited to 'test/functional/api/buffer_spec.lua')
-rw-r--r--test/functional/api/buffer_spec.lua117
1 files changed, 50 insertions, 67 deletions
diff --git a/test/functional/api/buffer_spec.lua b/test/functional/api/buffer_spec.lua
index cf69958fd8..3775c8c7b7 100644
--- a/test/functional/api/buffer_spec.lua
+++ b/test/functional/api/buffer_spec.lua
@@ -125,11 +125,6 @@ describe('api/buf', function()
it('cursor position is maintained consistently with viewport', function()
local screen = Screen.new(20, 12)
- screen:set_default_attr_ids {
- [1] = { bold = true, foreground = Screen.colors.Blue1 },
- [2] = { reverse = true, bold = true },
- [3] = { reverse = true },
- }
screen:attach()
local lines = { 'line1', 'line2', 'line3', 'line4', 'line5', 'line6' }
@@ -143,11 +138,11 @@ describe('api/buf', function()
grid = [[
^ |
{1:~ }|*4
- {2:[No Name] }|
+ {3:[No Name] }|
line5 |
line6 |
{1:~ }|*2
- {3:[No Name] [+] }|
+ {2:[No Name] [+] }|
|
]],
}
@@ -158,11 +153,11 @@ describe('api/buf', function()
grid = [[
^ |
{1:~ }|*4
- {2:[No Name] }|
+ {3:[No Name] }|
boogalo 5 |
line6 |
{1:~ }|*2
- {3:[No Name] [+] }|
+ {2:[No Name] [+] }|
|
]],
}
@@ -172,11 +167,11 @@ describe('api/buf', function()
grid = [[
|
{1:~ }|*4
- {3:[No Name] }|
+ {2:[No Name] }|
boogalo 5 |
^line6 |
{1:~ }|*2
- {2:[No Name] [+] }|
+ {3:[No Name] [+] }|
|
]],
}
@@ -216,11 +211,6 @@ describe('api/buf', function()
local screen
before_each(function()
screen = Screen.new(20, 12)
- screen:set_default_attr_ids {
- [1] = { bold = true, foreground = Screen.colors.Blue1 },
- [2] = { reverse = true, bold = true },
- [3] = { reverse = true },
- }
screen:attach()
api.nvim_buf_set_lines(
0,
@@ -243,12 +233,12 @@ describe('api/buf', function()
grid = [[
|
{1:~ }|*4
- {3:[No Name] }|
+ {2:[No Name] }|
www |
xxx |
yyy |
^zzz |
- {2:[No Name] }|
+ {3:[No Name] }|
|
]],
}
@@ -258,12 +248,12 @@ describe('api/buf', function()
grid = [[
|
{1:~ }|*4
- {3:[No Name] }|
+ {2:[No Name] }|
www |
xxx |
yyy |
^zzz |
- {2:[No Name] [+] }|
+ {3:[No Name] [+] }|
|
]],
}
@@ -274,12 +264,12 @@ describe('api/buf', function()
grid = [[
|
{1:~ }|*4
- {3:[No Name] }|
+ {2:[No Name] }|
wwweeee |
xxx |
yyy |
^zzz |
- {2:[No Name] [+] }|
+ {3:[No Name] [+] }|
|
]],
}
@@ -290,12 +280,12 @@ describe('api/buf', function()
grid = [[
|
{1:~ }|*4
- {3:[No Name] }|
+ {2:[No Name] }|
wwweeee |
xxx |
yyy |
^zzz |
- {2:[No Name] [+] }|
+ {3:[No Name] [+] }|
|
]],
unchanged = true,
@@ -306,12 +296,12 @@ describe('api/buf', function()
grid = [[
|
{1:~ }|*4
- {3:[No Name] }|
+ {2:[No Name] }|
wwweeee |
xxx |
^yyy |
zzz |
- {2:[No Name] [+] }|
+ {3:[No Name] [+] }|
|
]],
}
@@ -321,12 +311,12 @@ describe('api/buf', function()
grid = [[
|
{1:~ }|*4
- {3:[No Name] }|
+ {2:[No Name] }|
mmmeeeee |
wwweeee |
xxx |
^yyy |
- {2:[No Name] [+] }|
+ {3:[No Name] [+] }|
|
]],
}
@@ -343,12 +333,12 @@ describe('api/buf', function()
grid = [[
^ |
{1:~ }|*4
- {2:[No Name] }|
+ {3:[No Name] }|
www |
xxx |
yyy |
zzz |
- {3:[No Name] }|
+ {2:[No Name] }|
|
]],
}
@@ -358,12 +348,12 @@ describe('api/buf', function()
grid = [[
^ |
{1:~ }|*4
- {2:[No Name] }|
+ {3:[No Name] }|
www |
xxx |
yyy |
zzz |
- {3:[No Name] [+] }|
+ {2:[No Name] [+] }|
|
]],
}
@@ -374,12 +364,12 @@ describe('api/buf', function()
grid = [[
^ |
{1:~ }|*4
- {2:[No Name] }|
+ {3:[No Name] }|
wwweeee |
xxx |
yyy |
zzz |
- {3:[No Name] [+] }|
+ {2:[No Name] [+] }|
|
]],
}
@@ -389,12 +379,12 @@ describe('api/buf', function()
grid = [[
^ |
{1:~ }|*4
- {2:[No Name] }|
+ {3:[No Name] }|
wwweeee |
xxx |
yyy |
zzz |
- {3:[No Name] [+] }|
+ {2:[No Name] [+] }|
|
]],
unchanged = true,
@@ -416,12 +406,12 @@ describe('api/buf', function()
ccc |
ddd |
www |
- {2:[No Name] }|
+ {3:[No Name] }|
www |
xxx |
yyy |
zzz |
- {3:[No Name] }|
+ {2:[No Name] }|
|
]],
}
@@ -434,12 +424,12 @@ describe('api/buf', function()
ddd |
www |
xxx |
- {2:[No Name] [+] }|
+ {3:[No Name] [+] }|
www |
xxx |
yyy |
zzz |
- {3:[No Name] [+] }|
+ {2:[No Name] [+] }|
|
]],
}
@@ -453,12 +443,12 @@ describe('api/buf', function()
ddd |
wwweeee |
xxx |
- {2:[No Name] [+] }|
+ {3:[No Name] [+] }|
wwweeee |
xxx |
yyy |
zzz |
- {3:[No Name] [+] }|
+ {2:[No Name] [+] }|
|
]],
}
@@ -471,12 +461,12 @@ describe('api/buf', function()
ddd |
mmm |
wwweeee |
- {2:[No Name] [+] }|
+ {3:[No Name] [+] }|
wwweeee |
xxx |
yyy |
zzz |
- {3:[No Name] [+] }|
+ {2:[No Name] [+] }|
|
]],
}
@@ -745,10 +735,6 @@ describe('api/buf', function()
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([[
@@ -771,7 +757,7 @@ describe('api/buf', function()
A real window |
with proper tex^t |
{1:~ }|
- {2:-- INSERT --} |
+ {5:-- INSERT --} |
]])
end)
@@ -1756,11 +1742,6 @@ describe('api/buf', function()
local screen
before_each(function()
screen = Screen.new(20, 12)
- screen:set_default_attr_ids {
- [1] = { bold = true, foreground = Screen.colors.Blue1 },
- [2] = { reverse = true, bold = true },
- [3] = { reverse = true },
- }
screen:attach()
api.nvim_buf_set_lines(
0,
@@ -1783,12 +1764,12 @@ describe('api/buf', function()
grid = [[
|
{1:~ }|*4
- {3:[No Name] }|
+ {2:[No Name] }|
www |
xxx |
yyy |
^zzz |
- {2:[No Name] }|
+ {3:[No Name] }|
|
]],
}
@@ -1798,12 +1779,12 @@ describe('api/buf', function()
grid = [[
|
{1:~ }|*4
- {3:[No Name] }|
+ {2:[No Name] }|
www |
xxx |
yyy |
^zzz |
- {2:[No Name] [+] }|
+ {3:[No Name] [+] }|
|
]],
}
@@ -1820,12 +1801,12 @@ describe('api/buf', function()
grid = [[
^ |
{1:~ }|*4
- {2:[No Name] }|
+ {3:[No Name] }|
www |
xxx |
yyy |
zzz |
- {3:[No Name] }|
+ {2:[No Name] }|
|
]],
}
@@ -1835,12 +1816,12 @@ describe('api/buf', function()
grid = [[
^ |
{1:~ }|*4
- {2:[No Name] }|
+ {3:[No Name] }|
www |
xxx |
yyy |
zzz |
- {3:[No Name] [+] }|
+ {2:[No Name] [+] }|
|
]],
}
@@ -1861,12 +1842,12 @@ describe('api/buf', function()
ccc |
ddd |
www |
- {2:[No Name] }|
+ {3:[No Name] }|
www |
xxx |
yyy |
zzz |
- {3:[No Name] }|
+ {2:[No Name] }|
|
]],
}
@@ -1879,12 +1860,12 @@ describe('api/buf', function()
ddd |
www |
xxx |
- {2:[No Name] [+] }|
+ {3:[No Name] [+] }|
www |
xxx |
yyy |
zzz |
- {3:[No Name] [+] }|
+ {2:[No Name] [+] }|
|
]],
}
@@ -1910,6 +1891,8 @@ describe('api/buf', function()
eq({ '' }, get_text(0, 0, 18, 0, 20, {}))
eq({ 'ext' }, get_text(0, -2, 1, -2, 4, {}))
eq({ 'hello foo!', 'text', 'm' }, get_text(0, 0, 0, 2, 1, {}))
+ eq({ 'hello foo!' }, get_text(0, 0, -987654321, 0, 987654321, {}))
+ eq({ '' }, get_text(0, 0, -15, 0, -20, {}))
end)
it('errors on out-of-range', function()
@@ -1923,7 +1906,7 @@ describe('api/buf', function()
it('errors when start is greater than end', function()
eq("'start' is higher than 'end'", pcall_err(get_text, 0, 1, 0, 0, 0, {}))
- eq('start_col must be less than end_col', pcall_err(get_text, 0, 0, 1, 0, 0, {}))
+ eq('start_col must be less than or equal to end_col', pcall_err(get_text, 0, 0, 1, 0, 0, {}))
end)
end)