aboutsummaryrefslogtreecommitdiff
path: root/test/functional/api/extmark_spec.lua
diff options
context:
space:
mode:
Diffstat (limited to 'test/functional/api/extmark_spec.lua')
-rw-r--r--test/functional/api/extmark_spec.lua82
1 files changed, 51 insertions, 31 deletions
diff --git a/test/functional/api/extmark_spec.lua b/test/functional/api/extmark_spec.lua
index 2acfbfc949..7b2fe209ba 100644
--- a/test/functional/api/extmark_spec.lua
+++ b/test/functional/api/extmark_spec.lua
@@ -1,20 +1,21 @@
-local helpers = require('test.functional.helpers')(after_each)
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')
-local request = helpers.request
-local eq = helpers.eq
-local ok = helpers.ok
-local pcall_err = helpers.pcall_err
-local insert = helpers.insert
-local feed = helpers.feed
-local clear = helpers.clear
-local command = helpers.command
-local exec = helpers.exec
-local api = helpers.api
-local assert_alive = helpers.assert_alive
+local request = n.request
+local eq = t.eq
+local ok = t.ok
+local pcall_err = t.pcall_err
+local insert = n.insert
+local feed = n.feed
+local clear = n.clear
+local command = n.command
+local exec = n.exec
+local api = n.api
+local assert_alive = n.assert_alive
local function expect(contents)
- return eq(contents, helpers.curbuf_contents())
+ return eq(contents, n.curbuf_contents())
end
local function set_extmark(ns_id, id, line, col, opts)
@@ -460,7 +461,7 @@ describe('API/extmarks', function()
-- This shouldn't seg fault
screen:expect([[
12345^ 1 |
- ~ |*8
+ {1:~ }|*8
|
]])
end)
@@ -513,7 +514,7 @@ describe('API/extmarks', function()
insert('abc')
screen:expect([[
ab^c12345 |
- ~ |*8
+ {1:~ }|*8
|
]])
local rv = get_extmark_by_id(ns, marks[1])
@@ -1568,7 +1569,7 @@ describe('API/extmarks', function()
sign_text = '>>',
spell = true,
virt_lines = {
- { { 'lines', 'Macro' }, { '???' } },
+ { { 'lines', 'Macro' }, { '???' }, { ';;;', '' } },
{ { 'stack', { 'Type', 'Search' } }, { '!!!' } },
},
virt_lines_above = true,
@@ -1603,7 +1604,7 @@ describe('API/extmarks', function()
sign_text = '>>',
spell = true,
virt_lines = {
- { { 'lines', 'Macro' }, { '???' } },
+ { { 'lines', 'Macro' }, { '???' }, { ';;;', '' } },
{ { 'stack', { 'Type', 'Search' } }, { '!!!' } },
},
virt_lines_above = true,
@@ -1734,16 +1735,17 @@ describe('API/extmarks', function()
command('d2')
screen:expect([[
S2^aaa bbb ccc |
- aaa bbb ccc |*3
- |*2
+ {7: }aaa bbb ccc |*3
+ {7: } |
+ |
]])
-- mark is restored with undo_restore == true
command('silent undo')
screen:expect([[
- S1 ^aaa bbb ccc |
- S1S2aaa bbb ccc |
- S2 aaa bbb ccc |
- aaa bbb ccc |*2
+ S1{7: }^aaa bbb ccc |
+ S2S1aaa bbb ccc |
+ S2{7: }aaa bbb ccc |
+ {7: }aaa bbb ccc |*2
|
]])
-- decor is not removed twice
@@ -1894,6 +1896,24 @@ describe('Extmarks buffer api with many marks', function()
end
eq(ns_marks[ns1], get_marks(ns1))
eq(ns_marks[ns2], get_marks(ns2))
+
+ api.nvim_buf_clear_namespace(0, ns1, 0, 10)
+ for id, mark in pairs(ns_marks[ns1]) do
+ if mark[1] < 10 then
+ ns_marks[ns1][id] = nil
+ end
+ end
+ eq(ns_marks[ns1], get_marks(ns1))
+ eq(ns_marks[ns2], get_marks(ns2))
+
+ api.nvim_buf_clear_namespace(0, ns1, 20, -1)
+ for id, mark in pairs(ns_marks[ns1]) do
+ if mark[1] >= 20 then
+ ns_marks[ns1][id] = nil
+ end
+ end
+ eq(ns_marks[ns1], get_marks(ns1))
+ eq(ns_marks[ns2], get_marks(ns2))
end)
it('can delete line', function()
@@ -1964,7 +1984,7 @@ describe('API/win_extmark', function()
grid = [[
non ui-watched line |
ui-watched lin^e |
- ~ |
+ {1:~ }|
|
]],
extmarks = {
@@ -2052,7 +2072,7 @@ describe('API/win_extmark', function()
grid = [[
ui-watched linupdat^e|
e |
- ~ |
+ {1:~ }|
|
]],
extmarks = {
@@ -2079,9 +2099,9 @@ describe('API/win_extmark', function()
grid = [[
## grid 1
[4:--------------------]|*3
- [No Name] [+] |
+ {3:[No Name] [+] }|
[2:--------------------]|*2
- [No Name] [+] |
+ {2:[No Name] [+] }|
[3:--------------------]|
## grid 2
non ui-watched line |
@@ -2091,7 +2111,7 @@ describe('API/win_extmark', function()
## grid 4
non ui-watched line |
ui-watched lin^e |
- ~ |
+ {1:~ }|
]],
extmarks = {
[2] = {
@@ -2112,13 +2132,13 @@ describe('API/win_extmark', function()
grid = [[
## grid 1
[4:--------------------]|*3
- [No Name] [+] |
+ {3:[No Name] [+] }|
[2:--------------------]|*2
- [No Name] [+] |
+ {2:[No Name] [+] }|
[3:--------------------]|
## grid 2
non ui-watched line |
- ui-watched linupd@@@|
+ ui-watched linupd{1:@@@}|
## grid 3
|
## grid 4