2024-04-20 08:44:13 -07:00
|
|
|
local t = require('test.testutil')
|
|
|
|
local n = require('test.functional.testnvim')()
|
2017-01-03 14:10:38 -07:00
|
|
|
|
2024-04-08 02:03:20 -07:00
|
|
|
local eq = t.eq
|
2024-04-20 08:44:13 -07:00
|
|
|
local clear = n.clear
|
|
|
|
local insert = n.insert
|
|
|
|
local feed = n.feed
|
|
|
|
local expect = n.expect
|
|
|
|
local feed_command = n.feed_command
|
|
|
|
local exc_exec = n.exc_exec
|
2017-01-03 14:10:38 -07:00
|
|
|
|
|
|
|
describe(':undojoin command', function()
|
|
|
|
before_each(function()
|
|
|
|
clear()
|
|
|
|
insert([[
|
|
|
|
Line of text 1
|
|
|
|
Line of text 2]])
|
2017-04-08 14:12:26 -07:00
|
|
|
feed_command('goto 1')
|
2017-01-03 14:10:38 -07:00
|
|
|
end)
|
|
|
|
it('joins changes in a buffer', function()
|
2017-04-08 14:12:26 -07:00
|
|
|
feed_command('undojoin | delete')
|
2017-01-03 14:10:38 -07:00
|
|
|
expect([[
|
|
|
|
Line of text 2]])
|
|
|
|
feed('u')
|
|
|
|
expect([[
|
|
|
|
]])
|
|
|
|
end)
|
|
|
|
it('does not corrupt undolist when connected with redo', function()
|
|
|
|
feed('ixx<esc>')
|
2017-04-08 14:12:26 -07:00
|
|
|
feed_command('undojoin | redo')
|
2017-01-03 14:10:38 -07:00
|
|
|
expect([[
|
|
|
|
xxLine of text 1
|
|
|
|
Line of text 2]])
|
|
|
|
end)
|
|
|
|
it('does not raise an error when called twice', function()
|
|
|
|
local ret = exc_exec('undojoin | undojoin')
|
|
|
|
eq(0, ret)
|
|
|
|
end)
|
|
|
|
end)
|