aboutsummaryrefslogtreecommitdiff
path: root/test/functional/legacy
diff options
context:
space:
mode:
authorJosh Rahm <joshuarahm@gmail.com>2023-11-29 21:52:58 +0000
committerJosh Rahm <joshuarahm@gmail.com>2023-11-29 21:52:58 +0000
commit931bffbda3668ddc609fc1da8f9eb576b170aa52 (patch)
treed8c1843a95da5ea0bb4acc09f7e37843d9995c86 /test/functional/legacy
parent142d9041391780ac15b89886a54015fdc5c73995 (diff)
parent4a8bf24ac690004aedf5540fa440e788459e5e34 (diff)
downloadrneovim-userreg.tar.gz
rneovim-userreg.tar.bz2
rneovim-userreg.zip
Merge remote-tracking branch 'upstream/master' into userreguserreg
Diffstat (limited to 'test/functional/legacy')
-rw-r--r--test/functional/legacy/011_autocommands_spec.lua6
-rw-r--r--test/functional/legacy/012_directory_spec.lua28
-rw-r--r--test/functional/legacy/061_undo_tree_spec.lua17
-rw-r--r--test/functional/legacy/074_global_var_in_viminfo_spec.lua4
-rw-r--r--test/functional/legacy/088_conceal_tabs_spec.lua97
-rw-r--r--test/functional/legacy/assert_spec.lua8
-rw-r--r--test/functional/legacy/autochdir_spec.lua4
-rw-r--r--test/functional/legacy/autocmd_option_spec.lua148
-rw-r--r--test/functional/legacy/breakindent_spec.lua36
-rw-r--r--test/functional/legacy/buffer_spec.lua2
-rw-r--r--test/functional/legacy/cmdline_spec.lua25
-rw-r--r--test/functional/legacy/conceal_spec.lua587
-rw-r--r--test/functional/legacy/crash_spec.lua16
-rw-r--r--test/functional/legacy/debugger_spec.lua85
-rw-r--r--test/functional/legacy/delete_spec.lua2
-rw-r--r--test/functional/legacy/digraph_spec.lua6
-rw-r--r--test/functional/legacy/display_spec.lua190
-rw-r--r--test/functional/legacy/edit_spec.lua66
-rw-r--r--test/functional/legacy/eval_spec.lua10
-rw-r--r--test/functional/legacy/filechanged_spec.lua4
-rw-r--r--test/functional/legacy/glob2regpat_spec.lua8
-rw-r--r--test/functional/legacy/highlight_spec.lua (renamed from test/functional/legacy/051_highlight_spec.lua)34
-rw-r--r--test/functional/legacy/matchparen_spec.lua116
-rw-r--r--test/functional/legacy/memory_usage_spec.lua8
-rw-r--r--test/functional/legacy/messages_spec.lua119
-rw-r--r--test/functional/legacy/move_spec.lua49
-rw-r--r--test/functional/legacy/normal_spec.lua41
-rw-r--r--test/functional/legacy/options_spec.lua2
-rw-r--r--test/functional/legacy/prompt_buffer_spec.lua133
-rw-r--r--test/functional/legacy/put_spec.lua53
-rw-r--r--test/functional/legacy/scroll_opt_spec.lua1193
-rw-r--r--test/functional/legacy/search_spec.lua44
-rw-r--r--test/functional/legacy/search_stat_spec.lua64
-rw-r--r--test/functional/legacy/vimscript_spec.lua2
-rw-r--r--test/functional/legacy/visual_mode_spec.lua79
-rw-r--r--test/functional/legacy/visual_spec.lua69
-rw-r--r--test/functional/legacy/window_cmd_spec.lua110
37 files changed, 3035 insertions, 430 deletions
diff --git a/test/functional/legacy/011_autocommands_spec.lua b/test/functional/legacy/011_autocommands_spec.lua
index 7ae851467f..5b6d030567 100644
--- a/test/functional/legacy/011_autocommands_spec.lua
+++ b/test/functional/legacy/011_autocommands_spec.lua
@@ -13,7 +13,7 @@
-- being modified outside of Vim (noticed on Solaris).
local helpers= require('test.functional.helpers')(after_each)
-local lfs = require('lfs')
+local luv = require('luv')
local clear, feed_command, expect, eq, neq, dedent, write_file, feed =
helpers.clear, helpers.feed_command, helpers.expect, helpers.eq, helpers.neq,
helpers.dedent, helpers.write_file, helpers.feed
@@ -31,8 +31,8 @@ local function prepare_gz_file(name, text)
-- Compress the file with gzip.
command([[call system(['gzip', '--force', ']]..name..[['])]])
-- This should create the .gz file and delete the original.
- neq(nil, lfs.attributes(name..'.gz'))
- eq(nil, lfs.attributes(name))
+ neq(nil, luv.fs_stat(name..'.gz'))
+ eq(nil, luv.fs_stat(name))
end
describe('file reading, writing and bufnew and filter autocommands', function()
diff --git a/test/functional/legacy/012_directory_spec.lua b/test/functional/legacy/012_directory_spec.lua
index dd207ca0b4..25d0dcb81e 100644
--- a/test/functional/legacy/012_directory_spec.lua
+++ b/test/functional/legacy/012_directory_spec.lua
@@ -4,7 +4,7 @@
-- - "dir", in directory relative to current dir
local helpers = require('test.functional.helpers')(after_each)
-local lfs = require('lfs')
+local luv = require('luv')
local eq = helpers.eq
local neq = helpers.neq
@@ -15,12 +15,12 @@ local clear = helpers.clear
local insert = helpers.insert
local command = helpers.command
local write_file = helpers.write_file
-local curbufmeths = helpers.curbufmeths
local expect_exit = helpers.expect_exit
+local mkdir = helpers.mkdir
local function ls_dir_sorted(dirname)
local files = {}
- for f in lfs.dir(dirname) do
+ for f in vim.fs.dir(dirname) do
if f ~= "." and f~= ".." then
table.insert(files, f)
end
@@ -38,8 +38,8 @@ describe("'directory' option", function()
end of testfile
]]
write_file('Xtest1', text)
- lfs.mkdir('Xtest.je')
- lfs.mkdir('Xtest2')
+ mkdir('Xtest.je')
+ mkdir('Xtest2')
write_file('Xtest2/Xtest3', text)
clear()
end)
@@ -57,33 +57,33 @@ describe("'directory' option", function()
line 3 Abcdefghij
end of testfile]])
- meths.set_option('swapfile', true)
- curbufmeths.set_option('swapfile', true)
- meths.set_option('directory', '.')
+ meths.set_option_value('swapfile', true, {})
+ meths.set_option_value('swapfile', true, {})
+ meths.set_option_value('directory', '.', {})
-- sanity check: files should not exist yet.
- eq(nil, lfs.attributes('.Xtest1.swp'))
+ eq(nil, luv.fs_stat('.Xtest1.swp'))
command('edit! Xtest1')
poke_eventloop()
eq('Xtest1', funcs.buffer_name('%'))
-- Verify that the swapfile exists. In the legacy test this was done by
-- reading the output from :!ls.
- neq(nil, lfs.attributes('.Xtest1.swp'))
+ neq(nil, luv.fs_stat('.Xtest1.swp'))
- meths.set_option('directory', './Xtest2,.')
+ meths.set_option_value('directory', './Xtest2,.', {})
command('edit Xtest1')
poke_eventloop()
-- swapfile should no longer exist in CWD.
- eq(nil, lfs.attributes('.Xtest1.swp'))
+ eq(nil, luv.fs_stat('.Xtest1.swp'))
eq({ "Xtest1.swp", "Xtest3" }, ls_dir_sorted("Xtest2"))
- meths.set_option('directory', 'Xtest.je')
+ meths.set_option_value('directory', 'Xtest.je', {})
command('bdelete')
command('edit Xtest2/Xtest3')
- eq(true, curbufmeths.get_option('swapfile'))
+ eq(true, meths.get_option_value('swapfile', {}))
poke_eventloop()
eq({ "Xtest3" }, ls_dir_sorted("Xtest2"))
diff --git a/test/functional/legacy/061_undo_tree_spec.lua b/test/functional/legacy/061_undo_tree_spec.lua
index 1a8ef067d0..b5af8f7d52 100644
--- a/test/functional/legacy/061_undo_tree_spec.lua
+++ b/test/functional/legacy/061_undo_tree_spec.lua
@@ -22,29 +22,30 @@ end
describe('undo tree:', function()
before_each(clear)
+ local fname = 'Xtest_functional_legacy_undotree'
teardown(function()
- os.remove('Xtest.source')
+ os.remove(fname .. '.source')
end)
describe(':earlier and :later', function()
before_each(function()
- os.remove('Xtest')
+ os.remove(fname)
end)
teardown(function()
- os.remove('Xtest')
+ os.remove(fname)
end)
it('time specifications, g- g+', function()
-- We write the test text to a file in order to prevent nvim to record
-- the inserting of the text into the undo history.
- write_file('Xtest', '\n123456789\n')
+ write_file(fname, '\n123456789\n')
-- `:earlier` and `:later` are (obviously) time-sensitive, so this test
-- sometimes fails if the system is under load. It is wrapped in a local
-- function to allow multiple attempts.
local function test_earlier_later()
clear()
- feed_command('e Xtest')
+ feed_command('e ' .. fname)
-- Assert that no undo history is present.
eq({}, eval('undotree().entries'))
-- Delete three characters and undo.
@@ -103,7 +104,7 @@ describe('undo tree:', function()
it('file-write specifications', function()
feed('ione one one<esc>')
- feed_command('w Xtest')
+ feed_command('w ' .. fname)
feed('otwo<esc>')
feed('otwo<esc>')
feed_command('w')
@@ -187,7 +188,7 @@ describe('undo tree:', function()
it('undo an expression-register', function()
local normal_commands = 'o1\027a2\018=string(123)\n\027'
- write_file('Xtest.source', normal_commands)
+ write_file(fname .. '.source', normal_commands)
feed('oa<esc>')
feed('ob<esc>')
@@ -221,7 +222,7 @@ describe('undo tree:', function()
c
12]])
feed('od<esc>')
- feed_command('so! Xtest.source')
+ feed_command('so! ' .. fname .. '.source')
expect([[
a
diff --git a/test/functional/legacy/074_global_var_in_viminfo_spec.lua b/test/functional/legacy/074_global_var_in_viminfo_spec.lua
index 445d742c1f..06d8b276d7 100644
--- a/test/functional/legacy/074_global_var_in_viminfo_spec.lua
+++ b/test/functional/legacy/074_global_var_in_viminfo_spec.lua
@@ -1,7 +1,7 @@
-- Tests for storing global variables in the .shada file
local helpers = require('test.functional.helpers')(after_each)
-local lfs = require('lfs')
+local luv = require('luv')
local clear, command, eq, neq, eval, poke_eventloop =
helpers.clear, helpers.command, helpers.eq, helpers.neq, helpers.eval,
helpers.poke_eventloop
@@ -39,7 +39,7 @@ describe('storing global variables in ShaDa files', function()
poke_eventloop()
-- Assert that the shada file exists.
- neq(nil, lfs.attributes(tempname))
+ neq(nil, luv.fs_stat(tempname))
command('unlet MY_GLOBAL_DICT')
command('unlet MY_GLOBAL_LIST')
-- Assert that the variables where deleted.
diff --git a/test/functional/legacy/088_conceal_tabs_spec.lua b/test/functional/legacy/088_conceal_tabs_spec.lua
deleted file mode 100644
index a4c7e26583..0000000000
--- a/test/functional/legacy/088_conceal_tabs_spec.lua
+++ /dev/null
@@ -1,97 +0,0 @@
--- Tests for correct display (cursor column position) with +conceal and
--- tabulators.
-
-local helpers = require('test.functional.helpers')(after_each)
-local feed, insert, clear, feed_command =
- helpers.feed, helpers.insert, helpers.clear, helpers.feed_command
-
-local expect_pos = function(row, col)
- return helpers.eq({row, col}, helpers.eval('[screenrow(), screencol()]'))
-end
-
-describe('cursor and column position with conceal and tabulators', function()
- setup(clear)
-
- -- luacheck: ignore 621 (Indentation)
- it('are working', function()
- insert([[
- start:
- .concealed. text
- |concealed| text
-
- .concealed. text
- |concealed| text
-
- .a. .b. .c. .d.
- |a| |b| |c| |d|]])
-
- -- Conceal settings.
- feed_command('set conceallevel=2')
- feed_command('set concealcursor=nc')
- feed_command('syntax match test /|/ conceal')
- -- Start test.
- feed_command('/^start:')
- feed('ztj')
- expect_pos(2, 1)
- -- We should end up in the same column when running these commands on the
- -- two lines.
- feed('ft')
- expect_pos(2, 17)
- feed('$')
- expect_pos(2, 20)
- feed('0j')
- expect_pos(3, 1)
- feed('ft')
- expect_pos(3, 17)
- feed('$')
- expect_pos(3, 20)
- feed('j0j')
- expect_pos(5, 8)
- -- Same for next test block.
- feed('ft')
- expect_pos(5, 25)
- feed('$')
- expect_pos(5, 28)
- feed('0j')
- expect_pos(6, 8)
- feed('ft')
- expect_pos(6, 25)
- feed('$')
- expect_pos(6, 28)
- feed('0j0j')
- expect_pos(8, 1)
- -- And check W with multiple tabs and conceals in a line.
- feed('W')
- expect_pos(8, 9)
- feed('W')
- expect_pos(8, 17)
- feed('W')
- expect_pos(8, 25)
- feed('$')
- expect_pos(8, 27)
- feed('0j')
- expect_pos(9, 1)
- feed('W')
- expect_pos(9, 9)
- feed('W')
- expect_pos(9, 17)
- feed('W')
- expect_pos(9, 25)
- feed('$')
- expect_pos(9, 26)
- feed_command('set lbr')
- feed('$')
- expect_pos(9, 26)
- feed_command('set list listchars=tab:>-')
- feed('0')
- expect_pos(9, 1)
- feed('W')
- expect_pos(9, 9)
- feed('W')
- expect_pos(9, 17)
- feed('W')
- expect_pos(9, 25)
- feed('$')
- expect_pos(9, 26)
- end)
-end)
diff --git a/test/functional/legacy/assert_spec.lua b/test/functional/legacy/assert_spec.lua
index 4829a0bbe1..d49d7d665a 100644
--- a/test/functional/legacy/assert_spec.lua
+++ b/test/functional/legacy/assert_spec.lua
@@ -145,10 +145,10 @@ describe('assert function:', function()
call assert_true('', 'file two')
]])
expected_errors({
- "nvim_exec(): equal assertion failed: Expected 1 but got 100",
- "nvim_exec(): true assertion failed: Expected False but got 'true'",
- "nvim_exec(): false assertion failed: Expected True but got 'false'",
- "nvim_exec(): file two: Expected True but got ''",
+ "nvim_exec2(): equal assertion failed: Expected 1 but got 100",
+ "nvim_exec2(): true assertion failed: Expected False but got 'true'",
+ "nvim_exec2(): false assertion failed: Expected True but got 'false'",
+ "nvim_exec2(): file two: Expected True but got ''",
})
end)
end)
diff --git a/test/functional/legacy/autochdir_spec.lua b/test/functional/legacy/autochdir_spec.lua
index 13cb6cd287..5da54b4850 100644
--- a/test/functional/legacy/autochdir_spec.lua
+++ b/test/functional/legacy/autochdir_spec.lua
@@ -1,8 +1,8 @@
-local lfs = require('lfs')
local helpers = require('test.functional.helpers')(after_each)
local clear, eq, matches = helpers.clear, helpers.eq, helpers.matches
local eval, command, call, meths = helpers.eval, helpers.command, helpers.call, helpers.meths
local source, exec_capture = helpers.source, helpers.exec_capture
+local mkdir = helpers.mkdir
local function expected_empty()
eq({}, meths.get_vvar('errors'))
@@ -12,7 +12,7 @@ describe('autochdir behavior', function()
local dir = 'Xtest_functional_legacy_autochdir'
before_each(function()
- lfs.mkdir(dir)
+ mkdir(dir)
clear()
command('set shellslash')
end)
diff --git a/test/functional/legacy/autocmd_option_spec.lua b/test/functional/legacy/autocmd_option_spec.lua
index e00b468c16..6034d13e2a 100644
--- a/test/functional/legacy/autocmd_option_spec.lua
+++ b/test/functional/legacy/autocmd_option_spec.lua
@@ -48,10 +48,10 @@ end
local function expected_table(option, oldval, oldval_l, oldval_g, newval, scope, cmd, attr)
return {
option = option,
- oldval = tostring(oldval),
- oldval_l = tostring(oldval_l),
- oldval_g = tostring(oldval_g),
- newval = tostring(newval),
+ oldval = oldval,
+ oldval_l = oldval_l,
+ oldval_g = oldval_g,
+ newval = newval,
scope = scope,
cmd = cmd,
attr = attr,
@@ -129,44 +129,44 @@ describe('au OptionSet', function()
it('should be called in setting number option', function()
command('set nu')
- expected_combination({'number', 0, 0, 0, 1, 'global', 'set'})
+ expected_combination({'number', false, false, false, true, 'global', 'set'})
command('setlocal nonu')
- expected_combination({'number', 1, 1, '', 0, 'local', 'setlocal'})
+ expected_combination({'number', true, true, '', false, 'local', 'setlocal'})
command('setglobal nonu')
- expected_combination({'number', 1, '', 1, 0, 'global', 'setglobal'})
+ expected_combination({'number', true, '', true, false, 'global', 'setglobal'})
end)
it('should be called in setting autoindent option',function()
command('setlocal ai')
- expected_combination({'autoindent', 0, 0, '', 1, 'local', 'setlocal'})
+ expected_combination({'autoindent', false, false, '', true, 'local', 'setlocal'})
command('setglobal ai')
- expected_combination({'autoindent', 0, '', 0, 1, 'global', 'setglobal'})
+ expected_combination({'autoindent', false, '', false, true, 'global', 'setglobal'})
command('set noai')
- expected_combination({'autoindent', 1, 1, 1, 0, 'global', 'set'})
+ expected_combination({'autoindent', true, true, true, false, 'global', 'set'})
end)
it('should be called in inverting global autoindent option',function()
command('set ai!')
- expected_combination({'autoindent', 0, 0, 0, 1, 'global', 'set'})
+ expected_combination({'autoindent', false, false, false, true, 'global', 'set'})
end)
it('should be called in being unset local autoindent option',function()
command('setlocal ai')
- expected_combination({'autoindent', 0, 0, '', 1, 'local', 'setlocal'})
+ expected_combination({'autoindent', false, false, '', true, 'local', 'setlocal'})
command('setlocal ai<')
- expected_combination({'autoindent', 1, 1, '', 0, 'local', 'setlocal'})
+ expected_combination({'autoindent', true, true, '', false, 'local', 'setlocal'})
end)
it('should be called in setting global list and number option at the same time',function()
command('set list nu')
expected_combination(
- {'list', 0, 0, 0, 1, 'global', 'set'},
- {'number', 0, 0, 0, 1, 'global', 'set'}
+ {'list', false, false, false, true, 'global', 'set'},
+ {'number', false, false, false, true, 'global', 'set'}
)
end)
@@ -177,20 +177,20 @@ describe('au OptionSet', function()
it('should be called in setting local acd', function()
command('setlocal acd')
- expected_combination({'autochdir', 0, 0, '', 1, 'local', 'setlocal'})
+ expected_combination({'autochdir', false, false, '', true, 'local', 'setlocal'})
end)
it('should be called in setting autoread', function()
command('set noar')
- expected_combination({'autoread', 1, 1, 1, 0, 'global', 'set'})
+ expected_combination({'autoread', true, true, true, false, 'global', 'set'})
command('setlocal ar')
- expected_combination({'autoread', 0, 0, '', 1, 'local', 'setlocal'})
+ expected_combination({'autoread', false, false, '', true, 'local', 'setlocal'})
end)
it('should be called in inverting global autoread', function()
command('setglobal invar')
- expected_combination({'autoread', 1, '', 1, 0, 'global', 'setglobal'})
+ expected_combination({'autoread', true, '', true, false, 'global', 'setglobal'})
end)
it('should be called in setting backspace option through :let', function()
@@ -208,7 +208,7 @@ describe('au OptionSet', function()
it('should trigger using correct option name', function()
command('call setbufvar(1, "&backup", 1)')
- expected_combination({'backup', 0, 0, '', 1, 'local', 'setlocal'})
+ expected_combination({'backup', false, false, '', true, 'local', 'setlocal'})
end)
it('should trigger if the current buffer is different from the targeted buffer', function()
@@ -260,7 +260,7 @@ describe('au OptionSet', function()
command('setlocal tags=tagpath2')
expected_combination({'tags', 'tagpath1', 'tagpath1', '', 'tagpath2', 'local', 'setlocal'})
- -- Note: v:option_old is the old global value for global-local string options
+ -- Note: v:option_old is the old global value for global-local options.
-- but the old local value for all other kinds of options.
command('noa setglobal tags=tag_global')
command('noa setlocal tags=tag_local')
@@ -269,12 +269,12 @@ describe('au OptionSet', function()
'tags', 'tag_global', 'tag_local', 'tag_global', 'tagpath', 'global', 'set'
})
- -- Note: v:option_old is the old global value for global-local string options
+ -- Note: v:option_old is the old global value for global-local options.
-- but the old local value for all other kinds of options.
command('noa set tags=tag_global')
command('noa setlocal tags=')
command('set tags=tagpath')
- expected_combination({'tags', 'tag_global', '', 'tag_global', 'tagpath', 'global', 'set'})
+ expected_combination({'tags', 'tag_global', 'tag_global', 'tag_global', 'tagpath', 'global', 'set'})
end)
it('with string local (to buffer) option', function()
@@ -295,7 +295,7 @@ describe('au OptionSet', function()
command('setlocal spelllang=klingon')
expected_combination({'spelllang', oldval, oldval, '', 'klingon', 'local', 'setlocal'})
- -- Note: v:option_old is the old global value for global-local string options
+ -- Note: v:option_old is the old global value for global-local options.
-- but the old local value for all other kinds of options.
command('noa setglobal spelllang=spellglobal')
command('noa setlocal spelllang=spelllocal')
@@ -311,7 +311,7 @@ describe('au OptionSet', function()
command('set statusline=foo')
expected_combination({'statusline', oldval, oldval, '', 'foo', 'global', 'set'})
- -- Note: v:option_old is the old global value for global-local string options
+ -- Note: v:option_old is the old global value for global-local options.
-- but the old local value for all other kinds of options.
command('set statusline&')
expected_combination({'statusline', 'foo', 'foo', 'foo', oldval, 'global', 'set'})
@@ -323,7 +323,7 @@ describe('au OptionSet', function()
command('setlocal statusline=baz')
expected_combination({'statusline', oldval, oldval, '', 'baz', 'local', 'setlocal'})
- -- Note: v:option_old is the old global value for global-local string options
+ -- Note: v:option_old is the old global value for global-local options.
-- but the old local value for all other kinds of options.
command('noa setglobal statusline=bar')
command('noa setlocal statusline=baz')
@@ -364,11 +364,15 @@ describe('au OptionSet', function()
command('setlocal cmdheight=2')
expected_combination({'cmdheight', 1, 1, '', 2, 'local', 'setlocal'})
+ -- Note: v:option_old is the old global value for global-local options.
+ -- but the old local value for all other kinds of options.
command('noa setglobal cmdheight=8')
command('noa setlocal cmdheight=1') -- Sets the global(!) value
command('set cmdheight=2')
expected_combination({'cmdheight', 1, 1, 1, 2, 'global', 'set'})
+ -- Note: v:option_old is the old global value for global-local options.
+ -- but the old local value for all other kinds of options.
command('noa set cmdheight=8')
command('set cmdheight=2')
expected_combination({'cmdheight', 8, 8, 8, 2, 'global', 'set'})
@@ -385,11 +389,15 @@ describe('au OptionSet', function()
command('setlocal undolevels=2')
expected_combination({'undolevels', 1, 1, '', 2, 'local', 'setlocal'})
+ -- Note: v:option_old is the old global value for global-local options.
+ -- but the old local value for all other kinds of options.
command('noa setglobal undolevels=8')
command('noa setlocal undolevels=1')
command('set undolevels=2')
- expected_combination({'undolevels', 1, 1, 8, 2, 'global', 'set'})
+ expected_combination({'undolevels', 8, 1, 8, 2, 'global', 'set'})
+ -- Note: v:option_old is the old global value for global-local options.
+ -- but the old local value for all other kinds of options.
command('noa set undolevels=8')
command('set undolevels=2')
expected_combination({'undolevels', 8, 8, 8, 2, 'global', 'set'})
@@ -427,11 +435,15 @@ describe('au OptionSet', function()
command('setlocal scrolloff=2')
expected_combination({'scrolloff', 1, 1, '', 2, 'local', 'setlocal'})
+ -- Note: v:option_old is the old global value for global-local options.
+ -- but the old local value for all other kinds of options.
command('noa setglobal scrolloff=8')
command('noa setlocal scrolloff=1')
command('set scrolloff=2')
- expected_combination({'scrolloff', 1, 1, 8, 2, 'global', 'set'})
+ expected_combination({'scrolloff', 8, 1, 8, 2, 'global', 'set'})
+ -- Note: v:option_old is the old global value for global-local options.
+ -- but the old local value for all other kinds of options.
command('noa set scrolloff=8')
command('set scrolloff=2')
expected_combination({'scrolloff', 8, 8, 8, 2, 'global', 'set'})
@@ -441,114 +453,111 @@ describe('au OptionSet', function()
command('noa setglobal foldcolumn=8')
command('noa setlocal foldcolumn=1')
command('setglobal foldcolumn=2')
- expected_combination({'foldcolumn', 8, '', 8, 2, 'global', 'setglobal'})
+ expected_combination({'foldcolumn', '8', '', '8', '2', 'global', 'setglobal'})
command('noa setglobal foldcolumn=8')
command('noa setlocal foldcolumn=1')
command('setlocal foldcolumn=2')
- expected_combination({'foldcolumn', 1, 1, '', 2, 'local', 'setlocal'})
+ expected_combination({'foldcolumn', '1', '1', '', '2', 'local', 'setlocal'})
command('noa setglobal foldcolumn=8')
command('noa setlocal foldcolumn=1')
command('set foldcolumn=2')
- expected_combination({'foldcolumn', 1, 1, 8, 2, 'global', 'set'})
+ expected_combination({'foldcolumn', '1', '1', '8', '2', 'global', 'set'})
command('noa set foldcolumn=8')
command('set foldcolumn=2')
- expected_combination({'foldcolumn', 8, 8, 8, 2, 'global', 'set'})
+ expected_combination({'foldcolumn', '8', '8', '8', '2', 'global', 'set'})
end)
it('with boolean global option', function()
command('noa setglobal nowrapscan')
command('noa setlocal wrapscan') -- Sets the global(!) value
command('setglobal nowrapscan')
- expected_combination({'wrapscan', 1, '', 1, 0, 'global', 'setglobal'})
+ expected_combination({'wrapscan', true, '', true, false, 'global', 'setglobal'})
command('noa setglobal nowrapscan')
command('noa setlocal wrapscan') -- Sets the global(!) value
command('setlocal nowrapscan')
- expected_combination({'wrapscan', 1, 1, '', 0, 'local', 'setlocal'})
+ expected_combination({'wrapscan', true, true, '', false, 'local', 'setlocal'})
command('noa setglobal nowrapscan')
command('noa setlocal wrapscan') -- Sets the global(!) value
command('set nowrapscan')
- expected_combination({'wrapscan', 1, 1, 1, 0, 'global', 'set'})
+ expected_combination({'wrapscan', true, true, true, false, 'global', 'set'})
command('noa set nowrapscan')
command('set wrapscan')
- expected_combination({'wrapscan', 0, 0, 0, 1, 'global', 'set'})
+ expected_combination({'wrapscan', false, false, false, true, 'global', 'set'})
end)
it('with boolean global-local (to buffer) option', function()
command('noa setglobal noautoread')
command('noa setlocal autoread')
command('setglobal autoread')
- expected_combination({'autoread', 0, '', 0, 1, 'global', 'setglobal'})
+ expected_combination({'autoread', false, '', false, true, 'global', 'setglobal'})
command('noa setglobal noautoread')
command('noa setlocal autoread')
command('setlocal noautoread')
- expected_combination({'autoread', 1, 1, '', 0, 'local', 'setlocal'})
+ expected_combination({'autoread', true, true, '', false, 'local', 'setlocal'})
+ -- Note: v:option_old is the old global value for global-local options.
+ -- but the old local value for all other kinds of options.
command('noa setglobal noautoread')
command('noa setlocal autoread')
command('set autoread')
- expected_combination({'autoread', 1, 1, 0, 1, 'global', 'set'})
+ expected_combination({'autoread', false, true, false, true, 'global', 'set'})
+ -- Note: v:option_old is the old global value for global-local options.
+ -- but the old local value for all other kinds of options.
command('noa set noautoread')
command('set autoread')
- expected_combination({'autoread', 0, 0, 0, 1, 'global', 'set'})
+ expected_combination({'autoread', false, false, false, true, 'global', 'set'})
end)
it('with boolean local (to buffer) option', function()
command('noa setglobal nocindent')
command('noa setlocal cindent')
command('setglobal cindent')
- expected_combination({'cindent', 0, '', 0, 1, 'global', 'setglobal'})
+ expected_combination({'cindent', false, '', false, true, 'global', 'setglobal'})
command('noa setglobal nocindent')
command('noa setlocal cindent')
command('setlocal nocindent')
- expected_combination({'cindent', 1, 1, '', 0, 'local', 'setlocal'})
+ expected_combination({'cindent', true, true, '', false, 'local', 'setlocal'})
command('noa setglobal nocindent')
command('noa setlocal cindent')
command('set cindent')
- expected_combination({'cindent', 1, 1, 0, 1, 'global', 'set'})
+ expected_combination({'cindent', true, true, false, true, 'global', 'set'})
command('noa set nocindent')
command('set cindent')
- expected_combination({'cindent', 0, 0, 0, 1, 'global', 'set'})
+ expected_combination({'cindent', false, false, false, true, 'global', 'set'})
end)
it('with boolean local (to window) option', function()
command('noa setglobal nocursorcolumn')
command('noa setlocal cursorcolumn')
command('setglobal cursorcolumn')
- expected_combination({'cursorcolumn', 0, '', 0, 1, 'global', 'setglobal'})
+ expected_combination({'cursorcolumn', false, '', false, true, 'global', 'setglobal'})
command('noa setglobal nocursorcolumn')
command('noa setlocal cursorcolumn')
command('setlocal nocursorcolumn')
- expected_combination({'cursorcolumn', 1, 1, '', 0, 'local', 'setlocal'})
+ expected_combination({'cursorcolumn', true, true, '', false, 'local', 'setlocal'})
command('noa setglobal nocursorcolumn')
command('noa setlocal cursorcolumn')
command('set cursorcolumn')
- expected_combination({'cursorcolumn', 1, 1, 0, 1, 'global', 'set'})
+ expected_combination({'cursorcolumn', true, true, false, true, 'global', 'set'})
command('noa set nocursorcolumn')
command('set cursorcolumn')
- expected_combination({'cursorcolumn', 0, 0, 0, 1, 'global', 'set'})
+ expected_combination({'cursorcolumn', false, false, false, true, 'global', 'set'})
end)
- it('with option value converted internally', function()
- command('noa set backspace=1')
- command('set backspace=2')
- expected_combination(({
- 'backspace', 'indent,eol', 'indent,eol', 'indent,eol', '2', 'global', 'set'
- }))
- end)
end)
describe('with specific option', function()
@@ -566,13 +575,13 @@ describe('au OptionSet', function()
expected_empty()
command('setlocal ro')
- expected_combination({'readonly', 0, 0, '', 1, 'local', 'setlocal'})
+ expected_combination({'readonly', false, false, '', true, 'local', 'setlocal'})
command('setglobal ro')
- expected_combination({'readonly', 0, '', 0, 1, 'global', 'setglobal'})
+ expected_combination({'readonly', false, '', false, true, 'global', 'setglobal'})
command('set noro')
- expected_combination({'readonly', 1, 1, 1, 0, 'global', 'set'})
+ expected_combination({'readonly', true, true, true, false, 'global', 'set'})
end)
describe('being set by setbufvar()', function()
@@ -587,7 +596,7 @@ describe('au OptionSet', function()
set_hook('backup')
command('call setbufvar(1, "&backup", 1)')
- expected_combination({'backup', 0, 0, '', 1, 'local', 'setlocal'})
+ expected_combination({'backup', false, false, '', true, 'local', 'setlocal'})
end)
it('should trigger if the current buffer is different from the targeted buffer', function()
@@ -597,7 +606,8 @@ describe('au OptionSet', function()
local new_bufnr = buf.get_number(new_buffer)
command('call setbufvar(' .. new_bufnr .. ', "&buftype", "nofile")')
- expected_combination({'buftype', '', '', '', 'nofile', 'local', 'setlocal', {bufnr = new_bufnr}})
+ expected_combination({ 'buftype', '', '', '', 'nofile', 'local', 'setlocal',
+ { bufnr = new_bufnr } })
end)
end)
@@ -613,7 +623,7 @@ describe('au OptionSet', function()
set_hook('backup')
command('call setwinvar(1, "&backup", 1)')
- expected_combination({'backup', 0, 0, '', 1, 'local', 'setlocal'})
+ expected_combination({'backup', false, false, '', true, 'local', 'setlocal'})
end)
it('should not trigger if the current window is different from the targeted window', function()
@@ -622,7 +632,7 @@ describe('au OptionSet', function()
local new_winnr = get_new_window_number()
command('call setwinvar(' .. new_winnr .. ', "&cursorcolumn", 1)')
- -- expected_combination({'cursorcolumn', 0, 1, 'local', {winnr = new_winnr}})
+ -- expected_combination({'cursorcolumn', false, true, 'local', {winnr = new_winnr}})
expected_empty()
end)
end)
@@ -631,24 +641,24 @@ describe('au OptionSet', function()
it('should trigger if a boolean option be set globally', function()
set_hook('autochdir')
- nvim.set_option('autochdir', true)
- eq(true, nvim.get_option('autochdir'))
- expected_combination({'autochdir', 0, '', 0, 1, 'global', 'setglobal'})
+ nvim.set_option_value('autochdir', true, {scope='global'})
+ eq(true, nvim.get_option_value('autochdir', {scope='global'}))
+ expected_combination({'autochdir', false, '', false, true, 'global', 'setglobal'})
end)
it('should trigger if a number option be set globally', function()
set_hook('cmdheight')
- nvim.set_option('cmdheight', 5)
- eq(5, nvim.get_option('cmdheight'))
+ nvim.set_option_value('cmdheight', 5, {scope='global'})
+ eq(5, nvim.get_option_value('cmdheight', {scope='global'}))
expected_combination({'cmdheight', 1, '', 1, 5, 'global', 'setglobal'})
end)
it('should trigger if a string option be set globally', function()
set_hook('ambiwidth')
- nvim.set_option('ambiwidth', 'double')
- eq('double', nvim.get_option('ambiwidth'))
+ nvim.set_option_value('ambiwidth', 'double', {scope='global'})
+ eq('double', nvim.get_option_value('ambiwidth', {scope='global'}))
expected_combination({'ambiwidth', 'single', '', 'single', 'double', 'global', 'setglobal'})
end)
end)
diff --git a/test/functional/legacy/breakindent_spec.lua b/test/functional/legacy/breakindent_spec.lua
index d7779684a4..3913ba935a 100644
--- a/test/functional/legacy/breakindent_spec.lua
+++ b/test/functional/legacy/breakindent_spec.lua
@@ -1,6 +1,7 @@
local helpers = require('test.functional.helpers')(after_each)
local Screen = require('test.functional.ui.screen')
local clear = helpers.clear
+local command = helpers.command
local exec = helpers.exec
local feed = helpers.feed
@@ -17,28 +18,47 @@ describe('breakindent', function()
})
screen:attach()
exec([[
+ set listchars=eol:$
let &signcolumn = 'yes'
- let &showbreak = '+'
+ let &showbreak = '++'
+ let &breakindentopt = 'shift:2'
let leftcol = win_getid()->getwininfo()->get(0, {})->get('textoff')
eval repeat('x', &columns - leftcol - 1)->setline(1)
eval 'second line'->setline(2)
]])
+ feed('AX')
screen:expect([[
- {1: }^xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx |
- {1: }second line |
+ {1: }xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxX|
+ {1: }^second line |
{0:~ }|
{0:~ }|
{0:~ }|
- |
+ {2:-- INSERT --} |
]])
- feed('AX')
- screen:expect([[
+ -- No line wraps, so changing 'showbreak' should lead to the same screen.
+ command('setlocal showbreak=+')
+ screen:expect_unchanged()
+ -- No line wraps, so setting 'breakindent' should lead to the same screen.
+ command('setlocal breakindent')
+ screen:expect_unchanged()
+ -- The first line now wraps because of "eol" in 'listchars'.
+ command('setlocal list')
+ screen:expect{grid=[[
{1: }xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxX|
- {1: }^second line |
+ {1: } {0:+^$} |
+ {1: }second line{0:$} |
{0:~ }|
{0:~ }|
+ {2:-- INSERT --} |
+ ]]}
+ command('setlocal nobreakindent')
+ screen:expect{grid=[[
+ {1: }xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxX|
+ {1: }{0:+^$} |
+ {1: }second line{0:$} |
+ {0:~ }|
{0:~ }|
{2:-- INSERT --} |
- ]])
+ ]]}
end)
end)
diff --git a/test/functional/legacy/buffer_spec.lua b/test/functional/legacy/buffer_spec.lua
index acaa9a51f1..1e8909f0d0 100644
--- a/test/functional/legacy/buffer_spec.lua
+++ b/test/functional/legacy/buffer_spec.lua
@@ -10,7 +10,7 @@ describe('buffer', function()
before_each(function()
clear()
meths.ui_attach(80, 24, {})
- meths.set_option('hidden', false)
+ meths.set_option_value('hidden', false, {})
end)
it('deleting a modified buffer with :confirm', function()
diff --git a/test/functional/legacy/cmdline_spec.lua b/test/functional/legacy/cmdline_spec.lua
index 2fceb6a132..3cbff2a01b 100644
--- a/test/functional/legacy/cmdline_spec.lua
+++ b/test/functional/legacy/cmdline_spec.lua
@@ -225,9 +225,9 @@ describe('cmdline', function()
[3] = {reverse = true}, -- TabLineFill
})
screen:attach()
- meths.set_option('laststatus', 2)
- meths.set_option('showtabline', 2)
- meths.set_option('cmdheight', 1)
+ meths.set_option_value('laststatus', 2, {})
+ meths.set_option_value('showtabline', 2, {})
+ meths.set_option_value('cmdheight', 1, {})
screen:expect([[
{2: [No Name] }{3: }|
^ |
@@ -239,6 +239,25 @@ describe('cmdline', function()
|
]])
end)
+
+ -- oldtest: Test_rulerformat_position()
+ it("ruler has correct position with 'rulerformat' set", function()
+ local screen = Screen.new(20, 3)
+ screen:set_default_attr_ids {
+ [0] = {bold = true, foreground = Screen.colors.Blue}, -- NonText
+ }
+ screen:attach()
+ meths.set_option_value('ruler', true, {})
+ meths.set_option_value('rulerformat', 'longish', {})
+ meths.set_option_value('laststatus', 0, {})
+ meths.set_option_value('winwidth', 1, {})
+ feed [[<C-W>v<C-W>|<C-W>p]]
+ screen:expect [[
+ │^ |
+ {0:~ }│{0:~}|
+ longish |
+ ]]
+ end)
end)
describe('cmdwin', function()
diff --git a/test/functional/legacy/conceal_spec.lua b/test/functional/legacy/conceal_spec.lua
new file mode 100644
index 0000000000..6aaa93f886
--- /dev/null
+++ b/test/functional/legacy/conceal_spec.lua
@@ -0,0 +1,587 @@
+local helpers = require('test.functional.helpers')(after_each)
+local Screen = require('test.functional.ui.screen')
+local clear = helpers.clear
+local command = helpers.command
+local exec = helpers.exec
+local feed = helpers.feed
+
+local expect_pos = function(row, col)
+ return helpers.eq({row, col}, helpers.eval('[screenrow(), screencol()]'))
+end
+
+describe('Conceal', function()
+ before_each(function()
+ clear()
+ command('set nohlsearch')
+ end)
+
+ -- oldtest: Test_conceal_two_windows()
+ it('works', function()
+ local screen = Screen.new(75, 12)
+ screen:set_default_attr_ids({
+ [0] = {bold = true, foreground = Screen.colors.Blue}, -- NonText
+ [1] = {bold = true, reverse = true}, -- StatusLine
+ [2] = {reverse = true}, -- StatusLineNC, IncSearch
+ [3] = {bold = true}, -- ModeMsg
+ })
+ screen:attach()
+ exec([[
+ let lines = ["one one one one one", "two |hidden| here", "three |hidden| three"]
+ call setline(1, lines)
+ syntax match test /|hidden|/ conceal
+ set conceallevel=2
+ set concealcursor=
+ exe "normal /here\r"
+ new
+ call setline(1, lines)
+ call setline(4, "Second window")
+ syntax match test /|hidden|/ conceal
+ set conceallevel=2
+ set concealcursor=nc
+ exe "normal /here\r"
+ ]])
+
+ -- Check that cursor line is concealed
+ screen:expect([[
+ one one one one one |
+ two ^here |
+ three three |
+ Second window |
+ {0:~ }|
+ {1:[No Name] [+] }|
+ one one one one one |
+ two here |
+ three three |
+ {0:~ }|
+ {2:[No Name] [+] }|
+ /here |
+ ]])
+
+ -- Check that with concealed text vertical cursor movement is correct.
+ feed('k')
+ screen:expect([[
+ one one one o^ne one |
+ two here |
+ three three |
+ Second window |
+ {0:~ }|
+ {1:[No Name] [+] }|
+ one one one one one |
+ two here |
+ three three |
+ {0:~ }|
+ {2:[No Name] [+] }|
+ /here |
+ ]])
+
+ -- Check that with cursor line is not concealed
+ feed('j')
+ command('set concealcursor=')
+ screen:expect([[
+ one one one one one |
+ two |hidden| ^here |
+ three three |
+ Second window |
+ {0:~ }|
+ {1:[No Name] [+] }|
+ one one one one one |
+ two here |
+ three three |
+ {0:~ }|
+ {2:[No Name] [+] }|
+ /here |
+ ]])
+
+ -- Check that with cursor line is not concealed when moving cursor down
+ feed('j')
+ screen:expect([[
+ one one one one one |
+ two here |
+ three |hidden^| three |
+ Second window |
+ {0:~ }|
+ {1:[No Name] [+] }|
+ one one one one one |
+ two here |
+ three three |
+ {0:~ }|
+ {2:[No Name] [+] }|
+ /here |
+ ]])
+
+ -- Check that with cursor line is not concealed when switching windows
+ feed('<C-W><C-W>')
+ screen:expect([[
+ one one one one one |
+ two here |
+ three three |
+ Second window |
+ {0:~ }|
+ {2:[No Name] [+] }|
+ one one one one one |
+ two |hidden| ^here |
+ three three |
+ {0:~ }|
+ {1:[No Name] [+] }|
+ /here |
+ ]])
+
+ -- Check that with cursor line is only concealed in Normal mode
+ command('set concealcursor=n')
+ screen:expect([[
+ one one one one one |
+ two here |
+ three three |
+ Second window |
+ {0:~ }|
+ {2:[No Name] [+] }|
+ one one one one one |
+ two ^here |
+ three three |
+ {0:~ }|
+ {1:[No Name] [+] }|
+ /here |
+ ]])
+ feed('a')
+ screen:expect([[
+ one one one one one |
+ two here |
+ three three |
+ Second window |
+ {0:~ }|
+ {2:[No Name] [+] }|
+ one one one one one |
+ two |hidden| h^ere |
+ three three |
+ {0:~ }|
+ {1:[No Name] [+] }|
+ {3:-- INSERT --} |
+ ]])
+ feed('<Esc>/e')
+ screen:expect([[
+ one one one one one |
+ two here |
+ three three |
+ Second window |
+ {0:~ }|
+ {2:[No Name] [+] }|
+ one one one one one |
+ two |hidden| h{2:e}re |
+ three three |
+ {0:~ }|
+ {1:[No Name] [+] }|
+ /e^ |
+ ]])
+ feed('<Esc>v')
+ screen:expect([[
+ one one one one one |
+ two here |
+ three three |
+ Second window |
+ {0:~ }|
+ {2:[No Name] [+] }|
+ one one one one one |
+ two |hidden| ^here |
+ three three |
+ {0:~ }|
+ {1:[No Name] [+] }|
+ {3:-- VISUAL --} |
+ ]])
+ feed('<Esc>')
+
+ -- Check that with cursor line is only concealed in Insert mode
+ command('set concealcursor=i')
+ screen:expect([[
+ one one one one one |
+ two here |
+ three three |
+ Second window |
+ {0:~ }|
+ {2:[No Name] [+] }|
+ one one one one one |
+ two |hidden| ^here |
+ three three |
+ {0:~ }|
+ {1:[No Name] [+] }|
+ |
+ ]])
+ feed('a')
+ screen:expect([[
+ one one one one one |
+ two here |
+ three three |
+ Second window |
+ {0:~ }|
+ {2:[No Name] [+] }|
+ one one one one one |
+ two h^ere |
+ three three |
+ {0:~ }|
+ {1:[No Name] [+] }|
+ {3:-- INSERT --} |
+ ]])
+ feed('<Esc>/e')
+ screen:expect([[
+ one one one one one |
+ two here |
+ three three |
+ Second window |
+ {0:~ }|
+ {2:[No Name] [+] }|
+ one one one one one |
+ two |hidden| h{2:e}re |
+ three three |
+ {0:~ }|
+ {1:[No Name] [+] }|
+ /e^ |
+ ]])
+ feed('<Esc>v')
+ screen:expect([[
+ one one one one one |
+ two here |
+ three three |
+ Second window |
+ {0:~ }|
+ {2:[No Name] [+] }|
+ one one one one one |
+ two |hidden| ^here |
+ three three |
+ {0:~ }|
+ {1:[No Name] [+] }|
+ {3:-- VISUAL --} |
+ ]])
+ feed('<Esc>')
+
+ -- Check that with cursor line is only concealed in Visual mode
+ command('set concealcursor=v')
+ screen:expect([[
+ one one one one one |
+ two here |
+ three three |
+ Second window |
+ {0:~ }|
+ {2:[No Name] [+] }|
+ one one one one one |
+ two |hidden| ^here |
+ three three |
+ {0:~ }|
+ {1:[No Name] [+] }|
+ |
+ ]])
+ feed('a')
+ screen:expect([[
+ one one one one one |
+ two here |
+ three three |
+ Second window |
+ {0:~ }|
+ {2:[No Name] [+] }|
+ one one one one one |
+ two |hidden| h^ere |
+ three three |
+ {0:~ }|
+ {1:[No Name] [+] }|
+ {3:-- INSERT --} |
+ ]])
+ feed('<Esc>/e')
+ screen:expect([[
+ one one one one one |
+ two here |
+ three three |
+ Second window |
+ {0:~ }|
+ {2:[No Name] [+] }|
+ one one one one one |
+ two |hidden| h{2:e}re |
+ three three |
+ {0:~ }|
+ {1:[No Name] [+] }|
+ /e^ |
+ ]])
+ feed('<Esc>v')
+ screen:expect([[
+ one one one one one |
+ two here |
+ three three |
+ Second window |
+ {0:~ }|
+ {2:[No Name] [+] }|
+ one one one one one |
+ two ^here |
+ three three |
+ {0:~ }|
+ {1:[No Name] [+] }|
+ {3:-- VISUAL --} |
+ ]])
+ feed('<Esc>')
+
+ -- Check moving the cursor while in insert mode.
+ command('set concealcursor=')
+ feed('a')
+ screen:expect([[
+ one one one one one |
+ two here |
+ three three |
+ Second window |
+ {0:~ }|
+ {2:[No Name] [+] }|
+ one one one one one |
+ two |hidden| h^ere |
+ three three |
+ {0:~ }|
+ {1:[No Name] [+] }|
+ {3:-- INSERT --} |
+ ]])
+ feed('<Down>')
+ screen:expect([[
+ one one one one one |
+ two here |
+ three three |
+ Second window |
+ {0:~ }|
+ {2:[No Name] [+] }|
+ one one one one one |
+ two here |
+ three |hidden|^ three |
+ {0:~ }|
+ {1:[No Name] [+] }|
+ {3:-- INSERT --} |
+ ]])
+ feed('<Esc>')
+
+ -- Check the "o" command
+ screen:expect([[
+ one one one one one |
+ two here |
+ three three |
+ Second window |
+ {0:~ }|
+ {2:[No Name] [+] }|
+ one one one one one |
+ two here |
+ three |hidden^| three |
+ {0:~ }|
+ {1:[No Name] [+] }|
+ |
+ ]])
+ feed('o')
+ screen:expect([[
+ one one one one one |
+ two here |
+ three three |
+ Second window |
+ {0:~ }|
+ {2:[No Name] [+] }|
+ one one one one one |
+ two here |
+ three three |
+ ^ |
+ {1:[No Name] [+] }|
+ {3:-- INSERT --} |
+ ]])
+ feed('<Esc>')
+ end)
+
+ -- oldtest: Test_conceal_with_cursorcolumn()
+ it('CursorColumn and ColorColumn on wrapped line', function()
+ local screen = Screen.new(40, 10)
+ screen:set_default_attr_ids({
+ [0] = {bold = true, foreground = Screen.colors.Blue}, -- NonText
+ [1] = {background = Screen.colors.Grey90}, -- CursorColumn
+ [2] = {background = Screen.colors.LightRed}, -- ColorColumn
+ })
+ screen:attach()
+ -- Check that cursorcolumn and colorcolumn don't get broken in presence of
+ -- wrapped lines containing concealed text
+ -- luacheck: push ignore 613 (trailing whitespace in a string)
+ exec([[
+ let lines = ["one one one |hidden| one one one one one one one one",
+ \ "two two two two |hidden| here two two",
+ \ "three |hidden| three three three three three three three three"]
+ call setline(1, lines)
+ set wrap linebreak
+ set showbreak=\ >>>\
+ syntax match test /|hidden|/ conceal
+ set conceallevel=2
+ set concealcursor=
+ exe "normal /here\r"
+ set cursorcolumn
+ set colorcolumn=50
+ ]])
+ -- luacheck: pop
+
+ screen:expect([[
+ one one one one one one {1:o}ne |
+ {0: >>> }one {2:o}ne one one |
+ two two two two |hidden| ^here two two |
+ three three three three {1:t}hree |
+ {0: >>> }thre{2:e} three three three |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ /here |
+ ]])
+
+ -- move cursor to the end of line (the cursor jumps to the next screen line)
+ feed('$')
+ screen:expect([[
+ one one one one one one one |
+ {0: >>> }one {2:o}ne one one |
+ two two two two |hidden| here two tw^o |
+ three three three three three |
+ {0: >>> }thre{2:e} three three three |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ /here |
+ ]])
+ end)
+
+ -- oldtest: Test_conceal_resize_term()
+ it('resize editor', function()
+ local screen = Screen.new(75, 6)
+ screen:set_default_attr_ids({
+ [0] = {bold = true, foreground = Screen.colors.Blue}, -- NonText
+ [1] = {foreground = Screen.colors.Blue}, -- Comment
+ })
+ screen:attach()
+ exec([[
+ call setline(1, '`one` `two` `three` `four` `five`, the backticks should be concealed')
+ setl cocu=n cole=3
+ syn region CommentCodeSpan matchgroup=Comment start=/`/ end=/`/ concealends
+ normal fb
+ ]])
+ screen:expect([[
+ one two three four five, the ^backticks should be concealed |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ |
+ ]])
+
+ screen:try_resize(75, 7)
+ screen:expect([[
+ one two three four five, the ^backticks should be concealed |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ |
+ ]])
+ end)
+
+ -- oldtest: Test_conceal_linebreak()
+ it('with linebreak', function()
+ local screen = Screen.new(75, 8)
+ screen:set_default_attr_ids({
+ [0] = {bold = true, foreground = Screen.colors.Blue}, -- NonText
+ })
+ screen:attach()
+ exec([[
+ let &wrap = v:true
+ let &conceallevel = 2
+ let &concealcursor = 'nc'
+ let &linebreak = v:true
+ let &showbreak = '+ '
+ let line = 'a`a`a`a`'
+ \ .. 'a'->repeat(&columns - 15)
+ \ .. ' b`b`'
+ \ .. 'b'->repeat(&columns - 10)
+ \ .. ' cccccc'
+ eval ['x'->repeat(&columns), '', line]->setline(1)
+ syntax region CodeSpan matchgroup=Delimiter start=/\z(`\+\)/ end=/\z1/ concealends
+ ]])
+ screen:expect([[
+ ^xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx|
+ |
+ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa |
+ {0:+ }bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb |
+ {0:+ }cccccc |
+ {0:~ }|
+ {0:~ }|
+ |
+ ]])
+ end)
+
+ -- Tests for correct display (cursor column position) with +conceal and tabulators.
+ -- oldtest: Test_conceal_cursor_pos()
+ it('cursor and column position with conceal and tabulators', function()
+ exec([[
+ let l = ['start:', '.concealed. text', "|concealed|\ttext"]
+ let l += ['', "\t.concealed.\ttext", "\t|concealed|\ttext", '']
+ let l += [".a.\t.b.\t.c.\t.d.", "|a|\t|b|\t|c|\t|d|"]
+ call append(0, l)
+ call cursor(1, 1)
+ " Conceal settings.
+ set conceallevel=2
+ set concealcursor=nc
+ syntax match test /|/ conceal
+ ]])
+ feed('ztj')
+ expect_pos(2, 1)
+ -- We should end up in the same column when running these commands on the
+ -- two lines.
+ feed('ft')
+ expect_pos(2, 17)
+ feed('$')
+ expect_pos(2, 20)
+ feed('0j')
+ expect_pos(3, 1)
+ feed('ft')
+ expect_pos(3, 17)
+ feed('$')
+ expect_pos(3, 20)
+ feed('j0j')
+ expect_pos(5, 8)
+ -- Same for next test block.
+ feed('ft')
+ expect_pos(5, 25)
+ feed('$')
+ expect_pos(5, 28)
+ feed('0j')
+ expect_pos(6, 8)
+ feed('ft')
+ expect_pos(6, 25)
+ feed('$')
+ expect_pos(6, 28)
+ feed('0j0j')
+ expect_pos(8, 1)
+ -- And check W with multiple tabs and conceals in a line.
+ feed('W')
+ expect_pos(8, 9)
+ feed('W')
+ expect_pos(8, 17)
+ feed('W')
+ expect_pos(8, 25)
+ feed('$')
+ expect_pos(8, 27)
+ feed('0j')
+ expect_pos(9, 1)
+ feed('W')
+ expect_pos(9, 9)
+ feed('W')
+ expect_pos(9, 17)
+ feed('W')
+ expect_pos(9, 25)
+ feed('$')
+ expect_pos(9, 26)
+ command('set lbr')
+ feed('$')
+ expect_pos(9, 26)
+ command('set list listchars=tab:>-')
+ feed('0')
+ expect_pos(9, 1)
+ feed('W')
+ expect_pos(9, 9)
+ feed('W')
+ expect_pos(9, 17)
+ feed('W')
+ expect_pos(9, 25)
+ feed('$')
+ expect_pos(9, 26)
+ end)
+end)
diff --git a/test/functional/legacy/crash_spec.lua b/test/functional/legacy/crash_spec.lua
new file mode 100644
index 0000000000..5094f81847
--- /dev/null
+++ b/test/functional/legacy/crash_spec.lua
@@ -0,0 +1,16 @@
+local helpers = require('test.functional.helpers')(after_each)
+local assert_alive = helpers.assert_alive
+local clear = helpers.clear
+local command = helpers.command
+local feed = helpers.feed
+
+before_each(clear)
+
+-- oldtest: Test_crash1()
+it('no crash when ending Visual mode while editing buffer closes window', function()
+ command('new')
+ command('autocmd ModeChanged v:n ++once close')
+ feed('v')
+ command('enew')
+ assert_alive()
+end)
diff --git a/test/functional/legacy/debugger_spec.lua b/test/functional/legacy/debugger_spec.lua
new file mode 100644
index 0000000000..e6fb81719f
--- /dev/null
+++ b/test/functional/legacy/debugger_spec.lua
@@ -0,0 +1,85 @@
+local helpers = require('test.functional.helpers')(after_each)
+local Screen = require('test.functional.ui.screen')
+local clear = helpers.clear
+local command = helpers.command
+local feed = helpers.feed
+local write_file = helpers.write_file
+
+before_each(clear)
+
+describe('debugger', function()
+ local screen
+
+ before_each(function()
+ screen = Screen.new(999, 10)
+ screen:set_default_attr_ids({
+ [0] = {bold = true, foreground = Screen.colors.Blue};
+ [1] = {reverse = true, bold = true};
+ })
+ screen:attach()
+ end)
+
+ -- oldtest: Test_Debugger_breakadd_expr()
+ it(':breakadd expr', function()
+ write_file('XdebugBreakExpr.vim', 'let g:Xtest_var += 1')
+ finally(function()
+ os.remove('XdebugBreakExpr.vim')
+ end)
+
+ command('edit XdebugBreakExpr.vim')
+ command(':let g:Xtest_var = 10')
+ command(':breakadd expr g:Xtest_var')
+ feed(':source %<CR>')
+ screen:expect{grid=[[
+ ^let g:Xtest_var += 1{MATCH: *}|
+ {0:~{MATCH: *}}|
+ {0:~{MATCH: *}}|
+ {0:~{MATCH: *}}|
+ {0:~{MATCH: *}}|
+ {0:~{MATCH: *}}|
+ {0:~{MATCH: *}}|
+ {0:~{MATCH: *}}|
+ {0:~{MATCH: *}}|
+ :source %{MATCH: *}|
+ ]]}
+ feed(':source %<CR>')
+ screen:expect{grid=[[
+ let g:Xtest_var += 1{MATCH: *}|
+ {0:~{MATCH: *}}|
+ {1:{MATCH: *}}|
+ Breakpoint in "{MATCH:.*}XdebugBreakExpr.vim" line 1{MATCH: *}|
+ Entering Debug mode. Type "cont" to continue.{MATCH: *}|
+ Oldval = "10"{MATCH: *}|
+ Newval = "11"{MATCH: *}|
+ {MATCH:.*}XdebugBreakExpr.vim{MATCH: *}|
+ line 1: let g:Xtest_var += 1{MATCH: *}|
+ >^{MATCH: *}|
+ ]]}
+ feed('cont<CR>')
+ screen:expect{grid=[[
+ ^let g:Xtest_var += 1{MATCH: *}|
+ {0:~{MATCH: *}}|
+ {0:~{MATCH: *}}|
+ {0:~{MATCH: *}}|
+ {0:~{MATCH: *}}|
+ {0:~{MATCH: *}}|
+ {0:~{MATCH: *}}|
+ {0:~{MATCH: *}}|
+ {0:~{MATCH: *}}|
+ {MATCH: *}|
+ ]]}
+ feed(':source %<CR>')
+ screen:expect{grid=[[
+ let g:Xtest_var += 1{MATCH: *}|
+ {0:~{MATCH: *}}|
+ {1:{MATCH: *}}|
+ Breakpoint in "{MATCH:.*}XdebugBreakExpr.vim" line 1{MATCH: *}|
+ Entering Debug mode. Type "cont" to continue.{MATCH: *}|
+ Oldval = "11"{MATCH: *}|
+ Newval = "12"{MATCH: *}|
+ {MATCH:.*}XdebugBreakExpr.vim{MATCH: *}|
+ line 1: let g:Xtest_var += 1{MATCH: *}|
+ >^{MATCH: *}|
+ ]]}
+ end)
+end)
diff --git a/test/functional/legacy/delete_spec.lua b/test/functional/legacy/delete_spec.lua
index cefcd6c6c4..1b9ec9af62 100644
--- a/test/functional/legacy/delete_spec.lua
+++ b/test/functional/legacy/delete_spec.lua
@@ -63,6 +63,6 @@ describe('Test for delete()', function()
it('gives correct emsgs', function()
eq('Vim(call):E474: Invalid argument', exc_exec("call delete('')"))
- eq('Vim(call):E15: Invalid expression: 0', exc_exec("call delete('foo', 0)"))
+ eq('Vim(call):E15: Invalid expression: "0"', exc_exec("call delete('foo', 0)"))
end)
end)
diff --git a/test/functional/legacy/digraph_spec.lua b/test/functional/legacy/digraph_spec.lua
index 0cb0bb84be..7eeb83eb5f 100644
--- a/test/functional/legacy/digraph_spec.lua
+++ b/test/functional/legacy/digraph_spec.lua
@@ -22,7 +22,7 @@ describe('digraph', function()
{0:~ }|
{0:~ }|
{0:~ }|
- {2:-- INSERT -} |
+ {2:-- INSERT --}|
]])
feed('1')
screen:expect([[
@@ -31,7 +31,7 @@ describe('digraph', function()
{0:~ }|
{0:~ }|
{0:~ }|
- {2:-- INSERT -} |
+ {2:-- INSERT --}|
]])
feed('2')
screen:expect([[
@@ -40,7 +40,7 @@ describe('digraph', function()
{0:~ }|
{0:~ }|
{0:~ }|
- {2:-- INSERT -} |
+ {2:-- INSERT --}|
]])
end)
end)
diff --git a/test/functional/legacy/display_spec.lua b/test/functional/legacy/display_spec.lua
index f9b78f5dcd..9c6f521882 100644
--- a/test/functional/legacy/display_spec.lua
+++ b/test/functional/legacy/display_spec.lua
@@ -58,51 +58,6 @@ describe('display', function()
]])
end)
- -- oldtest: Test_matchparen_clear_highlight()
- it('matchparen highlight is cleared when switching buffer', function()
- local screen = Screen.new(20, 5)
- screen:set_default_attr_ids({
- [0] = {bold = true, foreground = Screen.colors.Blue},
- [1] = {background = Screen.colors.Cyan},
- })
- screen:attach()
-
- local screen1 = [[
- {1:^()} |
- {0:~ }|
- {0:~ }|
- {0:~ }|
- |
- ]]
- local screen2 = [[
- ^aa |
- {0:~ }|
- {0:~ }|
- {0:~ }|
- |
- ]]
-
- exec([[
- source $VIMRUNTIME/plugin/matchparen.vim
- set hidden
- call setline(1, ['()'])
- normal 0
- ]])
- screen:expect(screen1)
-
- exec([[
- enew
- exe "normal iaa\<Esc>0"
- ]])
- screen:expect(screen2)
-
- feed('<C-^>')
- screen:expect(screen1)
-
- feed('<C-^>')
- screen:expect(screen2)
- end)
-
local function run_test_display_lastline(euro)
local screen = Screen.new(75, 10)
screen:set_default_attr_ids({
@@ -194,4 +149,149 @@ describe('display', function()
it('display "lastline" works correctly with multibyte fillchar', function()
run_test_display_lastline(true)
end)
+
+ -- oldtest: Test_display_long_lastline()
+ it('"lastline" shows correct text when end of wrapped line is deleted', function()
+ local screen = Screen.new(35, 14)
+ screen:attach()
+ exec([[
+ set display=lastline smoothscroll scrolloff=0
+ call setline(1, [
+ \'aaaaa'->repeat(150),
+ \'bbbbb '->repeat(7) .. 'ccccc '->repeat(7) .. 'ddddd '->repeat(7)
+ \])
+ ]])
+ feed('736|')
+ screen:expect([[
+ <<<aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
+ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
+ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
+ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
+ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
+ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
+ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
+ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
+ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
+ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
+ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
+ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
+ ^aaaaaaaaaaaaaaa |
+ |
+ ]])
+ -- The correct part of the last line is moved into view.
+ feed('D')
+ screen:expect([[
+ <<<aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
+ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
+ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
+ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
+ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
+ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
+ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
+ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
+ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
+ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
+ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
+ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa^a|
+ bbbbb bbbbb bbbbb bbbbb bbbbb bb@@@|
+ |
+ ]])
+ -- "w_skipcol" does not change because the topline is still long enough
+ -- to maintain the current skipcol.
+ feed('g04l11gkD')
+ screen:expect([[
+ <<<^a |
+ bbbbb bbbbb bbbbb bbbbb bbbbb bbbbb|
+ bbbbb ccccc ccccc ccccc ccccc cccc|
+ c ccccc ccccc ddddd ddddd ddddd ddd|
+ dd ddddd ddddd ddddd |
+ ~ |
+ ~ |
+ ~ |
+ ~ |
+ ~ |
+ ~ |
+ ~ |
+ ~ |
+ |
+ ]])
+ -- "w_skipcol" is reset to bring the entire topline into view because
+ -- the line length is now smaller than the current skipcol + marker.
+ feed('x')
+ screen:expect([[
+ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
+ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
+ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
+ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
+ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
+ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
+ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
+ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
+ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
+ aa^a |
+ bbbbb bbbbb bbbbb bbbbb bbbbb bbbbb|
+ bbbbb ccccc ccccc ccccc ccccc cccc|
+ c ccccc ccccc ddddd ddddd ddddd @@@|
+ |
+ ]])
+ end)
+
+ -- oldtest: Test_display_cursor_long_line()
+ it("correctly shows line that doesn't fit in the window", function()
+ local screen = Screen.new(75, 8)
+ screen:attach()
+ exec([[
+ call setline(1, ['a', 'b ' .. 'bbbbb'->repeat(150), 'c'])
+ norm $j
+ ]])
+ screen:expect([[
+ <<<bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb|
+ bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb|
+ bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb|
+ bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb|
+ bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb|
+ bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb|
+ b^b |
+ |
+ ]])
+ -- FIXME: moving the cursor above the topline does not set w_skipcol
+ -- correctly with cpo+=n and zero scrolloff (curs_columns() extra == 1).
+ exec('set number cpo+=n scrolloff=0')
+ feed('$0')
+ screen:expect([[
+ <<<b^bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb|
+ bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb|
+ bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb|
+ bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb|
+ bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb|
+ bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb|
+ bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb|
+ |
+ ]])
+ -- Going to the start of the line with "b" did not set w_skipcol correctly with 'smoothscroll'.
+ exec('set smoothscroll')
+ feed('$b')
+ screen:expect([[
+ 2 b ^bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb|
+ bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb|
+ bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb|
+ bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb|
+ bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb|
+ bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb|
+ bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb|
+ |
+ ]])
+ -- Same for "ge".
+ feed('$ge')
+ screen:expect([[
+ 2 ^b bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb|
+ bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb|
+ bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb|
+ bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb|
+ bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb|
+ bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb|
+ bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb|
+ |
+ ]])
+ end)
end)
diff --git a/test/functional/legacy/edit_spec.lua b/test/functional/legacy/edit_spec.lua
index 362d33a0fd..939999e21b 100644
--- a/test/functional/legacy/edit_spec.lua
+++ b/test/functional/legacy/edit_spec.lua
@@ -43,7 +43,7 @@ describe('edit', function()
{0:~ }|
{0:~ }|
{0:~ }|
- {2:-- INSERT -} |
+ {2:-- INSERT --}|
]])
feed('=')
screen:expect([[
@@ -55,4 +55,68 @@ describe('edit', function()
=^ |
]])
end)
+
+ -- oldtest: Test_edit_ctrl_r_failed()
+ it('positioning cursor after CTRL-R expression failed', function()
+ local screen = Screen.new(60, 6)
+ screen:set_default_attr_ids({
+ [0] = {bold = true, foreground = Screen.colors.Blue}, -- NonText
+ [1] = {foreground = Screen.colors.Blue}, -- SpecialKey
+ [2] = {foreground = Screen.colors.SlateBlue},
+ [3] = {bold = true}, -- ModeMsg
+ [4] = {reverse = true, bold = true}, -- MsgSeparator
+ [5] = {background = Screen.colors.Red, foreground = Screen.colors.White}, -- ErrorMsg
+ [6] = {foreground = Screen.colors.SeaGreen, bold = true}, -- MoreMsg
+ })
+ screen:attach()
+
+ feed('i<C-R>')
+ screen:expect([[
+ {1:^"} |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {3:-- INSERT --} |
+ ]])
+ feed('={}')
+ screen:expect([[
+ {1:"} |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ ={2:{}}^ |
+ ]])
+ -- trying to insert a dictionary produces an error
+ feed('<CR>')
+ screen:expect([[
+ {1:"} |
+ {0:~ }|
+ {4: }|
+ ={2:{}} |
+ {5:E731: Using a Dictionary as a String} |
+ {6:Press ENTER or type command to continue}^ |
+ ]])
+
+ feed(':')
+ screen:expect([[
+ :^ |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {3:-- INSERT --} |
+ ]])
+ -- ending Insert mode should put the cursor back on the ':'
+ feed('<Esc>')
+ screen:expect([[
+ ^: |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ |
+ ]])
+ end)
end)
diff --git a/test/functional/legacy/eval_spec.lua b/test/functional/legacy/eval_spec.lua
index b5e45a86c1..c531c59fd1 100644
--- a/test/functional/legacy/eval_spec.lua
+++ b/test/functional/legacy/eval_spec.lua
@@ -613,15 +613,15 @@ describe('eval', function()
Executing call setreg(1, 2, 3, 4)
Vim(call):E118: Too many arguments for function: setreg
Executing call setreg([], 2)
- Vim(call):E730: using List as a String
+ Vim(call):E730: Using a List as a String
Executing call setreg(1, 2, [])
- Vim(call):E730: using List as a String
+ Vim(call):E730: Using a List as a String
Executing call setreg("/", ["1", "2"])
- Vim(call):E883: search pattern and expression register may not contain two or more lines
+ Vim(call):E883: Search pattern and expression register may not contain two or more lines
Executing call setreg("=", ["1", "2"])
- Vim(call):E883: search pattern and expression register may not contain two or more lines
+ Vim(call):E883: Search pattern and expression register may not contain two or more lines
Executing call setreg(1, ["", "", [], ""])
- Vim(call):E730: using List as a String]])
+ Vim(call):E730: Using a List as a String]])
end)
it('function name not starting with a capital', function()
diff --git a/test/functional/legacy/filechanged_spec.lua b/test/functional/legacy/filechanged_spec.lua
index cea1d6ac30..c8e772f597 100644
--- a/test/functional/legacy/filechanged_spec.lua
+++ b/test/functional/legacy/filechanged_spec.lua
@@ -12,8 +12,8 @@ describe('file changed dialog', function()
before_each(function()
clear()
meths.ui_attach(80, 24, {})
- meths.set_option('autoread', false)
- meths.set_option('fsync', true)
+ meths.set_option_value('autoread', false, {})
+ meths.set_option_value('fsync', true, {})
end)
it('works', function()
diff --git a/test/functional/legacy/glob2regpat_spec.lua b/test/functional/legacy/glob2regpat_spec.lua
index 029d95206e..de304f3e4b 100644
--- a/test/functional/legacy/glob2regpat_spec.lua
+++ b/test/functional/legacy/glob2regpat_spec.lua
@@ -1,16 +1,10 @@
--- Tests for signs
-
local helpers = require('test.functional.helpers')(after_each)
-local clear, exc_exec = helpers.clear, helpers.exc_exec
+local clear = helpers.clear
local eq, eval = helpers.eq, helpers.eval
describe('glob2regpat()', function()
before_each(clear)
- it('handles invalid input', function()
- eq('Vim(call):E806: using Float as a String',
- exc_exec('call glob2regpat(1.33)'))
- end)
it('returns ^$ for empty input', function()
eq('^$', eval("glob2regpat('')"))
end)
diff --git a/test/functional/legacy/051_highlight_spec.lua b/test/functional/legacy/highlight_spec.lua
index d3f2897493..0a130f1607 100644
--- a/test/functional/legacy/051_highlight_spec.lua
+++ b/test/functional/legacy/highlight_spec.lua
@@ -1,5 +1,3 @@
--- Tests for ":highlight".
-
local Screen = require('test.functional.ui.screen')
local helpers = require('test.functional.helpers')(after_each)
local clear, feed = helpers.clear, helpers.feed
@@ -8,10 +6,11 @@ local eq = helpers.eq
local poke_eventloop = helpers.poke_eventloop
local exc_exec = helpers.exc_exec
local feed_command = helpers.feed_command
+local exec = helpers.exec
-describe(':highlight', function()
- setup(clear)
+before_each(clear)
+describe(':highlight', function()
it('is working', function()
local screen = Screen.new(35, 10)
screen:attach()
@@ -94,3 +93,30 @@ describe(':highlight', function()
Group3 xxx cleared]])
end)
end)
+
+describe('Visual selection highlight', function()
+ -- oldtest: Test_visual_sbr()
+ it("when 'showbreak' is set", function()
+ local screen = Screen.new(60, 6)
+ screen:set_default_attr_ids({
+ [0] = {bold = true, foreground = Screen.colors.Blue}, -- NonText
+ [1] = {background = Screen.colors.LightGrey}, -- Visual
+ [2] = {bold = true}, -- ModeMsg
+ })
+ screen:attach()
+ exec([[
+ set showbreak=>
+ call setline(1, 'Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.')
+ exe "normal! z1\<CR>"
+ ]])
+ feed('v$')
+ screen:expect([[
+ {0:>}{1:n, no sea takimata sanctus est Lorem ipsum dolor sit amet.}^ |
+ |
+ |
+ |
+ |
+ {2:-- VISUAL --} |
+ ]])
+ end)
+end)
diff --git a/test/functional/legacy/matchparen_spec.lua b/test/functional/legacy/matchparen_spec.lua
new file mode 100644
index 0000000000..22d9247698
--- /dev/null
+++ b/test/functional/legacy/matchparen_spec.lua
@@ -0,0 +1,116 @@
+local helpers = require('test.functional.helpers')(after_each)
+
+local Screen = require('test.functional.ui.screen')
+local clear = helpers.clear
+local exec = helpers.exec
+local feed = helpers.feed
+
+describe('matchparen', function()
+ before_each(clear)
+
+ -- oldtest: Test_visual_block_scroll()
+ it('redraws properly after scrolling with scrolloff=1', function()
+ local screen = Screen.new(30, 7)
+ screen:attach()
+ screen:set_default_attr_ids({
+ [1] = {bold = true},
+ [2] = {background = Screen.colors.LightGrey},
+ })
+
+ exec([[
+ source $VIMRUNTIME/plugin/matchparen.vim
+ set scrolloff=1
+ call setline(1, ['a', 'b', 'c', 'd', 'e', '', '{', '}', '{', 'f', 'g', '}'])
+ call cursor(5, 1)
+ ]])
+
+ feed('V<c-d><c-d>')
+ screen:expect([[
+ {2:{} |
+ {2:}} |
+ {2:{} |
+ {2:f} |
+ ^g |
+ } |
+ {1:-- VISUAL LINE --} |
+ ]])
+ end)
+
+ -- oldtest: Test_matchparen_clear_highlight()
+ it('matchparen highlight is cleared when switching buffer', function()
+ local screen = Screen.new(20, 5)
+ screen:set_default_attr_ids({
+ [0] = {bold = true, foreground = Screen.colors.Blue},
+ [1] = {background = Screen.colors.Cyan},
+ })
+ screen:attach()
+
+ local screen1 = [[
+ {1:^()} |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ |
+ ]]
+ local screen2 = [[
+ ^aa |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ |
+ ]]
+
+ exec([[
+ source $VIMRUNTIME/plugin/matchparen.vim
+ set hidden
+ call setline(1, ['()'])
+ normal 0
+ ]])
+ screen:expect(screen1)
+
+ exec([[
+ enew
+ exe "normal iaa\<Esc>0"
+ ]])
+ screen:expect(screen2)
+
+ feed('<C-^>')
+ screen:expect(screen1)
+
+ feed('<C-^>')
+ screen:expect(screen2)
+ end)
+
+ -- oldtest: Test_matchparen_pum_clear()
+ it('is cleared when completion popup is shown', function()
+ local screen = Screen.new(30, 9)
+ screen:attach()
+ screen:set_default_attr_ids({
+ [0] = {bold = true, foreground = Screen.colors.Blue};
+ [1] = {background = Screen.colors.Plum1};
+ [2] = {background = Screen.colors.Grey};
+ [3] = {bold = true};
+ [4] = {bold = true, foreground = Screen.colors.SeaGreen};
+ })
+
+ exec([[
+ source $VIMRUNTIME/plugin/matchparen.vim
+ set completeopt=menuone
+ call setline(1, ['aa', 'aaa', 'aaaa', '(a)'])
+ call cursor(4, 3)
+ ]])
+
+ feed('i<C-X><C-N><C-N>')
+ screen:expect{grid=[[
+ aa |
+ aaa |
+ aaaa |
+ (aaa^) |
+ {1: aa }{0: }|
+ {2: aaa }{0: }|
+ {1: aaaa }{0: }|
+ {0:~ }|
+ {3:-- }{4:match 2 of 3} |
+ ]]}
+ end)
+end)
diff --git a/test/functional/legacy/memory_usage_spec.lua b/test/functional/legacy/memory_usage_spec.lua
index 59839157ea..5f722e5190 100644
--- a/test/functional/legacy/memory_usage_spec.lua
+++ b/test/functional/legacy/memory_usage_spec.lua
@@ -11,14 +11,10 @@ local load_adjust = helpers.load_adjust
local write_file = helpers.write_file
local is_os = helpers.is_os
local is_ci = helpers.is_ci
-
-local function isasan()
- local version = eval('execute("version")')
- return version:match('-fsanitize=[a-z,]*address')
-end
+local is_asan = helpers.is_asan
clear()
-if isasan() then
+if is_asan() then
pending('ASAN build is difficult to estimate memory usage', function() end)
return
elseif is_os('win') then
diff --git a/test/functional/legacy/messages_spec.lua b/test/functional/legacy/messages_spec.lua
index 71a53c8381..e0cc1dc79c 100644
--- a/test/functional/legacy/messages_spec.lua
+++ b/test/functional/legacy/messages_spec.lua
@@ -6,6 +6,7 @@ local exec = helpers.exec
local feed = helpers.feed
local meths = helpers.meths
local nvim_dir = helpers.nvim_dir
+local assert_alive = helpers.assert_alive
before_each(clear)
@@ -49,6 +50,71 @@ describe('messages', function()
]])
end)
+ -- oldtest: Test_message_not_cleared_after_mode()
+ it('clearing mode does not remove message', function()
+ screen = Screen.new(60, 10)
+ screen:set_default_attr_ids({
+ [0] = {bold = true, foreground = Screen.colors.Blue}, -- NonText
+ [1] = {background = Screen.colors.Red, foreground = Screen.colors.White}, -- ErrorMsg
+ })
+ screen:attach()
+ exec([[
+ nmap <silent> gx :call DebugSilent('normal')<CR>
+ vmap <silent> gx :call DebugSilent('visual')<CR>
+ function DebugSilent(arg)
+ echomsg "from DebugSilent" a:arg
+ endfunction
+ set showmode
+ set cmdheight=1
+ call setline(1, ['one', 'NoSuchFile', 'three'])
+ ]])
+
+ feed('gx')
+ screen:expect([[
+ ^one |
+ NoSuchFile |
+ three |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ from DebugSilent normal |
+ ]])
+
+ -- removing the mode message used to also clear the intended message
+ feed('vEgx')
+ screen:expect([[
+ ^one |
+ NoSuchFile |
+ three |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ from DebugSilent visual |
+ ]])
+
+ -- removing the mode message used to also clear the error message
+ command('set cmdheight=2')
+ feed('2GvEgf')
+ screen:expect([[
+ one |
+ NoSuchFil^e |
+ three |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ from DebugSilent visual |
+ {1:E447: Can't find file "NoSuchFile" in path} |
+ ]])
+ end)
+
describe('more prompt', function()
before_each(function()
command('set more')
@@ -361,9 +427,9 @@ describe('messages', function()
screen:attach()
command('cd '..nvim_dir)
- meths.set_option('shell', './shell-test')
- meths.set_option('shellcmdflag', 'REP 20')
- meths.set_option('shellxquote', '') -- win: avoid extra quotes
+ meths.set_option_value('shell', './shell-test', {})
+ meths.set_option_value('shellcmdflag', 'REP 20', {})
+ meths.set_option_value('shellxquote', '', {}) -- win: avoid extra quotes
-- display a page and go back, results in exactly the same view
feed([[:4 verbose echo system('foo')<CR>]])
@@ -661,6 +727,46 @@ describe('messages', function()
]])
end)
+ -- oldtest: Test_fileinfo_tabpage_cmdheight()
+ it("fileinfo works when 'cmdheight' has just decreased", function()
+ screen = Screen.new(40, 6)
+ screen:set_default_attr_ids({
+ [0] = {bold = true, foreground = Screen.colors.Blue}; -- NonText
+ [1] = {bold = true}; -- TabLineSel
+ [2] = {underline = true, background = Screen.colors.LightGrey}; -- TabLine
+ [3] = {reverse = true}; -- TabLineFill
+ })
+ screen:attach()
+
+ exec([[
+ set shortmess-=o
+ set shortmess-=O
+ set shortmess-=F
+ tabnew
+ set cmdheight=2
+ ]])
+ command('mode') -- FIXME: bottom is invalid after scrolling
+ screen:expect([[
+ {2: [No Name] }{1: [No Name] }{3: }{2:X}|
+ ^ |
+ {0:~ }|
+ {0:~ }|
+ |
+ |
+ ]])
+
+ feed(':tabprev | edit Xfileinfo.txt<CR>')
+ screen:expect([[
+ {1: Xfileinfo.txt }{2: [No Name] }{3: }{2:X}|
+ ^ |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ "Xfileinfo.txt" [New] |
+ ]])
+ assert_alive()
+ end)
+
-- oldtest: Test_fileinfo_after_echo()
it('fileinfo does not overwrite echo message vim-patch:8.2.4156', function()
screen = Screen.new(40, 6)
@@ -668,6 +774,7 @@ describe('messages', function()
[0] = {bold = true, foreground = Screen.colors.Blue}, -- NonText
})
screen:attach()
+
exec([[
set shortmess-=F
@@ -681,6 +788,7 @@ describe('messages', function()
autocmd CursorHold * buf b.txt | w | echo "'b' written"
]])
+
command('set updatetime=50')
feed('0$')
screen:expect([[
@@ -693,4 +801,9 @@ describe('messages', function()
]])
os.remove('b.txt')
end)
+
+ it('no crash when truncating overlong message', function()
+ pcall(command, 'source test/old/testdir/crash/vim_msg_trunc_poc')
+ assert_alive()
+ end)
end)
diff --git a/test/functional/legacy/move_spec.lua b/test/functional/legacy/move_spec.lua
new file mode 100644
index 0000000000..855996da8f
--- /dev/null
+++ b/test/functional/legacy/move_spec.lua
@@ -0,0 +1,49 @@
+local helpers = require('test.functional.helpers')(after_each)
+local Screen = require('test.functional.ui.screen')
+local clear = helpers.clear
+local feed = helpers.feed
+local funcs = helpers.funcs
+
+before_each(clear)
+
+describe(':move', function()
+ -- oldtest: Test_move_undo()
+ it('redraws correctly when undone', function()
+ local screen = Screen.new(60, 10)
+ screen:set_default_attr_ids({
+ [0] = {bold = true, foreground = Screen.colors.Blue}, -- NonText
+ })
+ screen:attach()
+
+ funcs.setline(1, {'First', 'Second', 'Third', 'Fourth'})
+ feed('gg:move +1<CR>')
+ screen:expect([[
+ Second |
+ ^First |
+ Third |
+ Fourth |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ :move +1 |
+ ]])
+
+ -- here the display would show the last few lines scrolled down
+ feed('u')
+ feed(':<Esc>')
+ screen:expect([[
+ ^First |
+ Second |
+ Third |
+ Fourth |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ |
+ ]])
+ end)
+end)
diff --git a/test/functional/legacy/normal_spec.lua b/test/functional/legacy/normal_spec.lua
new file mode 100644
index 0000000000..ba875460f5
--- /dev/null
+++ b/test/functional/legacy/normal_spec.lua
@@ -0,0 +1,41 @@
+local helpers = require('test.functional.helpers')(after_each)
+local Screen = require('test.functional.ui.screen')
+local clear = helpers.clear
+local exec = helpers.exec
+
+before_each(clear)
+
+describe('normal', function()
+ -- oldtest: Test_normal_j_below_botline()
+ it([["j" does not skip lines when scrolling below botline and 'foldmethod' is not "manual"]], function()
+ local screen = Screen.new(40, 19)
+ screen:attach()
+ screen:set_default_attr_ids({{foreground = Screen.colors.Brown}})
+ exec([[
+ set number foldmethod=diff scrolloff=0
+ call setline(1, map(range(1, 9), 'repeat(v:val, 200)'))
+ norm Lj
+ ]])
+ screen:expect([[
+ {1: 2 }222222222222222222222222222222222222|
+ {1: }222222222222222222222222222222222222|
+ {1: }222222222222222222222222222222222222|
+ {1: }222222222222222222222222222222222222|
+ {1: }222222222222222222222222222222222222|
+ {1: }22222222222222222222 |
+ {1: 3 }333333333333333333333333333333333333|
+ {1: }333333333333333333333333333333333333|
+ {1: }333333333333333333333333333333333333|
+ {1: }333333333333333333333333333333333333|
+ {1: }333333333333333333333333333333333333|
+ {1: }33333333333333333333 |
+ {1: 4 }^444444444444444444444444444444444444|
+ {1: }444444444444444444444444444444444444|
+ {1: }444444444444444444444444444444444444|
+ {1: }444444444444444444444444444444444444|
+ {1: }444444444444444444444444444444444444|
+ {1: }44444444444444444444 |
+ |
+ ]])
+ end)
+end)
diff --git a/test/functional/legacy/options_spec.lua b/test/functional/legacy/options_spec.lua
index bd14f3bc53..ce46ea013d 100644
--- a/test/functional/legacy/options_spec.lua
+++ b/test/functional/legacy/options_spec.lua
@@ -1,4 +1,4 @@
--- See also: src/nvim/testdir/test_options.vim
+-- See also: test/old/testdir/test_options.vim
local helpers = require('test.functional.helpers')(after_each)
local command, clear = helpers.command, helpers.clear
local source, expect = helpers.source, helpers.expect
diff --git a/test/functional/legacy/prompt_buffer_spec.lua b/test/functional/legacy/prompt_buffer_spec.lua
index 63338b8dba..5c3f8a6f8c 100644
--- a/test/functional/legacy/prompt_buffer_spec.lua
+++ b/test/functional/legacy/prompt_buffer_spec.lua
@@ -3,10 +3,11 @@ local Screen = require('test.functional.ui.screen')
local feed = helpers.feed
local source = helpers.source
local clear = helpers.clear
-local feed_command = helpers.feed_command
+local command = helpers.command
local poke_eventloop = helpers.poke_eventloop
local meths = helpers.meths
local eq = helpers.eq
+local neq = helpers.neq
describe('prompt buffer', function()
local screen
@@ -15,65 +16,78 @@ describe('prompt buffer', function()
clear()
screen = Screen.new(25, 10)
screen:attach()
+ command('set laststatus=0 nohidden')
+ end)
+
+ local function source_script()
source([[
func TextEntered(text)
if a:text == "exit"
+ " Reset &modified to allow the buffer to be closed.
set nomodified
stopinsert
close
else
+ " Add the output above the current prompt.
call append(line("$") - 1, 'Command: "' . a:text . '"')
+ " Reset &modified to allow the buffer to be closed.
set nomodified
call timer_start(20, {id -> TimerFunc(a:text)})
endif
endfunc
func TimerFunc(text)
+ " Add the output above the current prompt.
call append(line("$") - 1, 'Result: "' . a:text .'"')
+ " Reset &modified to allow the buffer to be closed.
+ set nomodified
endfunc
func SwitchWindows()
call timer_start(0, {-> execute("wincmd p", "")})
endfunc
- ]])
- feed_command("set noshowmode | set laststatus=0")
- feed_command("call setline(1, 'other buffer')")
- feed_command("new")
- feed_command("set buftype=prompt")
- feed_command("call prompt_setcallback(bufnr(''), function('TextEntered'))")
- feed_command("eval bufnr('')->prompt_setprompt('cmd: ')")
- end)
- after_each(function()
- screen:detach()
- end)
-
- it('works', function()
+ call setline(1, "other buffer")
+ set nomodified
+ new
+ set buftype=prompt
+ call prompt_setcallback(bufnr(''), function("TextEntered"))
+ eval bufnr("")->prompt_setprompt("cmd: ")
+ startinsert
+ ]])
screen:expect([[
- ^ |
+ cmd: ^ |
~ |
~ |
~ |
- [Prompt] |
+ [Prompt] [+] |
other buffer |
~ |
~ |
~ |
- |
+ -- INSERT -- |
]])
- feed("i")
+ end
+
+ after_each(function()
+ screen:detach()
+ end)
+
+ -- oldtest: Test_prompt_basic()
+ it('works', function()
+ source_script()
feed("hello\n")
screen:expect([[
cmd: hello |
Command: "hello" |
Result: "hello" |
cmd: ^ |
- [Prompt] [+] |
+ [Prompt] |
other buffer |
~ |
~ |
~ |
- |
+ -- INSERT -- |
]])
feed("exit\n")
screen:expect([[
@@ -90,20 +104,9 @@ describe('prompt buffer', function()
]])
end)
+ -- oldtest: Test_prompt_editing()
it('editing', function()
- screen:expect([[
- ^ |
- ~ |
- ~ |
- ~ |
- [Prompt] |
- other buffer |
- ~ |
- ~ |
- ~ |
- |
- ]])
- feed("i")
+ source_script()
feed("hello<BS><BS>")
screen:expect([[
cmd: hel^ |
@@ -115,7 +118,7 @@ describe('prompt buffer', function()
~ |
~ |
~ |
- |
+ -- INSERT -- |
]])
feed("<Left><Left><Left><BS>-")
screen:expect([[
@@ -128,7 +131,7 @@ describe('prompt buffer', function()
~ |
~ |
~ |
- |
+ -- INSERT -- |
]])
feed("<C-O>lz")
screen:expect([[
@@ -141,7 +144,7 @@ describe('prompt buffer', function()
~ |
~ |
~ |
- |
+ -- INSERT -- |
]])
feed("<End>x")
screen:expect([[
@@ -154,7 +157,7 @@ describe('prompt buffer', function()
~ |
~ |
~ |
- |
+ -- INSERT -- |
]])
feed("<C-U>exit\n")
screen:expect([[
@@ -171,21 +174,9 @@ describe('prompt buffer', function()
]])
end)
+ -- oldtest: Test_prompt_switch_windows()
it('switch windows', function()
- feed_command("set showmode")
- feed("i")
- screen:expect([[
- cmd: ^ |
- ~ |
- ~ |
- ~ |
- [Prompt] [+] |
- other buffer |
- ~ |
- ~ |
- ~ |
- -- INSERT -- |
- ]])
+ source_script()
feed("<C-O>:call SwitchWindows()<CR>")
screen:expect{grid=[[
cmd: |
@@ -227,13 +218,49 @@ describe('prompt buffer', function()
]])
end)
+ -- oldtest: Test_prompt_while_writing_to_hidden_buffer()
it('keeps insert mode after aucmd_restbuf in callback', function()
+ source_script()
source [[
let s:buf = nvim_create_buf(1, 1)
call timer_start(0, {-> nvim_buf_set_lines(s:buf, -1, -1, 0, ['walrus'])})
- startinsert
]]
poke_eventloop()
- eq({ mode = "i", blocking = false }, meths.get_mode())
+ eq({ mode = 'i', blocking = false }, meths.get_mode())
+ end)
+
+ -- oldtest: Test_prompt_appending_while_hidden()
+ it('accessing hidden prompt buffer does not start insert mode', function()
+ local prev_win = meths.get_current_win()
+ source([[
+ new prompt
+ set buftype=prompt
+ set bufhidden=hide
+
+ func s:TextEntered(text)
+ if a:text == 'exit'
+ close
+ endif
+ let g:entered = a:text
+ endfunc
+ call prompt_setcallback(bufnr(), function('s:TextEntered'))
+
+ func DoAppend()
+ call appendbufline('prompt', '$', 'Test')
+ return ''
+ endfunc
+ ]])
+ feed('asomething<CR>')
+ eq('something', meths.get_var('entered'))
+ neq(prev_win, meths.get_current_win())
+ feed('exit<CR>')
+ eq(prev_win, meths.get_current_win())
+ eq({ mode = 'n', blocking = false }, meths.get_mode())
+ command('call DoAppend()')
+ eq({ mode = 'n', blocking = false }, meths.get_mode())
+ feed('i')
+ eq({ mode = 'i', blocking = false }, meths.get_mode())
+ command('call DoAppend()')
+ eq({ mode = 'i', blocking = false }, meths.get_mode())
end)
end)
diff --git a/test/functional/legacy/put_spec.lua b/test/functional/legacy/put_spec.lua
index 3ddf65490e..4a42a1c8a3 100644
--- a/test/functional/legacy/put_spec.lua
+++ b/test/functional/legacy/put_spec.lua
@@ -1,4 +1,5 @@
local helpers = require('test.functional.helpers')(after_each)
+local Screen = require('test.functional.ui.screen')
local clear = helpers.clear
local exec_lua = helpers.exec_lua
local meths = helpers.meths
@@ -42,4 +43,56 @@ describe('put', function()
bwipe!
]]
end)
+
+ -- oldtest: Test_put_other_window()
+ it('above topline in buffer in two splits', function()
+ local screen = Screen.new(80, 10)
+ screen:attach()
+ source([[
+ 40vsplit
+ 0put ='some text at the top'
+ put =' one more text'
+ put =' two more text'
+ put =' three more text'
+ put =' four more text'
+ ]])
+
+ screen:expect([[
+ some text at the top │some text at the top |
+ one more text │ one more text |
+ two more text │ two more text |
+ three more text │ three more text |
+ ^four more text │ four more text |
+ │ |
+ ~ │~ |
+ ~ │~ |
+ [No Name] [+] [No Name] [+] |
+ |
+ ]])
+ end)
+
+ -- oldtest: Test_put_in_last_displayed_line()
+ it('in last displayed line', function()
+ local screen = Screen.new(75, 10)
+ screen:attach()
+ source([[
+ autocmd CursorMoved * eval line('w$')
+ let @a = 'x'->repeat(&columns * 2 - 2)
+ eval range(&lines)->setline(1)
+ call feedkeys('G"ap')
+ ]])
+
+ screen:expect([[
+ 2 |
+ 3 |
+ 4 |
+ 5 |
+ 6 |
+ 7 |
+ 8 |
+ 9xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx|
+ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx^x |
+ |
+ ]])
+ end)
end)
diff --git a/test/functional/legacy/scroll_opt_spec.lua b/test/functional/legacy/scroll_opt_spec.lua
new file mode 100644
index 0000000000..8ac1141c2b
--- /dev/null
+++ b/test/functional/legacy/scroll_opt_spec.lua
@@ -0,0 +1,1193 @@
+local helpers = require('test.functional.helpers')(after_each)
+local Screen = require('test.functional.ui.screen')
+local clear = helpers.clear
+local exec = helpers.exec
+local feed = helpers.feed
+local assert_alive = helpers.assert_alive
+
+before_each(clear)
+
+describe('smoothscroll', function()
+ local screen
+
+ before_each(function()
+ screen = Screen.new(40, 12)
+ screen:attach()
+ end)
+
+ -- oldtest: Test_CtrlE_CtrlY_stop_at_end()
+ it('disabled does not break <C-E> and <C-Y> stop at end', function()
+ exec([[
+ enew
+ call setline(1, ['one', 'two'])
+ set number
+ ]])
+ feed('<C-Y>')
+ screen:expect({any = " 1 ^one"})
+ feed('<C-E><C-E><C-E>')
+ screen:expect({any = " 2 ^two"})
+ end)
+
+ -- oldtest: Test_smoothscroll_CtrlE_CtrlY()
+ it('works with <C-E> and <C-E>', function()
+ exec([[
+ call setline(1, [ 'line one', 'word '->repeat(20), 'line three', 'long word '->repeat(7), 'line', 'line', 'line', ])
+ set smoothscroll scrolloff=5
+ :5
+ ]])
+ local s1 = [[
+ word word word word word word word word |
+ word word word word word word word word |
+ word word word word |
+ line three |
+ long word long word long word long word |
+ long word long word long word |
+ ^line |
+ line |
+ line |
+ ~ |
+ ~ |
+ |
+ ]]
+ local s2 = [[
+ <<<d word word word word word word word |
+ word word word word |
+ line three |
+ long word long word long word long word |
+ long word long word long word |
+ ^line |
+ line |
+ line |
+ ~ |
+ ~ |
+ ~ |
+ |
+ ]]
+ local s3 = [[
+ <<<d word word word |
+ line three |
+ long word long word long word long word |
+ long word long word long word |
+ ^line |
+ line |
+ line |
+ ~ |
+ ~ |
+ ~ |
+ ~ |
+ |
+ ]]
+ local s4 = [[
+ line three |
+ long word long word long word long word |
+ long word long word long word |
+ line |
+ line |
+ ^line |
+ ~ |
+ ~ |
+ ~ |
+ ~ |
+ ~ |
+ |
+ ]]
+ local s5 = [[
+ <<<d word word word |
+ line three |
+ long word long word long word long word |
+ long word long word long word |
+ line |
+ line |
+ ^line |
+ ~ |
+ ~ |
+ ~ |
+ ~ |
+ |
+ ]]
+ local s6 = [[
+ <<<d word word word word word word word |
+ word word word word |
+ line three |
+ long word long word long word long word |
+ long word long word long word |
+ line |
+ line |
+ ^line |
+ ~ |
+ ~ |
+ ~ |
+ |
+ ]]
+ local s7 = [[
+ word word word word word word word word |
+ word word word word word word word word |
+ word word word word |
+ line three |
+ long word long word long word long word |
+ long word long word long word |
+ line |
+ line |
+ ^line |
+ ~ |
+ ~ |
+ |
+ ]]
+ local s8 = [[
+ line one |
+ word word word word word word word word |
+ word word word word word word word word |
+ word word word word |
+ line three |
+ long word long word long word long word |
+ long word long word long word |
+ line |
+ line |
+ ^line |
+ ~ |
+ |
+ ]]
+ feed('<C-E>')
+ screen:expect(s1)
+ feed('<C-E>')
+ screen:expect(s2)
+ feed('<C-E>')
+ screen:expect(s3)
+ feed('<C-E>')
+ screen:expect(s4)
+ feed('<C-Y>')
+ screen:expect(s5)
+ feed('<C-Y>')
+ screen:expect(s6)
+ feed('<C-Y>')
+ screen:expect(s7)
+ feed('<C-Y>')
+ screen:expect(s8)
+ exec('set foldmethod=indent')
+ -- move the cursor so we can reuse the same dumps
+ feed('5G<C-E>')
+ screen:expect(s1)
+ feed('<C-E>')
+ screen:expect(s2)
+ feed('7G<C-Y>')
+ screen:expect(s7)
+ feed('<C-Y>')
+ screen:expect(s8)
+ end)
+
+ -- oldtest: Test_smoothscroll_multibyte()
+ it('works with multibyte characters', function()
+ screen:try_resize(40, 6)
+ exec([[
+ set scrolloff=0 smoothscroll
+ call setline(1, [repeat('ϛ', 45), repeat('2', 36)])
+ exe "normal G35l\<C-E>k"
+ ]])
+ screen:expect([[
+ ϛϛϛϛϛϛϛϛϛϛϛϛϛϛϛϛϛϛϛϛϛϛϛϛϛϛϛϛϛϛϛϛϛϛϛ^ϛϛϛϛϛ|
+ ϛϛϛϛϛ |
+ 222222222222222222222222222222222222 |
+ ~ |
+ ~ |
+ |
+ ]])
+ end)
+
+ -- oldtest: Test_smoothscroll_number()
+ it("works 'number' and 'cpo'+=n", function()
+ exec([[
+ call setline(1, [ 'one ' .. 'word '->repeat(20), 'two ' .. 'long word '->repeat(7), 'line', 'line', 'line', ])
+ set smoothscroll scrolloff=5
+ set splitkeep=topline
+ set number cpo+=n
+ :3
+ func g:DoRel()
+ set number relativenumber scrolloff=0
+ :%del
+ call setline(1, [ 'one', 'very long text '->repeat(12), 'three', ])
+ exe "normal 2Gzt\<C-E>"
+ endfunc
+ ]])
+ screen:expect([[
+ 1 one word word word word word word wo|
+ rd word word word word word word word wo|
+ rd word word word word word |
+ 2 two long word long word long word lo|
+ ng word long word long word long word |
+ 3 ^line |
+ 4 line |
+ 5 line |
+ ~ |
+ ~ |
+ ~ |
+ |
+ ]])
+ feed('<C-E>')
+ screen:expect([[
+ <<<word word word word word word word wo|
+ rd word word word word word |
+ 2 two long word long word long word lo|
+ ng word long word long word long word |
+ 3 ^line |
+ 4 line |
+ 5 line |
+ ~ |
+ ~ |
+ ~ |
+ ~ |
+ |
+ ]])
+ feed('<C-E>')
+ screen:expect([[
+ <<<word word word word word |
+ 2 two long word long word long word lo|
+ ng word long word long word long word |
+ 3 ^line |
+ 4 line |
+ 5 line |
+ ~ |
+ ~ |
+ ~ |
+ ~ |
+ ~ |
+ |
+ ]])
+ exec('set cpo-=n')
+ screen:expect([[
+ <<< d word word word word word word |
+ 2 two long word long word long word lo|
+ ng word long word long word long wor|
+ d |
+ 3 ^line |
+ 4 line |
+ 5 line |
+ ~ |
+ ~ |
+ ~ |
+ ~ |
+ |
+ ]])
+ feed('<C-Y>')
+ screen:expect([[
+ <<< rd word word word word word word wor|
+ d word word word word word word |
+ 2 two long word long word long word lo|
+ ng word long word long word long wor|
+ d |
+ 3 ^line |
+ 4 line |
+ 5 line |
+ ~ |
+ ~ |
+ ~ |
+ |
+ ]])
+ feed('<C-Y>')
+ screen:expect([[
+ 1 one word word word word word word wo|
+ rd word word word word word word wor|
+ d word word word word word word |
+ 2 two long word long word long word lo|
+ ng word long word long word long wor|
+ d |
+ 3 ^line |
+ 4 line |
+ 5 line |
+ ~ |
+ ~ |
+ |
+ ]])
+ exec('botright split')
+ feed('gg')
+ screen:expect([[
+ 1 one word word word word word word wo|
+ rd word word word word word word wor|
+ d word word word word word word |
+ 2 two long word long word long word@@@|
+ [No Name] [+] |
+ 1 ^one word word word word word word wo|
+ rd word word word word word word wor|
+ d word word word word word word |
+ 2 two long word long word long word lo|
+ ng word long word long word long @@@|
+ [No Name] [+] |
+ |
+ ]])
+ feed('<C-E>')
+ screen:expect([[
+ 1 one word word word word word word wo|
+ rd word word word word word word wor|
+ d word word word word word word |
+ 2 two long word long word long word@@@|
+ [No Name] [+] |
+ <<< rd word word word word word word wor|
+ d word word word word word word^ |
+ 2 two long word long word long word lo|
+ ng word long word long word long wor|
+ d |
+ [No Name] [+] |
+ |
+ ]])
+ feed('<C-E>')
+ screen:expect([[
+ 1 one word word word word word word wo|
+ rd word word word word word word wor|
+ d word word word word word word |
+ 2 two long word long word long word@@@|
+ [No Name] [+] |
+ <<< d word word word word word word^ |
+ 2 two long word long word long word lo|
+ ng word long word long word long wor|
+ d |
+ 3 line |
+ [No Name] [+] |
+ |
+ ]])
+ exec('close')
+ exec('call DoRel()')
+ screen:expect([[
+ 2<<<^ong text very long text very long te|
+ xt very long text very long text ver|
+ y long text very long text very long|
+ text very long text very long text |
+ 1 three |
+ ~ |
+ ~ |
+ ~ |
+ ~ |
+ ~ |
+ ~ |
+ --No lines in buffer-- |
+ ]])
+ end)
+
+ -- oldtest: Test_smoothscroll_list()
+ it("works with list mode", function()
+ screen:try_resize(40, 8)
+ exec([[
+ set smoothscroll scrolloff=0
+ set list
+ call setline(1, [ 'one', 'very long text '->repeat(12), 'three', ])
+ exe "normal 2Gzt\<C-E>"
+ ]])
+ screen:expect([[
+ <<<t very long text very long text very |
+ ^long text very long text very long text |
+ very long text very long text very long |
+ text very long text- |
+ three |
+ ~ |
+ ~ |
+ |
+ ]])
+ exec('set listchars+=precedes:#')
+ screen:expect([[
+ #ext very long text very long text very |
+ ^long text very long text very long text |
+ very long text very long text very long |
+ text very long text- |
+ three |
+ ~ |
+ ~ |
+ |
+ ]])
+ end)
+
+ -- oldtest: Test_smoothscroll_diff_mode()
+ it("works with diff mode", function()
+ screen:try_resize(40, 8)
+ exec([[
+ let text = 'just some text here'
+ call setline(1, text)
+ set smoothscroll
+ diffthis
+ new
+ call setline(1, text)
+ set smoothscroll
+ diffthis
+ ]])
+ screen:expect([[
+ - ^just some text here |
+ ~ |
+ ~ |
+ [No Name] [+] |
+ - just some text here |
+ ~ |
+ [No Name] [+] |
+ |
+ ]])
+ feed('<C-Y>')
+ screen:expect_unchanged()
+ feed('<C-E>')
+ screen:expect_unchanged()
+ end)
+
+ -- oldtest: Test_smoothscroll_wrap_scrolloff_zero()
+ it("works with zero 'scrolloff'", function()
+ screen:try_resize(40, 8)
+ exec([[
+ call setline(1, ['Line' .. (' with some text'->repeat(7))]->repeat(7))
+ set smoothscroll scrolloff=0 display=
+ :3
+ ]])
+ screen:expect([[
+ <<<h some text with some text |
+ Line with some text with some text with |
+ some text with some text with some text |
+ with some text with some text |
+ ^Line with some text with some text with |
+ some text with some text with some text |
+ with some text with some text |
+ |
+ ]])
+ feed('j')
+ screen:expect_unchanged()
+ -- moving cursor down - whole bottom line shows
+ feed('<C-E>j')
+ screen:expect_unchanged()
+ feed('G')
+ screen:expect_unchanged()
+ feed('4<C-Y>G')
+ screen:expect_unchanged()
+ -- moving cursor up right after the <<< marker - no need to show whole line
+ feed('2gj3l2k')
+ screen:expect([[
+ <<<^h some text with some text |
+ Line with some text with some text with |
+ some text with some text with some text |
+ with some text with some text |
+ Line with some text with some text with |
+ some text with some text with some text |
+ with some text with some text |
+ |
+ ]])
+ -- moving cursor up where the <<< marker is - whole top line shows
+ feed('2j02k')
+ screen:expect([[
+ ^Line with some text with some text with |
+ some text with some text with some text |
+ with some text with some text |
+ Line with some text with some text with |
+ some text with some text with some text |
+ with some text with some text |
+ @ |
+ |
+ ]])
+ end)
+
+ -- oldtest: Test_smoothscroll_wrap_long_line()
+ it("adjusts the cursor position in a long line", function()
+ screen:try_resize(40, 6)
+ exec([[
+ call setline(1, ['one', 'two', 'Line' .. (' with lots of text'->repeat(30)) .. ' end', 'four'])
+ set smoothscroll scrolloff=0
+ normal 3G10|zt
+ ]])
+ -- scrolling up, cursor moves screen line down
+ screen:expect([[
+ Line with^ lots of text with lots of text|
+ with lots of text with lots of text wit|
+ h lots of text with lots of text with lo|
+ ts of text with lots of text with lots o|
+ f text with lots of text with lots of te|
+ |
+ ]])
+ feed('<C-E>')
+ screen:expect([[
+ <<<th lot^s of text with lots of text wit|
+ h lots of text with lots of text with lo|
+ ts of text with lots of text with lots o|
+ f text with lots of text with lots of te|
+ xt with lots of text with lots of text w|
+ |
+ ]])
+ feed('5<C-E>')
+ screen:expect([[
+ <<< lots ^of text with lots of text with |
+ lots of text with lots of text with lots|
+ of text with lots of text with lots of |
+ text with lots of text with lots of text|
+ with lots of text with lots of text wit|
+ |
+ ]])
+ -- scrolling down, cursor moves screen line up
+ feed('5<C-Y>')
+ screen:expect([[
+ <<<th lots of text with lots of text wit|
+ h lots of text with lots of text with lo|
+ ts of text with lots of text with lots o|
+ f text with lots of text with lots of te|
+ xt with l^ots of text with lots of text w|
+ |
+ ]])
+ feed('<C-Y>')
+ screen:expect([[
+ Line with lots of text with lots of text|
+ with lots of text with lots of text wit|
+ h lots of text with lots of text with lo|
+ ts of text with lots of text with lots o|
+ f text wi^th lots of text with lots of te|
+ |
+ ]])
+ -- 'scrolloff' set to 1, scrolling up, cursor moves screen line down
+ exec('set scrolloff=1')
+ feed('10|<C-E>')
+ screen:expect([[
+ <<<th lots of text with lots of text wit|
+ h lots of^ text with lots of text with lo|
+ ts of text with lots of text with lots o|
+ f text with lots of text with lots of te|
+ xt with lots of text with lots of text w|
+ |
+ ]])
+ -- 'scrolloff' set to 1, scrolling down, cursor moves screen line up
+ feed('<C-E>gjgj<C-Y>')
+ screen:expect([[
+ <<<th lots of text with lots of text wit|
+ h lots of text with lots of text with lo|
+ ts of text with lots of text with lots o|
+ f text wi^th lots of text with lots of te|
+ xt with lots of text with lots of text w|
+ |
+ ]])
+ -- 'scrolloff' set to 2, scrolling up, cursor moves screen line down
+ exec('set scrolloff=2')
+ feed('10|<C-E>')
+ screen:expect([[
+ <<<th lots of text with lots of text wit|
+ h lots of text with lots of text with lo|
+ ts of tex^t with lots of text with lots o|
+ f text with lots of text with lots of te|
+ xt with lots of text with lots of text w|
+ |
+ ]])
+ -- 'scrolloff' set to 2, scrolling down, cursor moves screen line up
+ feed('<C-E>gj<C-Y>')
+ screen:expect_unchanged()
+ -- 'scrolloff' set to 0, move cursor down one line. Cursor should move properly,
+ -- and since this is a really long line, it will be put on top of the screen.
+ exec('set scrolloff=0')
+ feed('0j')
+ screen:expect([[
+ <<<th lots of text with lots of text wit|
+ h lots of text with lots of text with lo|
+ ts of text with lots of text with lots o|
+ f text with lots of text end |
+ ^four |
+ |
+ ]])
+ -- Test zt/zz/zb that they work properly when a long line is above it
+ feed('zt')
+ screen:expect([[
+ ^four |
+ ~ |
+ ~ |
+ ~ |
+ ~ |
+ |
+ ]])
+ feed('zz')
+ screen:expect([[
+ <<<of text with lots of text with lots o|
+ f text with lots of text end |
+ ^four |
+ ~ |
+ ~ |
+ |
+ ]])
+ feed('zb')
+ screen:expect([[
+ <<<th lots of text with lots of text wit|
+ h lots of text with lots of text with lo|
+ ts of text with lots of text with lots o|
+ f text with lots of text end |
+ ^four |
+ |
+ ]])
+ -- Repeat the step and move the cursor down again.
+ -- This time, use a shorter long line that is barely long enough to span more
+ -- than one window. Note that the cursor is at the bottom this time because
+ -- Vim prefers to do so if we are scrolling a few lines only.
+ exec("call setline(1, ['one', 'two', 'Line' .. (' with lots of text'->repeat(10)) .. ' end', 'four'])")
+ -- Currently visible lines were replaced, test that the lines and cursor
+ -- are correctly displayed.
+ screen:expect_unchanged()
+ feed('3Gztj')
+ screen:expect_unchanged()
+ -- Repeat the step but this time start it when the line is smooth-scrolled by
+ -- one line. This tests that the offset calculation is still correct and
+ -- still end up scrolling down to the next line with cursor at bottom of
+ -- screen.
+ feed('3Gzt<C-E>j')
+ screen:expect([[
+ <<<th lots of text with lots of text wit|
+ h lots of text with lots of text with lo|
+ ts of text with lots of text with lots o|
+ f text with lots of text end |
+ fou^r |
+ |
+ ]])
+ end)
+
+ -- oldtest: Test_smoothscroll_one_long_line()
+ it("scrolls correctly when moving the cursor", function()
+ screen:try_resize(40, 6)
+ exec([[
+ call setline(1, 'with lots of text '->repeat(7))
+ set smoothscroll scrolloff=0
+ ]])
+ local s1 = [[
+ ^with lots of text with lots of text with|
+ lots of text with lots of text with lot|
+ s of text with lots of text with lots of|
+ text |
+ ~ |
+ |
+ ]]
+ screen:expect(s1)
+ feed('<C-E>')
+ screen:expect([[
+ <<<ts of text with lots of text with lot|
+ ^s of text with lots of text with lots of|
+ text |
+ ~ |
+ ~ |
+ |
+ ]])
+ feed('0')
+ screen:expect(s1)
+ end)
+
+ -- oldtest: Test_smoothscroll_long_line_showbreak()
+ it("cursor is not one screen line too far down", function()
+ screen:try_resize(40, 6)
+ -- a line that spans four screen lines
+ exec("call setline(1, 'with lots of text in one line '->repeat(6))")
+ exec('set smoothscroll scrolloff=0 showbreak=+++\\ ')
+ local s1 = [[
+ ^with lots of text in one line with lots |
+ +++ of text in one line with lots of tex|
+ +++ t in one line with lots of text in o|
+ +++ ne line with lots of text in one lin|
+ +++ e with lots of text in one line |
+ |
+ ]]
+ screen:expect(s1)
+ feed('<C-E>')
+ screen:expect([[
+ +++ ^of text in one line with lots of tex|
+ +++ t in one line with lots of text in o|
+ +++ ne line with lots of text in one lin|
+ +++ e with lots of text in one line |
+ ~ |
+ |
+ ]])
+ feed('0')
+ screen:expect(s1)
+ end)
+
+ -- oldtest: Test_smoothscroll_marker_over_double_width_dump()
+ it('marker is drawn over double-width char correctly', function()
+ screen:try_resize(40, 6)
+ exec([[
+ call setline(1, 'a'->repeat(&columns) .. '口'->repeat(10))
+ setlocal smoothscroll
+ ]])
+ screen:expect([[
+ ^aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
+ 口口口口口口口口口口 |
+ ~ |
+ ~ |
+ ~ |
+ |
+ ]])
+ feed('<C-E>')
+ screen:expect([[
+ <<< 口口口口口口口^口 |
+ ~ |
+ ~ |
+ ~ |
+ ~ |
+ |
+ ]])
+ end)
+
+ -- oldtest: Test_smoothscroll_zero_width()
+ it("does not divide by zero with a narrow window", function()
+ screen:try_resize(12, 2)
+ screen:set_default_attr_ids({
+ [1] = {foreground = Screen.colors.Brown},
+ [2] = {foreground = Screen.colors.Blue1, bold = true},
+ })
+ exec([[
+ call setline(1, ['a'->repeat(100)])
+ set wrap smoothscroll number laststatus=0
+ wincmd v
+ wincmd v
+ wincmd v
+ wincmd v
+ ]])
+ screen:expect([[
+ {1: 1^ }│{1: }│{1: }│{1: }│{1: }|
+ |
+ ]])
+ feed('llllllllll<C-W>o')
+ screen:expect([[
+ {2:<<<}{1: }aa^aaaaaa|
+ |
+ ]])
+ end)
+
+ -- oldtest: Test_smoothscroll_ins_lines()
+ it("does not unnecessarily insert lines", function()
+ screen:try_resize(40, 6)
+ exec([=[
+ set wrap smoothscroll scrolloff=0 conceallevel=2 concealcursor=nc
+ call setline(1, [
+ \'line one' .. 'with lots of text in one line '->repeat(2),
+ \'line two',
+ \'line three',
+ \'line four',
+ \'line five'
+ \])
+ ]=])
+ feed('<C-E>gjgk')
+ screen:expect([[
+ <<<lots of text in one line^ |
+ line two |
+ line three |
+ line four |
+ line five |
+ |
+ ]])
+ end)
+
+ -- oldtest: Test_smoothscroll_cursormoved_line()
+ it("does not place the cursor in the command line", function()
+ screen:try_resize(40, 6)
+ exec([=[
+ set smoothscroll
+ call setline(1, [
+ \'',
+ \'_'->repeat(&lines * &columns),
+ \(('_')->repeat(&columns - 2) .. 'xxx')->repeat(2)
+ \])
+ autocmd CursorMoved * eval [line('w0'), line('w$')]
+ call search('xxx')
+ ]=])
+ screen:expect([[
+ <<<_____________________________________|
+ ________________________________________|
+ ______________________________________^xx|
+ x______________________________________x|
+ xx |
+ |
+ ]])
+ end)
+
+ -- oldtest: Test_smoothscroll_eob()
+ it("does not scroll halfway at end of buffer", function()
+ screen:try_resize(40, 10)
+ exec([[
+ set smoothscroll
+ call setline(1, ['']->repeat(100))
+ norm G
+ ]])
+ -- does not scroll halfway when scrolling to end of buffer
+ screen:expect([[
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ ^ |
+ |
+ ]])
+ exec("call setline(92, 'a'->repeat(100))")
+ feed('<C-B>G')
+ -- cursor is not placed below window
+ screen:expect([[
+ <<<aaaaaaaaaaaaaaaaa |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ ^ |
+ |
+ ]])
+ end)
+
+ -- oldtest: Test_smoothscroll_incsearch()
+ it("does not reset skipcol when doing incremental search on the same word", function()
+ screen:try_resize(40, 8)
+ screen:set_default_attr_ids({
+ [1] = {foreground = Screen.colors.Brown},
+ [2] = {foreground = Screen.colors.Blue1, bold = true},
+ [3] = {background = Screen.colors.Yellow1},
+ [4] = {reverse = true},
+ })
+ exec([[
+ set smoothscroll number scrolloff=0 incsearch
+ call setline(1, repeat([''], 20))
+ call setline(11, repeat('a', 100))
+ call setline(14, 'bbbb')
+ ]])
+ feed('/b')
+ screen:expect([[
+ {2:<<<}{1: }aaaaaaaaaaaaaaaaaaaaaaaaaaaa |
+ {1: 12 } |
+ {1: 13 } |
+ {1: 14 }{4:b}{3:bbb} |
+ {1: 15 } |
+ {1: 16 } |
+ {1: 17 } |
+ /b^ |
+ ]])
+ feed('b')
+ screen:expect([[
+ {2:<<<}{1: }aaaaaaaaaaaaaaaaaaaaaaaaaaaa |
+ {1: 12 } |
+ {1: 13 } |
+ {1: 14 }{4:bb}{3:bb} |
+ {1: 15 } |
+ {1: 16 } |
+ {1: 17 } |
+ /bb^ |
+ ]])
+ feed('b')
+ screen:expect([[
+ {2:<<<}{1: }aaaaaaaaaaaaaaaaaaaaaaaaaaaa |
+ {1: 12 } |
+ {1: 13 } |
+ {1: 14 }{4:bbb}b |
+ {1: 15 } |
+ {1: 16 } |
+ {1: 17 } |
+ /bbb^ |
+ ]])
+ feed('b')
+ screen:expect([[
+ {2:<<<}{1: }aaaaaaaaaaaaaaaaaaaaaaaaaaaa |
+ {1: 12 } |
+ {1: 13 } |
+ {1: 14 }{4:bbbb} |
+ {1: 15 } |
+ {1: 16 } |
+ {1: 17 } |
+ /bbbb^ |
+ ]])
+ end)
+
+ -- oldtest: Test_smoothscroll_multi_skipcol()
+ it('scrolling multiple lines and stopping at non-zero skipcol', function()
+ screen:try_resize(40, 10)
+ screen:set_default_attr_ids({
+ [0] = {foreground = Screen.colors.Blue, bold = true},
+ [1] = {background = Screen.colors.Grey90},
+ })
+ exec([[
+ setlocal cursorline scrolloff=0 smoothscroll
+ call setline(1, repeat([''], 8))
+ call setline(3, repeat('a', 50))
+ call setline(4, repeat('a', 50))
+ call setline(7, 'bbb')
+ call setline(8, 'ccc')
+ redraw
+ ]])
+ screen:expect([[
+ {1:^ }|
+ |
+ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
+ aaaaaaaaaa |
+ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
+ aaaaaaaaaa |
+ |
+ |
+ bbb |
+ |
+ ]])
+ feed('3<C-E>')
+ screen:expect([[
+ {0:<<<}{1:aaaaaa^a }|
+ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
+ aaaaaaaaaa |
+ |
+ |
+ bbb |
+ ccc |
+ {0:~ }|
+ {0:~ }|
+ |
+ ]])
+ feed('2<C-E>')
+ screen:expect([[
+ {0:<<<}{1:aaaaaa^a }|
+ |
+ |
+ bbb |
+ ccc |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ |
+ ]])
+ end)
+
+ -- oldtest: Test_smoothscroll_zero_width_scroll_cursor_bot()
+ it('does not divide by zero in zero-width window', function()
+ screen:try_resize(40, 19)
+ screen:set_default_attr_ids({
+ [1] = {foreground = Screen.colors.Brown}; -- LineNr
+ [2] = {bold = true, foreground = Screen.colors.Blue}; -- NonText
+ [3] = {bold = true, reverse = true}; -- StatusLine
+ [4] = {reverse = true}; -- StatusLineNC
+ })
+ exec([[
+ silent normal yy
+ silent normal 19p
+ set cpoptions+=n
+ vsplit
+ vertical resize 0
+ set foldcolumn=1
+ set number
+ set smoothscroll
+ silent normal 20G
+ ]])
+ screen:expect([[
+ {1: }│ |
+ {2:@}│ |
+ {2:@}│ |
+ {2:@}│ |
+ {2:@}│ |
+ {2:@}│ |
+ {2:@}│ |
+ {2:@}│ |
+ {2:@}│ |
+ {2:@}│ |
+ {2:@}│ |
+ {2:@}│ |
+ {2:@}│ |
+ {2:@}│ |
+ {2:@}│ |
+ {2:@}│ |
+ {2:^@}│ |
+ {3:< }{4:[No Name] [+] }|
+ |
+ ]])
+ end)
+
+ -- oldtest: Test_smoothscroll_cursor_top()
+ it('resets skipcol when scrolling cursor to top', function()
+ screen:try_resize(40, 12)
+ exec([[
+ set smoothscroll scrolloff=2
+ new | 11resize | wincmd j
+ call setline(1, ['line1', 'line2', 'line3'->repeat(20), 'line4'])
+ exe "norm G3\<C-E>k"
+ ]])
+ screen:expect([[
+ |
+ [No Name] |
+ line1 |
+ line2 |
+ ^line3line3line3line3line3line3line3line3|
+ line3line3line3line3line3line3line3line3|
+ line3line3line3line3 |
+ line4 |
+ ~ |
+ ~ |
+ [No Name] [+] |
+ |
+ ]])
+ end)
+
+ -- oldtest: Test_smoothscroll_crash()
+ it('does not crash with small window and cpo+=n', function()
+ screen:try_resize(40, 12)
+ exec([[
+ 20 new
+ vsp
+ put =repeat('aaaa', 20)
+ set nu fdc=1 smoothscroll cpo+=n
+ vert resize 0
+ exe "norm! 0\<c-e>"
+ ]])
+ feed('2<C-E>')
+ assert_alive()
+ end)
+
+ it("works with virt_lines above and below", function()
+ screen:try_resize(55, 7)
+ exec([=[
+ call setline(1, ['Line' .. (' with some text'->repeat(7))]->repeat(3))
+ set smoothscroll
+ let ns = nvim_create_namespace('')
+ call nvim_buf_set_extmark(0, ns, 0, 0, {'virt_lines':[[['virt_below1']]]})
+ call nvim_buf_set_extmark(0, ns, 1, 0, {'virt_lines':[[['virt_above1']]],'virt_lines_above':1})
+ call nvim_buf_set_extmark(0, ns, 1, 0, {'virt_lines':[[['virt_below2']]]})
+ call nvim_buf_set_extmark(0, ns, 2, 0, {'virt_lines':[[['virt_above2']]],'virt_lines_above':1})
+ norm ggL
+ ]=])
+ screen:expect([[
+ Line with some text with some text with some text with |
+ some text with some text with some text with some text |
+ virt_below1 |
+ virt_above1 |
+ ^Line with some text with some text with some text with |
+ some text with some text with some text with some text |
+ |
+ ]])
+ feed('<C-E>')
+ screen:expect([[
+ <<<e text with some text with some text with some text |
+ virt_below1 |
+ virt_above1 |
+ ^Line with some text with some text with some text with |
+ some text with some text with some text with some text |
+ virt_below2 |
+ |
+ ]])
+ feed('<C-E>')
+ screen:expect([[
+ virt_below1 |
+ virt_above1 |
+ ^Line with some text with some text with some text with |
+ some text with some text with some text with some text |
+ virt_below2 |
+ virt_above2 |
+ |
+ ]])
+ feed('<C-E>')
+ screen:expect([[
+ virt_above1 |
+ ^Line with some text with some text with some text with |
+ some text with some text with some text with some text |
+ virt_below2 |
+ virt_above2 |
+ Line with some text with some text with some text wi@@@|
+ |
+ ]])
+ feed('<C-E>')
+ screen:expect([[
+ ^Line with some text with some text with some text with |
+ some text with some text with some text with some text |
+ virt_below2 |
+ virt_above2 |
+ Line with some text with some text with some text with |
+ some text with some text with some text with some text |
+ |
+ ]])
+ feed('<C-E>')
+ screen:expect([[
+ <<<e text with some text with some text with some tex^t |
+ virt_below2 |
+ virt_above2 |
+ Line with some text with some text with some text with |
+ some text with some text with some text with some text |
+ ~ |
+ |
+ ]])
+ end)
+
+ it('<<< marker shows with tabline, winbar and splits', function()
+ screen:try_resize(40, 12)
+ exec([[
+ call setline(1, ['Line' .. (' with some text'->repeat(7))]->repeat(7))
+ set smoothscroll scrolloff=0
+ norm sj
+ ]])
+ screen:expect([[
+ <<<e text with some text with some text |
+ with some text with some text |
+ Line with some text with some text with |
+ some text with some text with some text |
+ with some text with some text |
+ [No Name] [+] |
+ <<<e text with some text with some text |
+ ^with some text with some text |
+ Line with some text with some text with |
+ some text with some text with some te@@@|
+ [No Name] [+] |
+ |
+ ]])
+ exec('set showtabline=2')
+ feed('<C-E>')
+ screen:expect([[
+ 2+ [No Name] |
+ <<<e text with some text with some text |
+ with some text with some text |
+ Line with some text with some text with |
+ some text with some text with some text |
+ with some text with some text |
+ [No Name] [+] |
+ <<<e text with some text with some text |
+ ^with some text with some text |
+ Line with some text with some text wi@@@|
+ [No Name] [+] |
+ |
+ ]])
+ exec('set winbar=winbar')
+ feed('<C-w>k<C-E>')
+ screen:expect([[
+ 2+ [No Name] |
+ winbar |
+ <<<e text with some text with some text |
+ ^with some text with some text |
+ Line with some text with some text with |
+ some text with some text with some te@@@|
+ [No Name] [+] |
+ winbar |
+ <<<e text with some text with some text |
+ with some text with some text |
+ [No Name] [+] |
+ |
+ ]])
+ end)
+
+ it('works with very long line', function()
+ screen:set_default_attr_ids({
+ [1] = {foreground = Screen.colors.Brown},
+ [2] = {foreground = Screen.colors.Blue1, bold = true},
+ })
+ exec([[
+ edit test/functional/fixtures/bigfile_oneline.txt
+ setlocal smoothscroll number
+ ]])
+ screen:expect([[
+ {1: 1 }^0000;<control>;Cc;0;BN;;;;;N;NULL;;;|
+ {1: }; 0001;<control>;Cc;0;BN;;;;;N;START|
+ {1: } OF HEADING;;;; 0002;<control>;Cc;0;|
+ {1: }BN;;;;;N;START OF TEXT;;;; 0003;<con|
+ {1: }trol>;Cc;0;BN;;;;;N;END OF TEXT;;;; |
+ {1: }0004;<control>;Cc;0;BN;;;;;N;END OF |
+ {1: }TRANSMISSION;;;; 0005;<control>;Cc;0|
+ {1: };BN;;;;;N;ENQUIRY;;;; 0006;<control>|
+ {1: };Cc;0;BN;;;;;N;ACKNOWLEDGE;;;; 0007;|
+ {1: }<control>;Cc;0;BN;;;;;N;BELL;;;; 000|
+ {1: }8;<control>;Cc;0;BN;;;;;N;BACKSPACE;|
+ |
+ ]])
+ feed('j')
+ screen:expect([[
+ {2:<<<}{1: }CJK COMPATIBILITY IDEOGRAPH-2F91F;Lo|
+ {1: };0;L;243AB;;;;N;;;;; 2F920;CJK COMPA|
+ {1: }TIBILITY IDEOGRAPH-2F920;Lo;0;L;7228|
+ {1: };;;;N;;;;; 2F921;CJK COMPATIBILITY I|
+ {1: }DEOGRAPH-2F921;Lo;0;L;7235;;;;N;;;;;|
+ {1: } 2F922;CJK COMPATIBILITY IDEOGRAPH-2|
+ {1: }F922;Lo;0;L;7250;;;;N;;;;; |
+ {1: 2 }^2F923;CJK COMPATIBILITY IDEOGRAPH-2F|
+ {1: }923;Lo;0;L;24608;;;;N;;;;; |
+ {1: 3 }2F924;CJK COMPATIBILITY IDEOGRAPH-2F|
+ {1: }924;Lo;0;L;7280;;;;N;;;;; |
+ |
+ ]])
+ end)
+end)
diff --git a/test/functional/legacy/search_spec.lua b/test/functional/legacy/search_spec.lua
index 3f1f85cf28..25620f5262 100644
--- a/test/functional/legacy/search_spec.lua
+++ b/test/functional/legacy/search_spec.lua
@@ -290,8 +290,8 @@ describe('search cmdline', function()
-- First match
feed('/thei')
screen:expect([[
+ 3 the |
4 {inc:thei}r |
- 5 there |
/thei^ |
]])
-- Match from initial cursor position when modifying search
@@ -642,7 +642,7 @@ describe('search cmdline', function()
end)
-- oldtest: Test_incsearch_substitute_dump2()
- it('detects empty pattern properly vim-patch:8.2.2295', function()
+ it('incsearch detects empty pattern properly vim-patch:8.2.2295', function()
screen:try_resize(70, 6)
exec([[
set incsearch hlsearch scrolloff=0
@@ -675,6 +675,46 @@ describe('search cmdline', function()
:1,5s/\v|^ |
]])
end)
+
+ -- oldtest: Test_incsearch_restore_view()
+ it('incsearch restores viewport', function()
+ screen:try_resize(20, 6)
+ exec([[
+ set incsearch nohlsearch
+ setlocal scrolloff=0 smoothscroll
+ call setline(1, [join(range(25), ' '), '', '', '', '', 'xxx'])
+ call feedkeys("2\<C-E>", 't')
+ ]])
+ local s = [[
+ {tilde:<<<} 18 19 20 21 22 2|
+ ^3 24 |
+ |
+ |
+ |
+ |
+ ]]
+ screen:expect(s)
+ feed('/xx')
+ screen:expect([[
+ |
+ |
+ |
+ |
+ {inc:xx}x |
+ /xx^ |
+ ]])
+ feed('x')
+ screen:expect([[
+ |
+ |
+ |
+ |
+ {inc:xxx} |
+ /xxx^ |
+ ]])
+ feed('<Esc>')
+ screen:expect(s)
+ end)
end)
describe('Search highlight', function()
diff --git a/test/functional/legacy/search_stat_spec.lua b/test/functional/legacy/search_stat_spec.lua
index 9fcf798836..bd5ab68e5c 100644
--- a/test/functional/legacy/search_stat_spec.lua
+++ b/test/functional/legacy/search_stat_spec.lua
@@ -1,7 +1,6 @@
local helpers = require('test.functional.helpers')(after_each)
local Screen = require('test.functional.ui.screen')
local clear, feed, exec, command = helpers.clear, helpers.feed, helpers.exec, helpers.command
-local poke_eventloop = helpers.poke_eventloop
describe('search stat', function()
local screen
@@ -11,8 +10,9 @@ describe('search stat', function()
screen:set_default_attr_ids({
[1] = {bold = true, foreground = Screen.colors.Blue}, -- NonText
[2] = {background = Screen.colors.Yellow}, -- Search
- [3] = {foreground = Screen.colors.Blue4, background = Screen.colors.LightGrey}, -- Folded
+ [3] = {foreground = Screen.colors.DarkBlue, background = Screen.colors.LightGrey}, -- Folded
[4] = {reverse = true}, -- IncSearch, TabLineFill
+ [5] = {foreground = Screen.colors.Red}, -- WarningMsg
})
screen:attach()
end)
@@ -80,12 +80,11 @@ describe('search stat', function()
{1:~ }|
/foo [1/2] |
]])
+ -- Note: there is an intermediate state where the search stat disappears.
feed('n')
- poke_eventloop()
- screen:expect_unchanged()
+ screen:expect_unchanged(true)
feed('n')
- poke_eventloop()
- screen:expect_unchanged()
+ screen:expect_unchanged(true)
end)
-- oldtest: Test_search_stat_then_gd()
@@ -185,4 +184,57 @@ describe('search stat', function()
/abc^ |
]])
end)
+
+ -- oldtest: Test_search_stat_backwards()
+ it('when searching backwards', function()
+ screen:try_resize(60, 10)
+ exec([[
+ set shm-=S
+ call setline(1, ['test', ''])
+ ]])
+
+ feed('*')
+ screen:expect([[
+ {2:^test} |
+ |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ /\<test\> [1/1] |
+ ]])
+
+ feed('N')
+ screen:expect([[
+ {2:^test} |
+ |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ ?\<test\> [1/1] |
+ ]])
+
+ command('set shm+=S')
+ feed('N')
+ -- shows "Search Hit Bottom.."
+ screen:expect([[
+ {2:^test} |
+ |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {5:search hit TOP, continuing at BOTTOM} |
+ ]])
+ end)
end)
diff --git a/test/functional/legacy/vimscript_spec.lua b/test/functional/legacy/vimscript_spec.lua
index f59a87f824..16a1080396 100644
--- a/test/functional/legacy/vimscript_spec.lua
+++ b/test/functional/legacy/vimscript_spec.lua
@@ -12,7 +12,7 @@ describe('Vim script', function()
it('Error when if/for/while/try/function is nested too deep',function()
local screen = Screen.new(80, 24)
screen:attach()
- meths.set_option('laststatus', 2)
+ meths.set_option_value('laststatus', 2, {})
exec([[
" Deep nesting of if ... endif
func Test1()
diff --git a/test/functional/legacy/visual_mode_spec.lua b/test/functional/legacy/visual_mode_spec.lua
deleted file mode 100644
index 1a08fb4c0e..0000000000
--- a/test/functional/legacy/visual_mode_spec.lua
+++ /dev/null
@@ -1,79 +0,0 @@
-local helpers = require('test.functional.helpers')(after_each)
-
-local Screen = require('test.functional.ui.screen')
-local clear = helpers.clear
-local feed = helpers.feed
-local exec = helpers.exec
-
-before_each(clear)
-
-describe('visual line mode', function()
- -- oldtest: Test_visual_block_scroll()
- it('redraws properly after scrolling with matchparen loaded and scrolloff=1', function()
- local screen = Screen.new(30, 7)
- screen:attach()
- screen:set_default_attr_ids({
- [1] = {bold = true},
- [2] = {background = Screen.colors.LightGrey},
- })
-
- exec([[
- source $VIMRUNTIME/plugin/matchparen.vim
- set scrolloff=1
- call setline(1, ['a', 'b', 'c', 'd', 'e', '', '{', '}', '{', 'f', 'g', '}'])
- call cursor(5, 1)
- ]])
-
- feed('V<c-d><c-d>')
- screen:expect([[
- {2:{} |
- {2:}} |
- {2:{} |
- {2:f} |
- ^g |
- } |
- {1:-- VISUAL LINE --} |
- ]])
- end)
-end)
-
-describe('visual block mode', function()
- -- oldtest: Test_visual_block_with_virtualedit()
- it('shows selection correctly with virtualedit=block', function()
- local screen = Screen.new(30, 7)
- screen:set_default_attr_ids({
- [1] = {bold = true}, -- ModeMsg
- [2] = {background = Screen.colors.LightGrey}, -- Visual
- [3] = {foreground = Screen.colors.Blue, bold = true} -- NonText
- })
- screen:attach()
-
- exec([[
- call setline(1, ['aaaaaa', 'bbbb', 'cc'])
- set virtualedit=block
- normal G
- ]])
-
- feed('<C-V>gg$')
- screen:expect([[
- {2:aaaaaa}^ |
- {2:bbbb } |
- {2:cc } |
- {3:~ }|
- {3:~ }|
- {3:~ }|
- {1:-- VISUAL BLOCK --} |
- ]])
-
- feed('<Esc>gg<C-V>G$')
- screen:expect([[
- {2:aaaaaa } |
- {2:bbbb } |
- {2:cc}^ {2: } |
- {3:~ }|
- {3:~ }|
- {3:~ }|
- {1:-- VISUAL BLOCK --} |
- ]])
- end)
-end)
diff --git a/test/functional/legacy/visual_spec.lua b/test/functional/legacy/visual_spec.lua
new file mode 100644
index 0000000000..629fab5eb5
--- /dev/null
+++ b/test/functional/legacy/visual_spec.lua
@@ -0,0 +1,69 @@
+local helpers = require('test.functional.helpers')(after_each)
+
+local Screen = require('test.functional.ui.screen')
+local clear = helpers.clear
+local feed = helpers.feed
+local exec = helpers.exec
+
+before_each(clear)
+
+describe('Visual highlight', function()
+ local screen
+
+ before_each(function()
+ screen = Screen.new(50, 6)
+ screen:set_default_attr_ids({
+ [0] = {foreground = Screen.colors.Blue, bold = true}, -- NonText
+ [1] = {bold = true}, -- ModeMsg
+ [2] = {background = Screen.colors.LightGrey}, -- Visual
+ })
+ screen:attach()
+ end)
+
+ -- oldtest: Test_visual_block_with_virtualedit()
+ it('shows selection correctly with virtualedit=block', function()
+ exec([[
+ call setline(1, ['aaaaaa', 'bbbb', 'cc'])
+ set virtualedit=block
+ normal G
+ ]])
+
+ feed('<C-V>gg$')
+ screen:expect([[
+ {2:aaaaaa}^ |
+ {2:bbbb } |
+ {2:cc } |
+ {0:~ }|
+ {0:~ }|
+ {1:-- VISUAL BLOCK --} |
+ ]])
+
+ feed('<Esc>gg<C-V>G$')
+ screen:expect([[
+ {2:aaaaaa } |
+ {2:bbbb } |
+ {2:cc}^ {2: } |
+ {0:~ }|
+ {0:~ }|
+ {1:-- VISUAL BLOCK --} |
+ ]])
+ end)
+
+ -- oldtest: Test_visual_hl_with_showbreak()
+ it("with cursor at end of screen line and 'showbreak'", function()
+ exec([[
+ setlocal showbreak=+
+ call setline(1, repeat('a', &columns + 10))
+ normal g$v4lo
+ ]])
+
+ screen:expect([[
+ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa^a|
+ {0:+}{2:aaaa}aaaaaa |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {1:-- VISUAL --} |
+ ]])
+ end)
+end)
diff --git a/test/functional/legacy/window_cmd_spec.lua b/test/functional/legacy/window_cmd_spec.lua
index 0e9775060d..979b46ae47 100644
--- a/test/functional/legacy/window_cmd_spec.lua
+++ b/test/functional/legacy/window_cmd_spec.lua
@@ -3,8 +3,37 @@ local Screen = require('test.functional.ui.screen')
local clear = helpers.clear
local exec = helpers.exec
local exec_lua = helpers.exec_lua
+local command = helpers.command
local feed = helpers.feed
+-- oldtest: Test_window_cmd_ls0_split_scrolling()
+it('scrolling with laststatus=0 and :botright split', function()
+ clear('--cmd', 'set ruler')
+ local screen = Screen.new(40, 10)
+ screen:set_default_attr_ids({
+ [1] = {reverse = true}, -- StatusLineNC
+ })
+ screen:attach()
+ exec([[
+ set laststatus=0
+ call setline(1, range(1, 100))
+ normal! G
+ ]])
+ command('botright split')
+ screen:expect([[
+ 97 |
+ 98 |
+ 99 |
+ 100 |
+ {1:[No Name] [+] 100,1 Bot}|
+ 97 |
+ 98 |
+ 99 |
+ ^100 |
+ 100,1 Bot |
+ ]])
+end)
+
describe('splitkeep', function()
local screen
@@ -14,6 +43,61 @@ describe('splitkeep', function()
screen:attach()
end)
+ -- oldtest: Test_splitkeep_cursor()
+ it('does not adjust cursor in window that did not change size', function()
+ screen:try_resize(75, 8)
+ -- FIXME: bottom window is different without the "vsplit | close"
+ exec([[
+ vsplit | close
+ set scrolloff=5
+ set splitkeep=screen
+ autocmd CursorMoved * wincmd p | wincmd p
+ call setline(1, range(1, 200))
+ func CursorEqualize()
+ call cursor(100, 1)
+ wincmd =
+ endfunc
+ wincmd s
+ call CursorEqualize()
+ ]])
+
+ screen:expect([[
+ 99 |
+ ^100 |
+ 101 |
+ [No Name] [+] |
+ 5 |
+ 6 |
+ [No Name] [+] |
+ |
+ ]])
+
+ feed('j')
+ screen:expect([[
+ 100 |
+ ^101 |
+ 102 |
+ [No Name] [+] |
+ 5 |
+ 6 |
+ [No Name] [+] |
+ |
+ ]])
+
+ command('set scrolloff=0')
+ feed('G')
+ screen:expect([[
+ 198 |
+ 199 |
+ ^200 |
+ [No Name] [+] |
+ 5 |
+ 6 |
+ [No Name] [+] |
+ |
+ ]])
+ end)
+
-- oldtest: Test_splitkeep_callback()
it('does not scroll when split in callback', function()
exec([[
@@ -116,6 +200,7 @@ describe('splitkeep', function()
-- oldtest: Test_splitkeep_fold()
it('does not scroll when window has closed folds', function()
exec([[
+ set commentstring=/*%s*/
set splitkeep=screen
set foldmethod=marker
set number
@@ -224,4 +309,29 @@ describe('splitkeep', function()
|
]])
end)
+
+ -- oldtest: Test_splitkeep_skipcol()
+ it('skipcol is not reset unnecessarily and is copied to new window', function()
+ screen:try_resize(40, 12)
+ exec([[
+ set splitkeep=topline smoothscroll splitbelow scrolloff=0
+ call setline(1, 'with lots of text in one line '->repeat(6))
+ norm 2
+ wincmd s
+ ]])
+ screen:expect([[
+ <<<e line with lots of text in one line |
+ with lots of text in one line with lots |
+ of text in one line |
+ ~ |
+ [No Name] [+] |
+ <<<e line with lots of text in one line |
+ ^with lots of text in one line with lots |
+ of text in one line |
+ ~ |
+ ~ |
+ [No Name] [+] |
+ |
+ ]])
+ end)
end)