@@ -17,17 +17,6 @@ local function expect(contents)
17
17
return eq(contents, helpers.curbuf_contents())
18
18
end
19
19
20
-
local function check_undo_redo(ns, mark, sr, sc, er, ec) --s = start, e = end
21
-
local rv = curbufmeths.get_extmark_by_id(ns, mark, false)
22
-
eq({er, ec}, rv)
23
-
feed("u")
24
-
rv = curbufmeths.get_extmark_by_id(ns, mark, false)
25
-
eq({sr, sc}, rv)
26
-
feed("<c-r>")
27
-
rv = curbufmeths.get_extmark_by_id(ns, mark, false)
28
-
eq({er, ec}, rv)
29
-
end
30
-
31
20
local function set_extmark(ns_id, id, line, col, opts)
32
21
if opts == nil then
33
22
opts = {}
@@ -42,7 +31,25 @@ local function get_extmarks(ns_id, start, end_, opts)
42
31
if opts == nil then
43
32
opts = {}
44
33
end
45
-
return curbufmeths.get_extmarks(ns_id, start, end_, opts, false)
34
+
return curbufmeths.get_extmarks(ns_id, start, end_, opts)
35
+
end
36
+
37
+
local function get_extmark_by_id(ns_id, id, opts)
38
+
if opts == nil then
39
+
opts = {}
40
+
end
41
+
return curbufmeths.get_extmark_by_id(ns_id, id, opts)
42
+
end
43
+
44
+
local function check_undo_redo(ns, mark, sr, sc, er, ec) --s = start, e = end
45
+
local rv = get_extmark_by_id(ns, mark)
46
+
eq({er, ec}, rv)
47
+
feed("u")
48
+
rv = get_extmark_by_id(ns, mark)
49
+
eq({sr, sc}, rv)
50
+
feed("<c-r>")
51
+
rv = get_extmark_by_id(ns, mark)
52
+
eq({er, ec}, rv)
46
53
end
47
54
48
55
local function batch_set(ns_id, positions)
@@ -96,7 +103,7 @@ describe('API/extmarks', function()
96
103
it('adds, updates and deletes marks', function()
97
104
local rv = set_extmark(ns, marks[1], positions[1][1], positions[1][2])
98
105
eq(marks[1], rv)
99
-
rv = curbufmeths.get_extmark_by_id(ns, marks[1], false)
106
+
rv = get_extmark_by_id(ns, marks[1])
100
107
eq({positions[1][1], positions[1][2]}, rv)
101
108
-- Test adding a second mark on same row works
102
109
rv = set_extmark(ns, marks[2], positions[2][1], positions[2][2])
@@ -105,14 +112,14 @@ describe('API/extmarks', function()
105
112
-- Test an update, (same pos)
106
113
rv = set_extmark(ns, marks[1], positions[1][1], positions[1][2])
107
114
eq(marks[1], rv)
108
-
rv = curbufmeths.get_extmark_by_id(ns, marks[2], false)
115
+
rv = get_extmark_by_id(ns, marks[2])
109
116
eq({positions[2][1], positions[2][2]}, rv)
110
117
-- Test an update, (new pos)
111
118
row = positions[1][1]
112
119
col = positions[1][2] + 1
113
120
rv = set_extmark(ns, marks[1], row, col)
114
121
eq(marks[1], rv)
115
-
rv = curbufmeths.get_extmark_by_id(ns, marks[1], false)
122
+
rv = get_extmark_by_id(ns, marks[1])
116
123
eq({row, col}, rv)
117
124
118
125
-- remove the test marks
@@ -435,7 +442,7 @@ describe('API/extmarks', function()
435
442
~ |
436
443
|
437
444
]])
438
-
local rv = curbufmeths.get_extmark_by_id(ns, marks[1], false)
445
+
local rv = get_extmark_by_id(ns, marks[1])
439
446
eq({0, 6}, rv)
440
447
check_undo_redo(ns, marks[1], 0, 3, 0, 6)
441
448
end)
@@ -909,9 +916,9 @@ describe('API/extmarks', function()
909
916
-- Set the mark before the cursor, should stay there
910
917
set_extmark(ns, marks[2], 0, 10)
911
918
feed("i<cr><esc>")
912
-
local rv = curbufmeths.get_extmark_by_id(ns, marks[1], false)
919
+
local rv = get_extmark_by_id(ns, marks[1])
913
920
eq({1, 3}, rv)
914
-
rv = curbufmeths.get_extmark_by_id(ns, marks[2], false)
921
+
rv = get_extmark_by_id(ns, marks[2])
915
922
eq({0, 10}, rv)
916
923
check_undo_redo(ns, marks[1], 0, 12, 1, 3)
917
924
end)
@@ -924,12 +931,12 @@ describe('API/extmarks', function()
924
931
feed("0iint <esc>A {<cr><esc>0i1M1<esc>")
925
932
set_extmark(ns, marks[1], 1, 1)
926
933
feed("0i<c-f><esc>")
927
-
local rv = curbufmeths.get_extmark_by_id(ns, marks[1], false)
934
+
local rv = get_extmark_by_id(ns, marks[1])
928
935
eq({1, 3}, rv)
929
936
check_undo_redo(ns, marks[1], 1, 1, 1, 3)
930
937
-- now check when cursor at eol
931
938
feed("uA<c-f><esc>")
932
-
rv = curbufmeths.get_extmark_by_id(ns, marks[1], false)
939
+
rv = get_extmark_by_id(ns, marks[1])
933
940
eq({1, 3}, rv)
934
941
end)
935
942
@@ -940,12 +947,12 @@ describe('API/extmarks', function()
940
947
feed("0i<tab><esc>")
941
948
set_extmark(ns, marks[1], 0, 3)
942
949
feed("bi<c-d><esc>")
943
-
local rv = curbufmeths.get_extmark_by_id(ns, marks[1], false)
950
+
local rv = get_extmark_by_id(ns, marks[1])
944
951
eq({0, 1}, rv)
945
952
check_undo_redo(ns, marks[1], 0, 3, 0, 1)
946
953
-- check when cursor at eol
947
954
feed("uA<c-d><esc>")
948
-
rv = curbufmeths.get_extmark_by_id(ns, marks[1], false)
955
+
rv = get_extmark_by_id(ns, marks[1])
949
956
eq({0, 1}, rv)
950
957
end)
951
958
@@ -1075,7 +1082,7 @@ describe('API/extmarks', function()
1075
1082
check_undo_redo(ns, marks[5], 2, 0, 3, 0)
1076
1083
feed('u')
1077
1084
feed([[:1,2s:3:\rxx<cr>]])
1078
-
eq({1, 3}, curbufmeths.get_extmark_by_id(ns, marks[3], false))
1085
+
eq({1, 3}, get_extmark_by_id(ns, marks[3]))
1079
1086
end)
1080
1087
1081
1088
it('substitions over multiple lines with replace in substition', function()
@@ -1314,16 +1321,16 @@ describe('API/extmarks', function()
1314
1321
eq("Invalid ns_id", pcall_err(set_extmark, ns_invalid, marks[1], positions[1][1], positions[1][2]))
1315
1322
eq("Invalid ns_id", pcall_err(curbufmeths.del_extmark, ns_invalid, marks[1]))
1316
1323
eq("Invalid ns_id", pcall_err(get_extmarks, ns_invalid, positions[1], positions[2]))
1317
-
eq("Invalid ns_id", pcall_err(curbufmeths.get_extmark_by_id, ns_invalid, marks[1], false))
1324
+
eq("Invalid ns_id", pcall_err(get_extmark_by_id, ns_invalid, marks[1]))
1318
1325
end)
1319
1326
1320
1327
it('when col = line-length, set the mark on eol', function()
1321
1328
set_extmark(ns, marks[1], 0, -1)
1322
-
local rv = curbufmeths.get_extmark_by_id(ns, marks[1], false)
1329
+
local rv = get_extmark_by_id(ns, marks[1])
1323
1330
eq({0, init_text:len()}, rv)
1324
1331
-- Test another
1325
1332
set_extmark(ns, marks[1], 0, -1)
1326
-
rv = curbufmeths.get_extmark_by_id(ns, marks[1], false)
1333
+
rv = get_extmark_by_id(ns, marks[1])
1327
1334
eq({0, init_text:len()}, rv)
1328
1335
end)
1329
1336
@@ -1336,7 +1343,7 @@ describe('API/extmarks', function()
1336
1343
local invalid_col = init_text:len() + 1
1337
1344
local invalid_lnum = 3
1338
1345
eq('line value outside range', pcall_err(set_extmark, ns, marks[1], invalid_lnum, invalid_col))
1339
-
eq({}, curbufmeths.get_extmark_by_id(ns, marks[1], false))
1346
+
eq({}, get_extmark_by_id(ns, marks[1]))
1340
1347
end)
1341
1348
1342
1349
it('bug from check_col in extmark_set', function()
@@ -1361,7 +1368,7 @@ describe('API/extmarks', function()
1361
1368
local buf = request('nvim_create_buf', 0, 1)
1362
1369
request('nvim_buf_set_lines', buf, 0, -1, 1, {"", ""})
1363
1370
local id = bufmeths.set_extmark(buf, ns, 1, 0, {})
1364
-
eq({{id, 1, 0}}, bufmeths.get_extmarks(buf, ns, 0, -1, {}, false))
1371
+
eq({{id, 1, 0}}, bufmeths.get_extmarks(buf, ns, 0, -1, {}))
1365
1372
end)
1366
1373
1367
1374
it('does not crash with append/delete/undo seqence', function()
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4