robin/laufey

git clone https://git.robinwobin.dev/robin/laufey

Justin M. KeyesMerge #40865 from justinmk/fixcif907614088

master
1.2 KiB57 linesraw
1local n = require('test.functional.testnvim')()
2local t = require('test.testutil')
3
4local describe, it, before_each = t.describe, t.it, t.before_each
5local feed, insert, source = n.feed, n.insert, n.source
6local clear, feed_command, expect = n.clear, n.feed_command, n.expect
7
8describe('marks', function()
9  before_each(function()
10    clear()
11  end)
12
13  -- luacheck: ignore 621 (Indentation)
14  it('restores a deleted mark after delete-undo-redo-undo', function()
15    insert([[
16
17      	textline A
18      	textline B
19      	textline C
20
21      Results:]])
22
23    feed_command([[:/^\t/+1]])
24    feed([[maddu<C-R>u]])
25    source([[
26      let g:a = string(getpos("'a"))
27      $put ='Mark after delete-undo-redo-undo: '.g:a
28    ]])
29
30    expect([=[
31
32      	textline A
33      	textline B
34      	textline C
35
36      Results:
37      Mark after delete-undo-redo-undo: [0, 3, 2, 0]]=])
38  end)
39
40  it("CTRL-A and CTRL-X updates last changed mark '[, ']", function()
41    insert([[
42      CTRL-A CTRL-X:
43      123 123 123
44      123 123 123
45      123 123 123]])
46
47    source([[
48      /^123/
49      execute "normal! \<C-A>`[v`]rAjwvjw\<C-X>`[v`]rX"]])
50
51    expect([=[
52      CTRL-A CTRL-X:
53      AAA 123 123
54      123 XXXXXXX
55      XXX 123 123]=])
56  end)
57end)