2015-02-28 04:33:17 -07:00
|
|
|
|
-- Tests for "r<Tab>" with 'smarttab' and 'expandtab' set/not set.
|
|
|
|
|
-- Also test that dv_ works correctly
|
|
|
|
|
|
2016-04-23 16:53:11 -07:00
|
|
|
|
local helpers = require('test.functional.helpers')(after_each)
|
2015-02-28 04:33:17 -07:00
|
|
|
|
local feed, insert = helpers.feed, helpers.insert
|
2017-04-08 14:12:26 -07:00
|
|
|
|
local clear, feed_command, expect = helpers.clear, helpers.feed_command, helpers.expect
|
2015-02-28 04:33:17 -07:00
|
|
|
|
|
|
|
|
|
describe([[performing "r<Tab>" with 'smarttab' and 'expandtab' set/not set, and "dv_"]], function()
|
|
|
|
|
setup(clear)
|
|
|
|
|
|
2017-09-24 11:42:48 -07:00
|
|
|
|
-- luacheck: ignore 621 (Indentation)
|
2015-02-28 04:33:17 -07:00
|
|
|
|
it('is working', function()
|
|
|
|
|
insert([[
|
|
|
|
|
start text
|
|
|
|
|
some test text
|
|
|
|
|
test text
|
|
|
|
|
other test text
|
|
|
|
|
a cde
|
|
|
|
|
f ghi
|
|
|
|
|
test text
|
|
|
|
|
Second line beginning with whitespace]])
|
|
|
|
|
|
2017-04-08 14:12:26 -07:00
|
|
|
|
feed_command('set smarttab expandtab ts=8 sw=4')
|
2015-02-28 04:33:17 -07:00
|
|
|
|
-- Make sure that backspace works, no matter what termcap is used.
|
2017-04-08 14:12:26 -07:00
|
|
|
|
feed_command('set t_kD=x7f t_kb=x08')
|
2015-02-28 04:33:17 -07:00
|
|
|
|
|
2017-04-08 14:12:26 -07:00
|
|
|
|
feed_command('/some')
|
2015-02-28 04:33:17 -07:00
|
|
|
|
feed('r ')
|
2017-04-08 14:12:26 -07:00
|
|
|
|
feed_command('set noexpandtab')
|
|
|
|
|
feed_command('/other')
|
2015-02-28 04:33:17 -07:00
|
|
|
|
feed('r <cr>')
|
|
|
|
|
-- Test replacing with Tabs and then backspacing to undo it.
|
|
|
|
|
feed('0wR <bs><bs><bs><esc><cr>')
|
|
|
|
|
-- Test replacing with Tabs.
|
|
|
|
|
feed('0wR <esc><cr>')
|
|
|
|
|
-- Test that copyindent works with expandtab set.
|
2017-04-08 14:12:26 -07:00
|
|
|
|
feed_command('set expandtab smartindent copyindent ts=8 sw=8 sts=8')
|
2015-02-28 04:33:17 -07:00
|
|
|
|
feed('o{<cr>x<esc>')
|
2017-04-08 14:12:26 -07:00
|
|
|
|
feed_command('set nosol')
|
|
|
|
|
feed_command('/Second line/')
|
2015-02-28 04:33:17 -07:00
|
|
|
|
-- Test "dv_"
|
|
|
|
|
feed('fwdv_')
|
|
|
|
|
|
|
|
|
|
-- Assert buffer contents.
|
|
|
|
|
expect([[
|
|
|
|
|
start text
|
|
|
|
|
ome test text
|
|
|
|
|
test text
|
|
|
|
|
ther test text
|
|
|
|
|
a cde
|
|
|
|
|
hi
|
|
|
|
|
test text
|
|
|
|
|
{
|
|
|
|
|
x
|
|
|
|
|
with whitespace]])
|
|
|
|
|
end)
|
|
|
|
|
end)
|