aboutsummaryrefslogtreecommitdiff
path: root/test/functional/legacy/marks_spec.lua
blob: 470ea49652cc16df528d0ee97229dc015820cf70 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
local helpers = require('test.functional.helpers')(after_each)
local feed, insert, source = helpers.feed, helpers.insert, helpers.source
local clear, feed_command, expect = helpers.clear, helpers.feed_command, helpers.expect

describe('marks', function()
  before_each(function()
    clear()
  end)

  -- luacheck: ignore 621 (Indentation)
  it('restores a deleted mark after delete-undo-redo-undo', function()
    insert([[

      	textline A
      	textline B
      	textline C

      Results:]])

    feed_command([[:/^\t/+1]])
    feed([[maddu<C-R>u]])
    source([[
      let g:a = string(getpos("'a"))
      $put ='Mark after delete-undo-redo-undo: '.g:a
    ]])

    expect([=[

      	textline A
      	textline B
      	textline C

      Results:
      Mark after delete-undo-redo-undo: [0, 3, 2, 0]]=])
  end)

  it("CTRL-A and CTRL-X updates last changed mark '[, ']", function()
    insert([[
      CTRL-A CTRL-X:
      123 123 123
      123 123 123
      123 123 123]])

    source([[
      /^123/
      execute "normal! \<C-A>`[v`]rAjwvjw\<C-X>`[v`]rX"]])

    expect([=[
      CTRL-A CTRL-X:
      AAA 123 123
      123 XXXXXXX
      XXX 123 123]=])
  end)
end)