2016-04-23 16:53:11 -07:00
|
|
|
local helpers = require('test.functional.helpers')(after_each)
|
2015-12-17 20:12:02 -07:00
|
|
|
local feed, insert, source = helpers.feed, helpers.insert, helpers.source
|
2017-04-08 14:12:26 -07:00
|
|
|
local clear, feed_command, expect = helpers.clear, helpers.feed_command, helpers.expect
|
2015-12-17 20:12:02 -07:00
|
|
|
|
|
|
|
describe('marks', function()
|
|
|
|
before_each(function()
|
|
|
|
clear()
|
|
|
|
end)
|
|
|
|
|
2017-09-24 11:42:48 -07:00
|
|
|
-- luacheck: ignore 621 (Indentation)
|
2015-12-17 20:12:02 -07:00
|
|
|
it('restores a deleted mark after delete-undo-redo-undo', function()
|
|
|
|
insert([[
|
2017-04-08 14:12:26 -07:00
|
|
|
|
2015-12-17 20:12:02 -07:00
|
|
|
textline A
|
|
|
|
textline B
|
|
|
|
textline C
|
2017-04-08 14:12:26 -07:00
|
|
|
|
2015-12-17 20:12:02 -07:00
|
|
|
Results:]])
|
|
|
|
|
2017-04-08 14:12:26 -07:00
|
|
|
feed_command([[:/^\t/+1]])
|
2015-12-17 20:12:02 -07:00
|
|
|
feed([[maddu<C-R>u]])
|
|
|
|
source([[
|
|
|
|
let g:a = string(getpos("'a"))
|
|
|
|
$put ='Mark after delete-undo-redo-undo: '.g:a
|
|
|
|
]])
|
|
|
|
|
|
|
|
expect([=[
|
2017-04-08 14:12:26 -07:00
|
|
|
|
2015-12-17 20:12:02 -07:00
|
|
|
textline A
|
|
|
|
textline B
|
|
|
|
textline C
|
2017-04-08 14:12:26 -07:00
|
|
|
|
2015-12-17 20:12:02 -07:00
|
|
|
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)
|