summaryrefslogtreecommitdiffstats
path: root/src/testdir
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-20 03:56:56 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-20 03:56:56 +0000
commit75a9fa68f6cdd6769813a8c5e055bfb00a08c089 (patch)
treedaf1676b4e5ea491b7a370467a24b8181cc21827 /src/testdir
parentAdding upstream version 2:9.1.0377. (diff)
downloadvim-6e41c59b20005243b269d19354c6e767d89e9c78.tar.xz
vim-6e41c59b20005243b269d19354c6e767d89e9c78.zip
Adding upstream version 2:9.1.0496.upstream/2%9.1.0496
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/testdir')
-rw-r--r--src/testdir/Make_all.mak4
-rw-r--r--src/testdir/dumps/Test_balloon_eval_term_03.dump10
-rw-r--r--src/testdir/dumps/Test_mouse_popup_position_01.dump20
-rw-r--r--src/testdir/dumps/Test_mouse_popup_position_02.dump20
-rw-r--r--src/testdir/dumps/Test_popup_command_rl.dump20
-rw-r--r--src/testdir/dumps/Test_pum_highlights_03.dump20
-rw-r--r--src/testdir/dumps/Test_pum_highlights_04.dump20
-rw-r--r--src/testdir/dumps/Test_pum_highlights_05.dump20
-rw-r--r--src/testdir/dumps/Test_pum_highlights_06.dump20
-rw-r--r--src/testdir/dumps/Test_pum_highlights_06a.dump20
-rw-r--r--src/testdir/dumps/Test_pum_highlights_06b.dump20
-rw-r--r--src/testdir/dumps/Test_pum_highlights_07.dump20
-rw-r--r--src/testdir/dumps/Test_pum_highlights_08.dump20
-rw-r--r--src/testdir/dumps/Test_pum_highlights_09.dump20
-rw-r--r--src/testdir/dumps/Test_smooth_long_6.dump2
-rw-r--r--src/testdir/dumps/Test_smooth_long_7.dump2
-rw-r--r--src/testdir/dumps/Test_smooth_long_scrolloff_1.dump8
-rw-r--r--src/testdir/dumps/Test_smooth_long_scrolloff_2.dump8
-rw-r--r--src/testdir/dumps/Test_smooth_long_scrolloff_3.dump8
-rw-r--r--src/testdir/dumps/Test_smooth_long_scrolloff_4.dump8
-rw-r--r--src/testdir/dumps/Test_smooth_long_scrolloff_5.dump8
-rw-r--r--src/testdir/dumps/Test_smooth_long_scrolloff_6.dump8
-rw-r--r--src/testdir/dumps/Test_smooth_long_scrolloff_7.dump8
-rw-r--r--src/testdir/dumps/Test_smoothscroll_in_qf_window_1.dump20
-rw-r--r--src/testdir/dumps/Test_smoothscroll_in_qf_window_2.dump20
-rw-r--r--src/testdir/dumps/Test_smoothscroll_in_qf_window_3.dump20
-rw-r--r--src/testdir/dumps/Test_smoothscroll_in_qf_window_4.dump20
-rw-r--r--src/testdir/dumps/Test_smoothscroll_in_qf_window_5.dump20
-rw-r--r--src/testdir/dumps/Test_wildmenu_pum_hl_match_1.dump10
-rw-r--r--src/testdir/dumps/Test_wildmenu_pum_hl_match_2.dump10
-rw-r--r--src/testdir/dumps/Test_wildmenu_pum_hl_match_3.dump10
-rw-r--r--src/testdir/dumps/Test_wildmenu_pum_hl_match_4.dump10
-rw-r--r--src/testdir/dumps/Test_wildmenu_pum_hl_match_5.dump10
-rw-r--r--src/testdir/dumps/Test_wildmenu_pum_hl_match_6.dump10
-rw-r--r--src/testdir/dumps/Test_wildmenu_pum_rl.dump10
-rw-r--r--src/testdir/gen_opt_test.vim2
-rw-r--r--src/testdir/test_autocmd.vim26
-rw-r--r--src/testdir/test_autoload.vim1
-rw-r--r--src/testdir/test_balloon.vim25
-rw-r--r--src/testdir/test_blob.vim32
-rw-r--r--src/testdir/test_cmdline.vim49
-rw-r--r--src/testdir/test_edit.vim5
-rw-r--r--src/testdir/test_filecopy.vim72
-rw-r--r--src/testdir/test_filetype.vim59
-rw-r--r--src/testdir/test_fold.vim127
-rw-r--r--src/testdir/test_functions.vim96
-rw-r--r--src/testdir/test_global.vim11
-rw-r--r--src/testdir/test_gui.vim2
-rw-r--r--src/testdir/test_history.vim54
-rw-r--r--src/testdir/test_ins_complete.vim184
-rw-r--r--src/testdir/test_listdict.vim21
-rw-r--r--src/testdir/test_method.vim7
-rw-r--r--src/testdir/test_normal.vim130
-rw-r--r--src/testdir/test_partial.vim14
-rw-r--r--src/testdir/test_popup.vim149
-rw-r--r--src/testdir/test_quickfix.vim70
-rw-r--r--src/testdir/test_remote.vim2
-rw-r--r--src/testdir/test_scroll_opt.vim80
-rw-r--r--src/testdir/test_shell.vim4
-rw-r--r--src/testdir/test_shortpathname.vim22
-rw-r--r--src/testdir/test_spellrare.vim61
-rw-r--r--src/testdir/test_substitute.vim24
-rw-r--r--src/testdir/test_tagjump.vim18
-rw-r--r--src/testdir/test_termdebug.vim118
-rw-r--r--src/testdir/test_terminal3.vim25
-rw-r--r--src/testdir/test_textformat.vim2
-rw-r--r--src/testdir/test_vartabs.vim59
-rw-r--r--src/testdir/test_vim9_assign.vim14
-rw-r--r--src/testdir/test_vim9_builtin.vim28
-rw-r--r--src/testdir/test_vim9_class.vim54
-rw-r--r--src/testdir/test_vim9_expr.vim16
-rw-r--r--src/testdir/test_vim9_func.vim13
-rw-r--r--src/testdir/test_vim9_import.vim110
-rw-r--r--src/testdir/test_vim9_script.vim88
-rw-r--r--src/testdir/test_vim9_typealias.vim2
-rw-r--r--src/testdir/test_viminfo.vim30
-rw-r--r--src/testdir/test_vimscript.vim8
-rw-r--r--src/testdir/test_virtualedit.vim22
-rw-r--r--src/testdir/test_visual.vim781
-rw-r--r--src/testdir/test_xdg.vim4
-rw-r--r--src/testdir/test_xxd.vim16
81 files changed, 3071 insertions, 150 deletions
diff --git a/src/testdir/Make_all.mak b/src/testdir/Make_all.mak
index b41f5f4..e31d2b5 100644
--- a/src/testdir/Make_all.mak
+++ b/src/testdir/Make_all.mak
@@ -143,6 +143,7 @@ NEW_TESTS = \
test_file_perm \
test_file_size \
test_filechanged \
+ test_filecopy \
test_fileformat \
test_filetype \
test_filter_cmd \
@@ -278,6 +279,7 @@ NEW_TESTS = \
test_spell \
test_spell_utf8 \
test_spellfile \
+ test_spellrare \
test_startup \
test_startup_utf8 \
test_stat \
@@ -403,6 +405,7 @@ NEW_TESTS_RES = \
test_expr.res \
test_file_size.res \
test_filechanged.res \
+ test_filecopy.res \
test_fileformat.res \
test_filetype.res \
test_filter_cmd.res \
@@ -521,6 +524,7 @@ NEW_TESTS_RES = \
test_spell.res \
test_spell_utf8.res \
test_spellfile.res \
+ test_spellrare.res \
test_startup.res \
test_stat.res \
test_statusline.res \
diff --git a/src/testdir/dumps/Test_balloon_eval_term_03.dump b/src/testdir/dumps/Test_balloon_eval_term_03.dump
new file mode 100644
index 0000000..ccbe9d0
--- /dev/null
+++ b/src/testdir/dumps/Test_balloon_eval_term_03.dump
@@ -0,0 +1,10 @@
+| +0&#ffffff0@38|e|n|o| |e|n|o| |e|n>o
+| @38|o|w|t| |o|X|t| |o|w|t
+| @27| +0#0000001#ffd7ff255@17|e+0#0000000#ffffff0|r|h|t
+| +0#4040ff13&@27| +0#0000001#ffd7ff255|:|6| |n|m|u|l|o|c| |2| |e|n|i|l| | +0#4040ff13#ffffff0@2|~
+| @27| +0#0000001#ffd7ff255@12|<|o|X|t| | +0#4040ff13#ffffff0@2|~
+| @27| +0#0000001#ffd7ff255@17| +0#4040ff13#ffffff0@2|~
+| @48|~
+| @48|~
+| @48|~
+|:+0#0000000&|c|a|l@1| |T|r|i|g@1|e|r|(|)| @16|1|,|1| @10|A|l@1|
diff --git a/src/testdir/dumps/Test_mouse_popup_position_01.dump b/src/testdir/dumps/Test_mouse_popup_position_01.dump
new file mode 100644
index 0000000..54ba886
--- /dev/null
+++ b/src/testdir/dumps/Test_mouse_popup_position_01.dump
@@ -0,0 +1,20 @@
+|0+0&#ffffff0| |1| |2| |3| |4| |5| |6| |7| |8| |9| |1|0| |1@1| |1|2| |1|3| |1|4| |1|5| |1|6| |1|7| >1|8| |1|9|
+|~+0#4040ff13&| @31| +0#0000001#ffd7ff255|U|n|d|o| @11
+|~+0#4040ff13#ffffff0| @31| +0#0000001#ffd7ff255@16
+|~+0#4040ff13#ffffff0| @31| +0#0000001#ffd7ff255|P|a|s|t|e| @10
+|~+0#4040ff13#ffffff0| @31| +0#0000001#ffd7ff255@16
+|~+0#4040ff13#ffffff0| @31| +0#0000001#ffd7ff255|S|e|l|e|c|t| |W|o|r|d| @4
+|~+0#4040ff13#ffffff0| @31| +0#0000001#ffd7ff255|S|e|l|e|c|t| |S|e|n|t|e|n|c|e|
+|~+0#4040ff13#ffffff0| @31| +0#0000001#ffd7ff255|S|e|l|e|c|t| |P|a|r|a|g|r|a|p|h
+|~+0#4040ff13#ffffff0| @31| +0#0000001#ffd7ff255|S|e|l|e|c|t| |L|i|n|e| @4
+|~+0#4040ff13#ffffff0| @31| +0#0000001#ffd7ff255|S|e|l|e|c|t| |B|l|o|c|k| @3
+|~+0#4040ff13#ffffff0| @31| +0#0000001#ffd7ff255|S|e|l|e|c|t| |A|l@1| @5
+|~+0#4040ff13#ffffff0| @48
+|~| @48
+|~| @48
+|~| @48
+|~| @48
+|~| @48
+|~| @48
+|~| @48
+|:+0#0000000&|c|a|l@1| |T|r|i|g@1|e|r|(|4|5|)| @14|1|,|1| @10|A|l@1|
diff --git a/src/testdir/dumps/Test_mouse_popup_position_02.dump b/src/testdir/dumps/Test_mouse_popup_position_02.dump
new file mode 100644
index 0000000..7dfab52
--- /dev/null
+++ b/src/testdir/dumps/Test_mouse_popup_position_02.dump
@@ -0,0 +1,20 @@
+| +0&#ffffff0|9|1| |8>1| |7|1| |6|1| |5|1| |4|1| |3|1| |2|1| |1@1| |0|1| |9| |8| |7| |6| |5| |4| |3| |2| |1| |0
+| +0#0000001#ffd7ff255@11|o|d|n|U| | +0#4040ff13#ffffff0@31|~
+| +0#0000001#ffd7ff255@16| +0#4040ff13#ffffff0@31|~
+| +0#0000001#ffd7ff255@10|e|t|s|a|P| | +0#4040ff13#ffffff0@31|~
+| +0#0000001#ffd7ff255@16| +0#4040ff13#ffffff0@31|~
+| +0#0000001#ffd7ff255@4|d|r|o|W| |t|c|e|l|e|S| | +0#4040ff13#ffffff0@31|~
+| +0#0000001#ffd7ff255|e|c|n|e|t|n|e|S| |t|c|e|l|e|S| | +0#4040ff13#ffffff0@31|~
+|h+0#0000001#ffd7ff255|p|a|r|g|a|r|a|P| |t|c|e|l|e|S| | +0#4040ff13#ffffff0@31|~
+| +0#0000001#ffd7ff255@4|e|n|i|L| |t|c|e|l|e|S| | +0#4040ff13#ffffff0@31|~
+| +0#0000001#ffd7ff255@3|k|c|o|l|B| |t|c|e|l|e|S| | +0#4040ff13#ffffff0@31|~
+| +0#0000001#ffd7ff255@5|l@1|A| |t|c|e|l|e|S| | +0#4040ff13#ffffff0@31|~
+| @48|~
+| @48|~
+| @48|~
+| @48|~
+| @48|~
+| @48|~
+| @48|~
+| @48|~
+|:+0#0000000&|c|a|l@1| |T|r|i|g@1|e|r|(|5|0| |+| |1| |-| |4|5|)| @5|1|,|4|5| @9|A|l@1|
diff --git a/src/testdir/dumps/Test_popup_command_rl.dump b/src/testdir/dumps/Test_popup_command_rl.dump
new file mode 100644
index 0000000..b38ccd9
--- /dev/null
+++ b/src/testdir/dumps/Test_popup_command_rl.dump
@@ -0,0 +1,20 @@
+| +0&#ffffff0@51|e|v|i|f| |r|u|o|f| |e@1|r|h|t| |o|w|t| |e|n|o
+| @46|e|v|i|f| |r|u|o|f| |e@1|r|h|t>X| |o|w|t| |e|n|o| |d|n|a
+| @45| +0#0000001#ffd7ff255@12|o|d|n|U| |w+0#0000000#ffffff0|t| |e|r|o|m| |e|n|o
+| +0#4040ff13&@45| +0#0000001#ffd7ff255@17| +0#4040ff13#ffffff0@9|~
+| @45| +0#0000001#ffd7ff255@11|e|t|s|a|P| | +0#4040ff13#ffffff0@9|~
+| @45| +0#0000001#ffd7ff255@17| +0#4040ff13#ffffff0@9|~
+| @45| +0#0000001#ffd7ff255@5|d|r|o|W| |t|c|e|l|e|S| | +0#4040ff13#ffffff0@9|~
+| @45| +0#0000001#ffd7ff255@1|e|c|n|e|t|n|e|S| |t|c|e|l|e|S| | +0#4040ff13#ffffff0@9|~
+| @45| +0#0000001#ffd7ff255|h|p|a|r|g|a|r|a|P| |t|c|e|l|e|S| | +0#4040ff13#ffffff0@9|~
+| @45| +0#0000001#ffd7ff255@5|e|n|i|L| |t|c|e|l|e|S| | +0#4040ff13#ffffff0@9|~
+| @45| +0#0000001#ffd7ff255@4|k|c|o|l|B| |t|c|e|l|e|S| | +0#4040ff13#ffffff0@9|~
+| @45| +0#0000001#ffd7ff255@6|l@1|A| |t|c|e|l|e|S| | +0#4040ff13#ffffff0@9|~
+| @73|~
+| @73|~
+| @73|~
+| @73|~
+| @73|~
+| @73|~
+| @73|~
+|:+0#0000000&|p|o|p|u|p| |P|o|p|U|p| @62
diff --git a/src/testdir/dumps/Test_pum_highlights_03.dump b/src/testdir/dumps/Test_pum_highlights_03.dump
new file mode 100644
index 0000000..77d87d4
--- /dev/null
+++ b/src/testdir/dumps/Test_pum_highlights_03.dump
@@ -0,0 +1,20 @@
+|f+0&#ffffff0|o> @72
+|f+0#00e0e07#e0e0e08|o|o+0#0000001&| @4|f|o@1|k|i|n|d| | +0#4040ff13#ffffff0@58
+|f+0#0000e05#ffd7ff255|o|o+0#0000001&|f|o@1| @1|f|o@1|k|i|n|d| | +0#4040ff13#ffffff0@58
+|f+0#0000e05#ffd7ff255|o|o+0#0000001&|b|a|r| @1|f|o@1|k|i|n|d| | +0#4040ff13#ffffff0@58
+|f+0#0000e05#ffd7ff255|o|o+0#0000001&|B|a|z| @1|f|o@1|k|i|n|d| | +0#4040ff13#ffffff0@58
+|f+0#0000e05#ffd7ff255|o|o+0#0000001&|b|a|l|a| |f|o@1|k|i|n|d| | +0#4040ff13#ffffff0@58
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|-+2#0000000&@1| |O|m|n|i| |c|o|m|p|l|e|t|i|o|n| |(|^|O|^|N|^|P|)| |m+0#00e0003&|a|t|c|h| |1| |o|f| |9| +0#0000000&@34
diff --git a/src/testdir/dumps/Test_pum_highlights_04.dump b/src/testdir/dumps/Test_pum_highlights_04.dump
new file mode 100644
index 0000000..486a59e
--- /dev/null
+++ b/src/testdir/dumps/Test_pum_highlights_04.dump
@@ -0,0 +1,20 @@
+|你*0&#ffffff0> +&@72
+|你*0#00e0e07#e0e0e08|好*0#0000001&| +&@10| +0#4040ff13#ffffff0@59
+|你*0#0000e05#ffd7ff255|好*0#0000001&|吗| +&@8| +0#4040ff13#ffffff0@59
+|你*0#0000e05#ffd7ff255|不*0#0000001&|好|吗| +&@6| +0#4040ff13#ffffff0@59
+|你*0#0000e05#ffd7ff255|可*0#0000001&|好|吗| +&@6| +0#4040ff13#ffffff0@59
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|-+2#0000000&@1| |O|m|n|i| |c|o|m|p|l|e|t|i|o|n| |(|^|O|^|N|^|P|)| |m+0#00e0003&|a|t|c|h| |1| |o|f| |9| +0#0000000&@34
diff --git a/src/testdir/dumps/Test_pum_highlights_05.dump b/src/testdir/dumps/Test_pum_highlights_05.dump
new file mode 100644
index 0000000..a2ce2cf
--- /dev/null
+++ b/src/testdir/dumps/Test_pum_highlights_05.dump
@@ -0,0 +1,20 @@
+|你*0&#ffffff0|吗> +&@70
+|你*0#00e0e07#e0e0e08|好*0#0000001&|吗*0#00e0e07&| +0#0000001&@8| +0#4040ff13#ffffff0@59
+|你*0#0000e05#ffd7ff255|不*0#0000001&|好|吗*0#0000e05&| +0#0000001&@6| +0#4040ff13#ffffff0@59
+|你*0#0000e05#ffd7ff255|可*0#0000001&|好|吗*0#0000e05&| +0#0000001&@6| +0#4040ff13#ffffff0@59
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|-+2#0000000&@1| |O|m|n|i| |c|o|m|p|l|e|t|i|o|n| |(|^|O|^|N|^|P|)| |m+0#00e0003&|a|t|c|h| |1| |o|f| |9| +0#0000000&@34
diff --git a/src/testdir/dumps/Test_pum_highlights_06.dump b/src/testdir/dumps/Test_pum_highlights_06.dump
new file mode 100644
index 0000000..3eb1524
--- /dev/null
+++ b/src/testdir/dumps/Test_pum_highlights_06.dump
@@ -0,0 +1,20 @@
+| +0&#ffffff0@71> |o|f
+| +0#4040ff13&@58| +0#0000001#e0e0e08|d|n|i|k|o@1|f| @4|o|o+0#00e0e07&|f
+| +0#4040ff13#ffffff0@58| +0#0000001#ffd7ff255|d|n|i|k|o@1|f| @1|o@1|f|o|o+0#0000e05&|f
+| +0#4040ff13#ffffff0@58| +0#0000001#ffd7ff255|d|n|i|k|o@1|f| @1|r|a|b|o|o+0#0000e05&|f
+| +0#4040ff13#ffffff0@58| +0#0000001#ffd7ff255|d|n|i|k|o@1|f| @1|z|a|B|o|o+0#0000e05&|f
+| +0#4040ff13#ffffff0@58| +0#0000001#ffd7ff255|d|n|i|k|o@1|f| |a|l|a|b|o|o+0#0000e05&|f
+| +0#4040ff13#ffffff0@73|~
+| @73|~
+| @73|~
+| @73|~
+| @73|~
+| @73|~
+| @73|~
+| @73|~
+| @73|~
+| @73|~
+| @73|~
+| @73|~
+| @73|~
+|-+2#0000000&@1| |O|m|n|i| |c|o|m|p|l|e|t|i|o|n| |(|^|O|^|N|^|P|)| |m+0#00e0003&|a|t|c|h| |1| |o|f| |9| +0#0000000&@34
diff --git a/src/testdir/dumps/Test_pum_highlights_06a.dump b/src/testdir/dumps/Test_pum_highlights_06a.dump
new file mode 100644
index 0000000..5d51f11
--- /dev/null
+++ b/src/testdir/dumps/Test_pum_highlights_06a.dump
@@ -0,0 +1,20 @@
+| +0&#ffffff0@71> |你*&
+| +0#4040ff13&@59| +0#0000001#e0e0e08@10|好*&|你*0#00e0e07&
+| +0#4040ff13#ffffff0@59| +0#0000001#ffd7ff255@8|吗*&|好|你*0#0000e05&
+| +0#4040ff13#ffffff0@59| +0#0000001#ffd7ff255@6|吗*&|好|不|你*0#0000e05&
+| +0#4040ff13#ffffff0@59| +0#0000001#ffd7ff255@6|吗*&|好|可|你*0#0000e05&
+| +0#4040ff13#ffffff0@73|~
+| @73|~
+| @73|~
+| @73|~
+| @73|~
+| @73|~
+| @73|~
+| @73|~
+| @73|~
+| @73|~
+| @73|~
+| @73|~
+| @73|~
+| @73|~
+|-+2#0000000&@1| |O|m|n|i| |c|o|m|p|l|e|t|i|o|n| |(|^|O|^|N|^|P|)| |m+0#00e0003&|a|t|c|h| |1| |o|f| |9| +0#0000000&@34
diff --git a/src/testdir/dumps/Test_pum_highlights_06b.dump b/src/testdir/dumps/Test_pum_highlights_06b.dump
new file mode 100644
index 0000000..41314ab
--- /dev/null
+++ b/src/testdir/dumps/Test_pum_highlights_06b.dump
@@ -0,0 +1,20 @@
+| +0&#ffffff0@69> |吗*&|你
+| +0#4040ff13&@59| +0#0000001#e0e0e08@8|吗*0#00e0e07&|好*0#0000001&|你*0#00e0e07&
+| +0#4040ff13#ffffff0@59| +0#0000001#ffd7ff255@6|吗*0#0000e05&|好*0#0000001&|不|你*0#0000e05&
+| +0#4040ff13#ffffff0@59| +0#0000001#ffd7ff255@6|吗*0#0000e05&|好*0#0000001&|可|你*0#0000e05&
+| +0#4040ff13#ffffff0@73|~
+| @73|~
+| @73|~
+| @73|~
+| @73|~
+| @73|~
+| @73|~
+| @73|~
+| @73|~
+| @73|~
+| @73|~
+| @73|~
+| @73|~
+| @73|~
+| @73|~
+|-+2#0000000&@1| |O|m|n|i| |c|o|m|p|l|e|t|i|o|n| |(|^|O|^|N|^|P|)| |m+0#00e0003&|a|t|c|h| |1| |o|f| |9| +0#0000000&@34
diff --git a/src/testdir/dumps/Test_pum_highlights_07.dump b/src/testdir/dumps/Test_pum_highlights_07.dump
new file mode 100644
index 0000000..77d87d4
--- /dev/null
+++ b/src/testdir/dumps/Test_pum_highlights_07.dump
@@ -0,0 +1,20 @@
+|f+0&#ffffff0|o> @72
+|f+0#00e0e07#e0e0e08|o|o+0#0000001&| @4|f|o@1|k|i|n|d| | +0#4040ff13#ffffff0@58
+|f+0#0000e05#ffd7ff255|o|o+0#0000001&|f|o@1| @1|f|o@1|k|i|n|d| | +0#4040ff13#ffffff0@58
+|f+0#0000e05#ffd7ff255|o|o+0#0000001&|b|a|r| @1|f|o@1|k|i|n|d| | +0#4040ff13#ffffff0@58
+|f+0#0000e05#ffd7ff255|o|o+0#0000001&|B|a|z| @1|f|o@1|k|i|n|d| | +0#4040ff13#ffffff0@58
+|f+0#0000e05#ffd7ff255|o|o+0#0000001&|b|a|l|a| |f|o@1|k|i|n|d| | +0#4040ff13#ffffff0@58
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|-+2#0000000&@1| |O|m|n|i| |c|o|m|p|l|e|t|i|o|n| |(|^|O|^|N|^|P|)| |m+0#00e0003&|a|t|c|h| |1| |o|f| |9| +0#0000000&@34
diff --git a/src/testdir/dumps/Test_pum_highlights_08.dump b/src/testdir/dumps/Test_pum_highlights_08.dump
new file mode 100644
index 0000000..3eb1524
--- /dev/null
+++ b/src/testdir/dumps/Test_pum_highlights_08.dump
@@ -0,0 +1,20 @@
+| +0&#ffffff0@71> |o|f
+| +0#4040ff13&@58| +0#0000001#e0e0e08|d|n|i|k|o@1|f| @4|o|o+0#00e0e07&|f
+| +0#4040ff13#ffffff0@58| +0#0000001#ffd7ff255|d|n|i|k|o@1|f| @1|o@1|f|o|o+0#0000e05&|f
+| +0#4040ff13#ffffff0@58| +0#0000001#ffd7ff255|d|n|i|k|o@1|f| @1|r|a|b|o|o+0#0000e05&|f
+| +0#4040ff13#ffffff0@58| +0#0000001#ffd7ff255|d|n|i|k|o@1|f| @1|z|a|B|o|o+0#0000e05&|f
+| +0#4040ff13#ffffff0@58| +0#0000001#ffd7ff255|d|n|i|k|o@1|f| |a|l|a|b|o|o+0#0000e05&|f
+| +0#4040ff13#ffffff0@73|~
+| @73|~
+| @73|~
+| @73|~
+| @73|~
+| @73|~
+| @73|~
+| @73|~
+| @73|~
+| @73|~
+| @73|~
+| @73|~
+| @73|~
+|-+2#0000000&@1| |O|m|n|i| |c|o|m|p|l|e|t|i|o|n| |(|^|O|^|N|^|P|)| |m+0#00e0003&|a|t|c|h| |1| |o|f| |9| +0#0000000&@34
diff --git a/src/testdir/dumps/Test_pum_highlights_09.dump b/src/testdir/dumps/Test_pum_highlights_09.dump
new file mode 100644
index 0000000..3616c80
--- /dev/null
+++ b/src/testdir/dumps/Test_pum_highlights_09.dump
@@ -0,0 +1,20 @@
+|f+0&#ffffff0> @73
+|f+0#00e0e07#e0e0e08|o+0#0000001&@1| @11| +0#4040ff13#ffffff0@59
+|F+0#0000e05#ffd7ff255|o+0#0000001&@1|b|a|r| @8| +0#4040ff13#ffffff0@59
+|f+0#0000e05#ffd7ff255|o+0#0000001&@1|B|a|z| @8| +0#4040ff13#ffffff0@59
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|-+2#0000000&@1| |I|N|S|E|R|T| |-@1| +0&&@62
diff --git a/src/testdir/dumps/Test_smooth_long_6.dump b/src/testdir/dumps/Test_smooth_long_6.dump
index 507aa46..ba48c28 100644
--- a/src/testdir/dumps/Test_smooth_long_6.dump
+++ b/src/testdir/dumps/Test_smooth_long_6.dump
@@ -3,4 +3,4 @@
|t|s| |o|f| |t|e|x|t| |w|i|t|h| |l|o|t|s| |o|f| |t|e|x|t| |w|i|t|h| |l|o|t|s| |o
|f| |t|e|x|t| |w|i|t|h| |l|o|t|s| |o|f| |t|e|x|t| |w|i|t|h| |l|o|t|s| |o|f| |t|e
|x|t| |w|i|t|h| |l|o|t|s| |o|f| |t|e|x|t| |w|i|t|h| |l|o|t|s| |o|f| |t|e|x|t| |w
-|:|s|e|t| |s|c|r|o|l@1|o| @9|3|,|9|0| @9|6@1|%|
+| @21|3|,|9|0| @9|6@1|%|
diff --git a/src/testdir/dumps/Test_smooth_long_7.dump b/src/testdir/dumps/Test_smooth_long_7.dump
index 225207f..222e001 100644
--- a/src/testdir/dumps/Test_smooth_long_7.dump
+++ b/src/testdir/dumps/Test_smooth_long_7.dump
@@ -3,4 +3,4 @@
|t|s| |o|f| |t|e|x|t| |w|i|t|h| |l|o|t|s| |o|f| |t|e|x|t| |w|i|t|h| |l|o|t|s| |o
|f| |t|e|x|t| |w|i>t|h| |l|o|t|s| |o|f| |t|e|x|t| |w|i|t|h| |l|o|t|s| |o|f| |t|e
|x|t| |w|i|t|h| |l|o|t|s| |o|f| |t|e|x|t| |w|i|t|h| |l|o|t|s| |o|f| |t|e|x|t| |w
-|:|s|e|t| |s|c|r|o|l@1|o| @9|3|,|1|7|0| @8|6@1|%|
+| @21|3|,|1|7|0| @8|6@1|%|
diff --git a/src/testdir/dumps/Test_smooth_long_scrolloff_1.dump b/src/testdir/dumps/Test_smooth_long_scrolloff_1.dump
new file mode 100644
index 0000000..6c1d223
--- /dev/null
+++ b/src/testdir/dumps/Test_smooth_long_scrolloff_1.dump
@@ -0,0 +1,8 @@
+| +0&#ffffff0@39
+@40
+@40
+> @39
+@40
+@40
+@40
+@40
diff --git a/src/testdir/dumps/Test_smooth_long_scrolloff_2.dump b/src/testdir/dumps/Test_smooth_long_scrolloff_2.dump
new file mode 100644
index 0000000..9162df0
--- /dev/null
+++ b/src/testdir/dumps/Test_smooth_long_scrolloff_2.dump
@@ -0,0 +1,8 @@
+|<+0#4040ff13#ffffff0@2|t+0#0000000&|w|o| |l|o|n|g| |t|w|o| |l|o|n|g| |t|w|o| |l|o|n|g| |t|w|o| |l|o|n|g| |t
+|w|o| |l|o|n|g| |t|w|o| |l|o|n|g| |t|w|o| |l|o|n|g| |t|w|o| |l|o|n|g| |t|w|o| |l
+|o|n|g| |t|w|o| |l|o|n|g| |t|w|o| |l|o|n|g| |t|w|o| |l|o|n|g| |t|w|o| |l|o|n|g|
+|t|w|o| |l|o|n|g| |t|w|o| |l|o|n|g| |t|w|o| |l|o|n|g| |t|w|o| |l|o|n|g| |t|w|o|
+>l|o|n|g| |t|w|o| |l|o|n|g| |t|w|o| |l|o|n|g| |t|w|o| |l|o|n|g| |t|w|o| |l|o|n|g
+| |t|w|o| |l|o|n|g| |t|w|o| |l|o|n|g| |t|w|o| |l|o|n|g| |t|w|o| |l|o|n|g| |t|w|o
+| |l|o|n|g| |t|w|o| |l|o|n|g| |t|w|o| |l|o|n|g| |t|w|o| |l|o|n|g| |t|w|o| |l|o|n
+| @39
diff --git a/src/testdir/dumps/Test_smooth_long_scrolloff_3.dump b/src/testdir/dumps/Test_smooth_long_scrolloff_3.dump
new file mode 100644
index 0000000..1a1fcae
--- /dev/null
+++ b/src/testdir/dumps/Test_smooth_long_scrolloff_3.dump
@@ -0,0 +1,8 @@
+|<+0#4040ff13#ffffff0@2|l+0#0000000&|o|n|g| |t|w|o| |l|o|n|g| |t|w|o| |l|o|n|g| |t|w|o| |l|o|n|g| |t|w|o| |l
+|o|n|g| |t|w|o| |l|o|n|g| |t|w|o| |l|o|n|g| |t|w|o| |l|o|n|g| |t|w|o| |l|o|n|g|
+|t|w|o| |l|o|n|g| |t|w|o| |l|o|n|g| |t|w|o| |l|o|n|g| |t|w|o| |l|o|n|g| |t|w|o|
+|l|o|n|g| |t|w|o| |l|o|n|g| |t|w|o| |l|o|n|g| |t|w|o| |l|o|n|g| |t|w|o| |l|o|n|g
+> |t|w|o| |l|o|n|g| |t|w|o| |l|o|n|g| |t|w|o| |l|o|n|g| |t|w|o| |l|o|n|g| |t|w|o
+| |l|o|n|g| |t|w|o| |l|o|n|g| |t|w|o| |l|o|n|g| |t|w|o| |l|o|n|g| |t|w|o| |l|o|n
+|g| |t|w|o| |l|o|n|g| |t|w|o| |l|o|n|g| @20
+@40
diff --git a/src/testdir/dumps/Test_smooth_long_scrolloff_4.dump b/src/testdir/dumps/Test_smooth_long_scrolloff_4.dump
new file mode 100644
index 0000000..4ed62b6
--- /dev/null
+++ b/src/testdir/dumps/Test_smooth_long_scrolloff_4.dump
@@ -0,0 +1,8 @@
+|<+0#4040ff13#ffffff0@2|l+0#0000000&|o|n|g| |t|w|o| |l|o|n|g| |t|w|o| |l|o|n|g| |t|w|o| |l|o|n|g| |t|w|o| |l
+|o|n|g| |t|w|o| |l|o|n|g| |t|w|o| |l|o|n|g| |t|w|o| |l|o|n|g| |t|w|o| |l|o|n|g|
+|t|w|o| |l|o|n|g| |t|w|o| |l|o|n|g| |t|w|o| |l|o|n|g| |t|w|o| |l|o|n|g| |t|w|o|
+|l|o|n|g| |t|w|o| |l|o|n|g| |t|w|o| |l|o|n|g| |t|w|o| |l|o|n|g| |t|w|o| |l|o|n|g
+| |t|w|o| |l|o|n|g| |t|w|o| |l|o|n|g| |t|w|o| |l|o|n|g| |t|w|o| |l|o|n|g| |t|w|o
+> |l|o|n|g| |t|w|o| |l|o|n|g| |t|w|o| |l|o|n|g| |t|w|o| |l|o|n|g| |t|w|o| |l|o|n
+|g| |t|w|o| |l|o|n|g| |t|w|o| |l|o|n|g| @20
+@40
diff --git a/src/testdir/dumps/Test_smooth_long_scrolloff_5.dump b/src/testdir/dumps/Test_smooth_long_scrolloff_5.dump
new file mode 100644
index 0000000..6d7e157
--- /dev/null
+++ b/src/testdir/dumps/Test_smooth_long_scrolloff_5.dump
@@ -0,0 +1,8 @@
+|<+0#4040ff13#ffffff0@2|l+0#0000000&|o|n|g| |t|w|o| |l|o|n|g| |t|w|o| |l|o|n|g| |t|w|o| |l|o|n|g| |t|w|o| |l
+|o|n|g| |t|w|o| |l|o|n|g| |t|w|o| |l|o|n|g| |t|w|o| |l|o|n|g| |t|w|o| |l|o|n|g|
+|t|w|o| |l|o|n|g| |t|w|o| |l|o|n|g| |t|w|o| |l|o|n|g| |t|w|o| |l|o|n|g| |t|w|o|
+|l|o|n|g| |t|w|o| |l|o|n|g| |t|w|o| |l|o|n|g| |t|w|o| |l|o|n|g| |t|w|o| |l|o|n|g
+| |t|w|o| |l|o|n|g| |t|w|o| |l|o|n|g| |t|w|o| |l|o|n|g| |t|w|o| |l|o|n|g| |t|w|o
+| |l|o|n|g| |t|w|o| |l|o|n|g| |t|w|o| |l|o|n|g| |t|w|o| |l|o|n|g| |t|w|o| |l|o|n
+>g| |t|w|o| |l|o|n|g| |t|w|o| |l|o|n|g| @20
+@40
diff --git a/src/testdir/dumps/Test_smooth_long_scrolloff_6.dump b/src/testdir/dumps/Test_smooth_long_scrolloff_6.dump
new file mode 100644
index 0000000..4f5dcea
--- /dev/null
+++ b/src/testdir/dumps/Test_smooth_long_scrolloff_6.dump
@@ -0,0 +1,8 @@
+|<+0#4040ff13#ffffff0@2| +0#0000000&|l|o|n|g| |t|w|o| |l|o|n|g| |t|w|o| |l|o|n|g| |t|w|o| |l|o|n|g| |t|w|o|
+|l|o|n|g| |t|w|o| |l|o|n|g| |t|w|o| |l|o|n|g| |t|w|o| |l|o|n|g| |t|w|o| |l|o|n|g
+| |t|w|o| |l|o|n|g| |t|w|o| |l|o|n|g| |t|w|o| |l|o|n|g| |t|w|o| |l|o|n|g| |t|w|o
+| |l|o|n|g| |t|w|o| |l|o|n|g| |t|w|o| |l|o|n|g| |t|w|o| |l|o|n|g| |t|w|o| |l|o|n
+|g| |t|w|o| |l|o|n|g| |t|w|o| |l|o|n|g| @20
+>t|h|r|e@1| @34
+|f|o|u|r| @35
+@40
diff --git a/src/testdir/dumps/Test_smooth_long_scrolloff_7.dump b/src/testdir/dumps/Test_smooth_long_scrolloff_7.dump
new file mode 100644
index 0000000..c21c022
--- /dev/null
+++ b/src/testdir/dumps/Test_smooth_long_scrolloff_7.dump
@@ -0,0 +1,8 @@
+| +0&#ffffff0@39
+@40
+@40
+@40
+@40
+@40
+> @39
+@40
diff --git a/src/testdir/dumps/Test_smoothscroll_in_qf_window_1.dump b/src/testdir/dumps/Test_smoothscroll_in_qf_window_1.dump
new file mode 100644
index 0000000..efdec1e
--- /dev/null
+++ b/src/testdir/dumps/Test_smoothscroll_in_qf_window_1.dump
@@ -0,0 +1,20 @@
+> +0&#ffffff0@59
+|~+0#4040ff13&| @58
+|~| @58
+|~| @58
+|~| @58
+|~| @58
+|~| @58
+|~| @58
+|~| @58
+|~| @58
+|~| @58
+|~| @58
+|[+3#0000000&|N|o| |N|a|m|e|]| @50
+|<+0#4040ff13&@2| +0#af5f00255&|2+0#0000000&|1| |2@1| |2|3| |2|4| |2|5| |2|6| |2|7| |2|8| |2|9| @29
+| +0#af5f00255&|1|0| ||+0#0000000&@1| |0| |1| |2| |3| |4| |5| |6| |7| |8| |9| |1|0| |1@1| |1|2| |1|3| |1|4| |1|5| |1|6| |1|7| |1|8| |1|9| |2|0|
+| +0#af5f00255&@3|2+0#0000000&|1| |2@1| |2|3| |2|4| |2|5| |2|6| |2|7| |2|8| |2|9| @29
+| +0#af5f00255&|1@1| ||+0#0000000&@1| |0| |1| |2| |3| |4| |5| |6| |7| |8| |9| |1|0| |1@1| |1|2| |1|3| |1|4| |1|5| |1|6| |1|7| |1|8| |1|9| |2|0|
+| +0#af5f00255&@3|2+0#0000000&|1| |2@1| |2|3| |2|4| |2|5| |2|6| |2|7| |2|8| |2|9| @29
+|[+1&&|Q|u|i|c|k|f|i|x| |L|i|s|t|]| @44
+| +0&&@59
diff --git a/src/testdir/dumps/Test_smoothscroll_in_qf_window_2.dump b/src/testdir/dumps/Test_smoothscroll_in_qf_window_2.dump
new file mode 100644
index 0000000..200df91
--- /dev/null
+++ b/src/testdir/dumps/Test_smoothscroll_in_qf_window_2.dump
@@ -0,0 +1,20 @@
+> +0&#ffffff0@59
+|~+0#4040ff13&| @58
+|~| @58
+|~| @58
+|~| @58
+|~| @58
+|~| @58
+|~| @58
+|~| @58
+|~| @58
+|~| @58
+|~| @58
+|[+3#0000000&|N|o| |N|a|m|e|]| @50
+| +0#af5f00255&@1|1| | +0#0000000&@55
+|~+0#4040ff13&| @58
+|~| @58
+|~| @58
+|~| @58
+|[+1#0000000&|Q|u|i|c|k|f|i|x| |L|i|s|t|]| @44
+|:+0&&|c|a|l@1| |s|e|t|q|f|l|i|s|t|(|[|]|,| |'|r|'|)| @35
diff --git a/src/testdir/dumps/Test_smoothscroll_in_qf_window_3.dump b/src/testdir/dumps/Test_smoothscroll_in_qf_window_3.dump
new file mode 100644
index 0000000..54b726f
--- /dev/null
+++ b/src/testdir/dumps/Test_smoothscroll_in_qf_window_3.dump
@@ -0,0 +1,20 @@
+> +0&#ffffff0@59
+|~+0#4040ff13&| @58
+|~| @58
+|~| @58
+|~| @58
+|~| @58
+|~| @58
+|~| @58
+|~| @58
+|~| @58
+|~| @58
+|~| @58
+|[+3#0000000&|N|o| |N|a|m|e|]| @50
+| +0#af5f00255&@1|1| ||+0#0000000#ffff4012@1| |f|o@1| @49
+| +0#af5f00255#ffffff0@1|2| ||+0#0000000&@1| |0| |1| |2| |3| |4| |5| |6| |7| |8| |9| |1|0| |1@1| |1|2| |1|3| |1|4| |1|5| |1|6| |1|7| |1|8| |1|9| |2|0|
+| +0#af5f00255&@3|2+0#0000000&|1| |2@1| |2|3| |2|4| |2|5| |2|6| |2|7| |2|8| |2|9| @29
+| +0#af5f00255&@1|3| ||+0#0000000&@1| |0| |1| |2| |3| |4| |5| |6| |7| |8| |9| |1|0| |1@1| |1|2| |1|3| |1|4| |1|5| |1|6| |1|7| |1|8| |1|9| |2|0|
+| +0#af5f00255&@3|2+0#0000000&|1| |2@1| |2|3| |2|4| |2|5| |2|6| |2|7| |2|8| |2|9| @29
+|[+1&&|Q|u|i|c|k|f|i|x| |L|i|s|t|]| @44
+|:+0&&|c|a|l@1| |s|e|t|q|f|l|i|s|t|(|g|:|l|,| |'|r|'|)| @34
diff --git a/src/testdir/dumps/Test_smoothscroll_in_qf_window_4.dump b/src/testdir/dumps/Test_smoothscroll_in_qf_window_4.dump
new file mode 100644
index 0000000..1a4cdd2
--- /dev/null
+++ b/src/testdir/dumps/Test_smoothscroll_in_qf_window_4.dump
@@ -0,0 +1,20 @@
+> +0&#ffffff0@59
+|~+0#4040ff13&| @58
+|~| @58
+|~| @58
+|~| @58
+|~| @58
+|~| @58
+|~| @58
+|~| @58
+|~| @58
+|~| @58
+|~| @58
+|[+3#0000000&|N|o| |N|a|m|e|]| @50
+| +0#af5f00255&@1|1| ||+0#0000000#ffff4012@1| |0| |1| |2| |3| |4| |5| |6| |7| |8| |9| |1|0| |1@1| |1|2| |1|3| |1|4| |1|5| |1|6| |1|7| |1|8| |1|9| |2|0|
+| +0#af5f00255#ffffff0@3|2+0#0000000#ffff4012|1| |2@1| |2|3| |2|4| |2|5| |2|6| |2|7| |2|8| |2|9| |3|0| |3|1| |3|2| |3@1| |3|4| |3|5| |3|6| |3|7| |3|8| |3|9
+| +0#af5f00255#ffffff0@3| +0#0000000#ffff4012|4|0| |4|1| |4|2| |4|3| |4@1| |4|5| |4|6| |4|7| |4|8| |4|9| |5|0| |5|1| |5|2| |5|3| |5|4| |5@1| |5|6| |5|7| |5
+| +0#af5f00255#ffffff0@3|8+0#0000000#ffff4012| |5|9| |6|0| |6|1| |6|2| |6|3| |6|4| |6|5| |6@1| |6|7| |6|8| |6|9| |7|0| |7|1| |7|2| |7|3| |7|4| |7|5| |7|6|
+| +0#af5f00255#ffffff0@3|7+0#0000000#ffff4012@1| |7|8| |7|9| |8|0| |8|1| |8|2| |8|3| |8|4| |8|5| |8|6| |8|7| |8@1| |8|9| |9|0| |9|1| |9|2| |9|3| |9|4| |9|5
+|[+1&#ffffff0|Q|u|i|c|k|f|i|x| |L|i|s|t|]| @44
+|:+0&&|c|a|l@1| |s|e|t|q|f|l|i|s|t|(|g|:|l|1|,| |'|r|'|)| @33
diff --git a/src/testdir/dumps/Test_smoothscroll_in_qf_window_5.dump b/src/testdir/dumps/Test_smoothscroll_in_qf_window_5.dump
new file mode 100644
index 0000000..fcc2106
--- /dev/null
+++ b/src/testdir/dumps/Test_smoothscroll_in_qf_window_5.dump
@@ -0,0 +1,20 @@
+> +0&#ffffff0@59
+|~+0#4040ff13&| @58
+|~| @58
+|~| @58
+|~| @58
+|~| @58
+|~| @58
+|~| @58
+|~| @58
+|~| @58
+|~| @58
+|~| @58
+|[+3#0000000&|N|o| |N|a|m|e|]| @50
+|<+0#4040ff13&@2| +0#af5f00255&| +0#0000000#ffff4012|9|3|7| |9|3|8| |9|3|9| |9|4|0| |9|4|1| |9|4|2| |9|4|3| |9|4@1| |9|4|5| |9|4|6| |9|4|7| |9|4|8| |9|4|9| |9|5|0
+| +0#af5f00255#ffffff0@3| +0#0000000#ffff4012|9|5|1| |9|5|2| |9|5|3| |9|5|4| |9|5@1| |9|5|6| |9|5|7| |9|5|8| |9|5|9| |9|6|0| |9|6|1| |9|6|2| |9|6|3| |9|6|4
+| +0#af5f00255#ffffff0@3| +0#0000000#ffff4012|9|6|5| |9|6@1| |9|6|7| |9|6|8| |9|6|9| |9|7|0| |9|7|1| |9|7|2| |9|7|3| |9|7|4| |9|7|5| |9|7|6| |9|7@1| |9|7|8
+| +0#af5f00255#ffffff0@3| +0#0000000#ffff4012|9|7|9| |9|8|0| |9|8|1| |9|8|2| |9|8|3| |9|8|4| |9|8|5| |9|8|6| |9|8|7| |9|8@1| |9|8|9| |9@1|0| |9@1|1| |9@1|2
+| +0#af5f00255#ffffff0@3| +0#0000000#ffff4012|9@1|3| |9@1|4| |9@1|5| |9@1|6| |9@1|7| |9@1|8| |9@2| @27
+|[+1&#ffffff0|Q|u|i|c|k|f|i|x| |L|i|s|t|]| @44
+|:+0&&|c|a|l@1| |s|e|t|q|f|l|i|s|t|(|g|:|l|1|,| |'|r|'|)| @33
diff --git a/src/testdir/dumps/Test_wildmenu_pum_hl_match_1.dump b/src/testdir/dumps/Test_wildmenu_pum_hl_match_1.dump
new file mode 100644
index 0000000..0772682
--- /dev/null
+++ b/src/testdir/dumps/Test_wildmenu_pum_hl_match_1.dump
@@ -0,0 +1,10 @@
+| +0&#ffffff0@49
+|~+0#4040ff13&| @48
+|~| @48
+|~| @48
+|~| @48
+|~| @48
+|~| @48
+|~| @3| +0#0000001#e0e0e08|p+0#00e0e07&|l|a+0#0000001&|c+0#00e0e07&|e+0#0000001&| @9| +0#4040ff13#ffffff0@28
+|~| @3| +0#0000001#ffd7ff255|u|n|p+0#0000e05&|l|a+0#0000001&|c+0#0000e05&|e+0#0000001&| @7| +0#4040ff13#ffffff0@28
+|:+0#0000000&|s|i|g|n| |p|l|a|c|e> @38
diff --git a/src/testdir/dumps/Test_wildmenu_pum_hl_match_2.dump b/src/testdir/dumps/Test_wildmenu_pum_hl_match_2.dump
new file mode 100644
index 0000000..ec781ef
--- /dev/null
+++ b/src/testdir/dumps/Test_wildmenu_pum_hl_match_2.dump
@@ -0,0 +1,10 @@
+| +0&#ffffff0@49
+|~+0#4040ff13&| @48
+|~| @48
+|~| @48
+|~| @48
+|~| @48
+|~| @48
+|~| @3| +0#0000001#ffd7ff255|p+0#0000e05&|l|a+0#0000001&|c+0#0000e05&|e+0#0000001&| @9| +0#4040ff13#ffffff0@28
+|~| @3| +0#0000001#e0e0e08|u|n|p+0#00e0e07&|l|a+0#0000001&|c+0#00e0e07&|e+0#0000001&| @7| +0#4040ff13#ffffff0@28
+|:+0#0000000&|s|i|g|n| |u|n|p|l|a|c|e> @36
diff --git a/src/testdir/dumps/Test_wildmenu_pum_hl_match_3.dump b/src/testdir/dumps/Test_wildmenu_pum_hl_match_3.dump
new file mode 100644
index 0000000..afb792a
--- /dev/null
+++ b/src/testdir/dumps/Test_wildmenu_pum_hl_match_3.dump
@@ -0,0 +1,10 @@
+| +0&#ffffff0@49
+|~+0#4040ff13&| @48
+|~| @48
+|~| @48
+|~| @48
+|~| @48
+|~| @48
+|~| @3| +0#0000001#ffd7ff255|p+0#0000e05&|l|a+0#0000001&|c+0#0000e05&|e+0#0000001&| @9| +0#4040ff13#ffffff0@28
+|~| @3| +0#0000001#ffd7ff255|u|n|p+0#0000e05&|l|a+0#0000001&|c+0#0000e05&|e+0#0000001&| @7| +0#4040ff13#ffffff0@28
+|:+0#0000000&|s|i|g|n| |p|l|c> @40
diff --git a/src/testdir/dumps/Test_wildmenu_pum_hl_match_4.dump b/src/testdir/dumps/Test_wildmenu_pum_hl_match_4.dump
new file mode 100644
index 0000000..0be8053
--- /dev/null
+++ b/src/testdir/dumps/Test_wildmenu_pum_hl_match_4.dump
@@ -0,0 +1,10 @@
+| +0&#ffffff0@49
+|~+0#4040ff13&| @48
+|~| @48
+|~| @48
+|~| @48
+|~| @48
+|~| @48
+|~| @3| +0#0000001#e0e0e08|u+0#00e0e07&|n|d+0#0000001&|e|f|i|n|e| @6| +0#4040ff13#ffffff0@28
+|~| @3| +0#0000001#ffd7ff255|u+0#0000e05&|n|p+0#0000001&|l|a|c|e| @7| +0#4040ff13#ffffff0@28
+|:+0#0000000&|s|i|g|n| |u|n|d|e|f|i|n|e> @35
diff --git a/src/testdir/dumps/Test_wildmenu_pum_hl_match_5.dump b/src/testdir/dumps/Test_wildmenu_pum_hl_match_5.dump
new file mode 100644
index 0000000..7453cb9
--- /dev/null
+++ b/src/testdir/dumps/Test_wildmenu_pum_hl_match_5.dump
@@ -0,0 +1,10 @@
+| +0&#ffffff0@49
+|~+0#4040ff13&| @48
+|~| @48
+|~| @48
+|~| @48
+|~| @48
+|~| @48
+|~| @3| +0#0000001#ffd7ff255|u+0#0000e05&|n|d+0#0000001&|e|f|i|n|e| @6| +0#4040ff13#ffffff0@28
+|~| @3| +0#0000001#e0e0e08|u+0#00e0e07&|n|p+0#0000001&|l|a|c|e| @7| +0#4040ff13#ffffff0@28
+|:+0#0000000&|s|i|g|n| |u|n|p|l|a|c|e> @36
diff --git a/src/testdir/dumps/Test_wildmenu_pum_hl_match_6.dump b/src/testdir/dumps/Test_wildmenu_pum_hl_match_6.dump
new file mode 100644
index 0000000..8345007
--- /dev/null
+++ b/src/testdir/dumps/Test_wildmenu_pum_hl_match_6.dump
@@ -0,0 +1,10 @@
+| +0&#ffffff0@49
+|~+0#4040ff13&| @48
+|~| @48
+|~| @48
+|~| @48
+|~| @48
+|~| @48
+|~| @3| +0#0000001#ffd7ff255|u+0#0000e05&|n|d+0#0000001&|e|f|i|n|e| @6| +0#4040ff13#ffffff0@28
+|~| @3| +0#0000001#ffd7ff255|u+0#0000e05&|n|p+0#0000001&|l|a|c|e| @7| +0#4040ff13#ffffff0@28
+|:+0#0000000&|s|i|g|n| |u|n> @41
diff --git a/src/testdir/dumps/Test_wildmenu_pum_rl.dump b/src/testdir/dumps/Test_wildmenu_pum_rl.dump
new file mode 100644
index 0000000..55db4ca
--- /dev/null
+++ b/src/testdir/dumps/Test_wildmenu_pum_rl.dump
@@ -0,0 +1,10 @@
+| +0&#ffffff0@49
+| +0#4040ff13&@48|~
+| @48|~
+| @4| +0#0000001#e0e0e08|d|e|f|i|n|e| @8| +0#4040ff13#ffffff0@27|~
+| @4| +0#0000001#ffd7ff255|j|u|m|p| @10| +0#4040ff13#ffffff0@27|~
+| @4| +0#0000001#ffd7ff255|l|i|s|t| @10| +0#4040ff13#ffffff0@27|~
+| @4| +0#0000001#ffd7ff255|p|l|a|c|e| @9| +0#4040ff13#ffffff0@27|~
+| @4| +0#0000001#ffd7ff255|u|n|d|e|f|i|n|e| @6| +0#4040ff13#ffffff0@27|~
+| @4| +0#0000001#ffd7ff255|u|n|p|l|a|c|e| @7| +0#4040ff13#ffffff0@27|~
+|:+0#0000000&|s|i|g|n| |d|e|f|i|n|e> @37
diff --git a/src/testdir/gen_opt_test.vim b/src/testdir/gen_opt_test.vim
index a195bca..8cca2b9 100644
--- a/src/testdir/gen_opt_test.vim
+++ b/src/testdir/gen_opt_test.vim
@@ -76,7 +76,7 @@ let test_values = {
\ 'clipboard': [['', 'unnamed', 'autoselect,unnamed', 'html', 'exclude:vimdisplay'], ['xxx', '\ze*', 'exclude:\\%(']],
\ 'colorcolumn': [['', '8', '+2'], ['xxx']],
\ 'comments': [['', 'b:#'], ['xxx']],
- \ 'commentstring': [['', '/*%s*/'], ['xxx']],
+ \ 'commentstring': [['', '/*\ %s\ */'], ['xxx']],
\ 'complete': [['', 'w,b'], ['xxx']],
\ 'concealcursor': [['', 'n', 'nvic'], ['xxx']],
\ 'completeopt': [['', 'menu', 'menu,longest'], ['xxx', 'menu,,,longest,']],
diff --git a/src/testdir/test_autocmd.vim b/src/testdir/test_autocmd.vim
index 24e1daf..c9f257a 100644
--- a/src/testdir/test_autocmd.vim
+++ b/src/testdir/test_autocmd.vim
@@ -4024,6 +4024,32 @@ func Test_autocmd_get()
\ event: 'BufAdd', pattern: '*.abc'}))
call assert_equal([], autocmd_get(#{group: 'TestAutoCmdFns',
\ event: 'BufWipeout'}))
+
+ " Test for getting autocmds after removing one inside an autocmd
+ func CheckAutocmdGet()
+ augroup TestAutoCmdFns
+ autocmd! BufAdd *.vim
+ augroup END
+
+ let expected = [
+ \ #{cmd: 'echo "bufadd-py"', group: 'TestAutoCmdFns',
+ \ pattern: '*.py', nested: v:false, once: v:false,
+ \ event: 'BufAdd'},
+ \ #{cmd: 'echo "bufhidden"', group: 'TestAutoCmdFns',
+ \ pattern: '*.vim', nested: v:false,
+ \ once: v:false, event: 'BufHidden'}]
+
+ call assert_equal(expected, autocmd_get(#{group: 'TestAutoCmdFns'}))
+ call assert_equal([expected[0]],
+ \ autocmd_get(#{group: 'TestAutoCmdFns', pattern: '*.py'}))
+ call assert_equal([expected[1]],
+ \ autocmd_get(#{group: 'TestAutoCmdFns', pattern: '*.vim'}))
+ endfunc
+
+ autocmd User Xauget call CheckAutocmdGet()
+ doautocmd User Xauget
+ autocmd! User Xauget
+
call assert_fails("call autocmd_get(#{group: 'abc', event: 'BufAdd'})",
\ 'E367:')
let cmd = "echo autocmd_get(#{group: 'TestAutoCmdFns', event: 'abc'})"
diff --git a/src/testdir/test_autoload.vim b/src/testdir/test_autoload.vim
index 835b81e..d0f9136 100644
--- a/src/testdir/test_autoload.vim
+++ b/src/testdir/test_autoload.vim
@@ -26,5 +26,4 @@ func Test_autoload_vim9script()
call assert_equal(49, auto9#Add42(7))
endfunc
-
" vim: shiftwidth=2 sts=2 expandtab
diff --git a/src/testdir/test_balloon.vim b/src/testdir/test_balloon.vim
index 5e84f9e..80d5831 100644
--- a/src/testdir/test_balloon.vim
+++ b/src/testdir/test_balloon.vim
@@ -64,4 +64,29 @@ func Test_balloon_eval_term_visual()
call StopVimInTerminal(buf)
endfunc
+func Test_balloon_eval_term_rightleft()
+ CheckFeature rightleft
+
+ " Use <Ignore> after <MouseMove> to return from vgetc() without removing
+ " the balloon.
+ let xtra_lines =<< trim [CODE]
+ set rightleft
+ func Trigger()
+ call test_setmouse(2, 50 + 1 - 6)
+ call feedkeys("\<MouseMove>\<Ignore>", "xt")
+ endfunc
+ [CODE]
+ call writefile(s:common_script + xtra_lines, 'XTest_beval_rl', 'D')
+
+ " Check that the balloon shows up after a mouse move
+ let buf = RunVimInTerminal('-S XTest_beval_rl', {'rows': 10, 'cols': 50})
+ call TermWait(buf, 50)
+ call term_sendkeys(buf, 'll')
+ call term_sendkeys(buf, ":call Trigger()\<CR>")
+ call VerifyScreenDump(buf, 'Test_balloon_eval_term_03', {})
+
+ " clean up
+ call StopVimInTerminal(buf)
+endfunc
+
" vim: shiftwidth=2 sts=2 expandtab
diff --git a/src/testdir/test_blob.vim b/src/testdir/test_blob.vim
index cccecb7..f0e8209 100644
--- a/src/testdir/test_blob.vim
+++ b/src/testdir/test_blob.vim
@@ -74,6 +74,13 @@ func Test_blob_assign()
VAR l = [0z12]
VAR m = deepcopy(l)
LET m[0] = 0z34 #" E742 or E741 should not occur.
+
+ VAR blob1 = 0z10
+ LET blob1 += test_null_blob()
+ call assert_equal(0z10, blob1)
+ LET blob1 = test_null_blob()
+ LET blob1 += 0z20
+ call assert_equal(0z20, blob1)
END
call v9.CheckLegacyAndVim9Success(lines)
@@ -97,6 +104,18 @@ func Test_blob_assign()
let lines =<< trim END
VAR b = 0zDEADBEEF
+ LET b[0 : 1] = 0x1122
+ END
+ call v9.CheckLegacyAndVim9Failure(lines, ['E709:', 'E1012:', 'E709:'])
+
+ let lines =<< trim END
+ VAR b = 0zDEADBEEF
+ LET b[0] = 0z11
+ END
+ call v9.CheckLegacyAndVim9Failure(lines, ['E974:', 'E974:', 'E1012:'])
+
+ let lines =<< trim END
+ VAR b = 0zDEADBEEF
LET b ..= 0z33
END
call v9.CheckLegacyAndVim9Failure(lines, ['E734:', 'E1019:', 'E734:'])
@@ -331,6 +350,17 @@ func Test_blob_for_loop()
call assert_equal(5, i)
END
call v9.CheckLegacyAndVim9Success(lines)
+
+ " Test for skipping the loop var assignment in a for loop
+ let lines =<< trim END
+ VAR blob = 0z998877
+ VAR c = 0
+ for _ in blob
+ LET c += 1
+ endfor
+ call assert_equal(3, c)
+ END
+ call v9.CheckLegacyAndVim9Success(lines)
endfunc
func Test_blob_concatenate()
@@ -819,6 +849,7 @@ func Test_indexof()
call assert_equal(-1, indexof(test_null_blob(), "v:val == 0xde"))
call assert_equal(-1, indexof(b, test_null_string()))
call assert_equal(-1, indexof(b, test_null_function()))
+ call assert_equal(-1, indexof(b, ""))
let b = 0z01020102
call assert_equal(1, indexof(b, "v:val == 0x02", #{startidx: 0}))
@@ -830,6 +861,7 @@ func Test_indexof()
" failure cases
call assert_fails('let i = indexof(b, "val == 0xde")', 'E121:')
call assert_fails('let i = indexof(b, {})', 'E1256:')
+ call assert_fails('let i = indexof(b, " ")', 'E15:')
endfunc
" vim: shiftwidth=2 sts=2 expandtab
diff --git a/src/testdir/test_cmdline.vim b/src/testdir/test_cmdline.vim
index ed8f89d..8b7489e 100644
--- a/src/testdir/test_cmdline.vim
+++ b/src/testdir/test_cmdline.vim
@@ -2741,6 +2741,55 @@ func Test_wildmenu_pum_odd_wildchar()
call StopVimInTerminal(buf)
endfunc
+" Test that 'rightleft' should not affect cmdline completion popup menu.
+func Test_wildmenu_pum_rightleft()
+ CheckFeature rightleft
+ CheckScreendump
+
+ let lines =<< trim END
+ set wildoptions=pum
+ set rightleft
+ END
+ call writefile(lines, 'Xwildmenu_pum_rl', 'D')
+ let buf = RunVimInTerminal('-S Xwildmenu_pum_rl', #{rows: 10, cols: 50})
+
+ call term_sendkeys(buf, ":sign \<Tab>")
+ call VerifyScreenDump(buf, 'Test_wildmenu_pum_rl', {})
+
+ call StopVimInTerminal(buf)
+endfunc
+
+" Test highlighting matched text in cmdline completion popup menu.
+func Test_wildmenu_pum_hl_match()
+ CheckScreendump
+
+ let lines =<< trim END
+ set wildoptions=pum,fuzzy
+ hi PmenuMatchSel ctermfg=6 ctermbg=7
+ hi PmenuMatch ctermfg=4 ctermbg=225
+ END
+ call writefile(lines, 'Xwildmenu_pum_hl', 'D')
+ let buf = RunVimInTerminal('-S Xwildmenu_pum_hl', #{rows: 10, cols: 50})
+
+ call term_sendkeys(buf, ":sign plc\<Tab>")
+ call VerifyScreenDump(buf, 'Test_wildmenu_pum_hl_match_1', {})
+ call term_sendkeys(buf, "\<Tab>")
+ call VerifyScreenDump(buf, 'Test_wildmenu_pum_hl_match_2', {})
+ call term_sendkeys(buf, "\<Tab>")
+ call VerifyScreenDump(buf, 'Test_wildmenu_pum_hl_match_3', {})
+ call term_sendkeys(buf, "\<Esc>:set wildoptions-=fuzzy\<CR>")
+ call TermWait(buf)
+ call term_sendkeys(buf, ":sign un\<Tab>")
+ call VerifyScreenDump(buf, 'Test_wildmenu_pum_hl_match_4', {})
+ call term_sendkeys(buf, "\<Tab>")
+ call VerifyScreenDump(buf, 'Test_wildmenu_pum_hl_match_5', {})
+ call term_sendkeys(buf, "\<Tab>")
+ call VerifyScreenDump(buf, 'Test_wildmenu_pum_hl_match_6', {})
+ call term_sendkeys(buf, "\<Esc>")
+
+ call StopVimInTerminal(buf)
+endfunc
+
" Test for completion after a :substitute command followed by a pipe (|)
" character
func Test_cmdline_complete_substitute()
diff --git a/src/testdir/test_edit.vim b/src/testdir/test_edit.vim
index 789e44c..1665330 100644
--- a/src/testdir/test_edit.vim
+++ b/src/testdir/test_edit.vim
@@ -1952,6 +1952,11 @@ func Test_edit_insert_reg()
let @r = 'sample'
call feedkeys("a\<C-R>=SaveFirstLine()\<CR>", "xt")
call assert_equal('"', g:Line)
+
+ " Test for inserting an null and an empty list
+ call feedkeys("a\<C-R>=test_null_list()\<CR>", "xt")
+ call feedkeys("a\<C-R>=[]\<CR>", "xt")
+ call assert_equal(['r'], getbufline('', 1, '$'))
call test_override('ALL', 0)
close!
endfunc
diff --git a/src/testdir/test_filecopy.vim b/src/testdir/test_filecopy.vim
new file mode 100644
index 0000000..b526dce
--- /dev/null
+++ b/src/testdir/test_filecopy.vim
@@ -0,0 +1,72 @@
+" Test filecopy()
+
+source check.vim
+source shared.vim
+
+func Test_copy_file_to_file()
+ call writefile(['foo'], 'Xcopy1')
+
+ call assert_true(filecopy('Xcopy1', 'Xcopy2'))
+
+ call assert_equal(['foo'], readfile('Xcopy2'))
+
+ " When the destination file already exists, it should not be overwritten.
+ call writefile(['foo'], 'Xcopy1')
+ call writefile(['bar'], 'Xcopy2', 'D')
+ call assert_false(filecopy('Xcopy1', 'Xcopy2'))
+ call assert_equal(['bar'], readfile('Xcopy2'))
+
+ call delete('Xcopy2')
+ call delete('Xcopy1')
+endfunc
+
+func Test_copy_symbolic_link()
+ CheckUnix
+
+ call writefile(['text'], 'Xtestfile', 'D')
+ silent !ln -s -f Xtestfile Xtestlink
+
+ call assert_true(filecopy('Xtestlink', 'Xtestlink2'))
+ call assert_equal('link', getftype('Xtestlink2'))
+ call assert_equal(['text'], readfile('Xtestlink2'))
+
+ " When the destination file already exists, it should not be overwritten.
+ call assert_false(filecopy('Xtestlink', 'Xtestlink2'))
+
+ call delete('Xtestlink2')
+ call delete('Xtestlink')
+ call delete('Xtestfile')
+endfunc
+
+func Test_copy_dir_to_dir()
+ call mkdir('Xcopydir1')
+ call writefile(['foo'], 'Xcopydir1/Xfilecopy')
+ call mkdir('Xcopydir2')
+
+ " Directory copy is not supported
+ call assert_false(filecopy('Xcopydir1', 'Xcopydir2'))
+
+ call delete('Xcopydir2', 'rf')
+ call delete('Xcopydir1', 'rf')
+endfunc
+
+func Test_copy_fails()
+ CheckUnix
+
+ call writefile(['foo'], 'Xfilecopy', 'D')
+
+ " Can't copy into a non-existing directory.
+ call assert_false(filecopy('Xfilecopy', 'Xdoesnotexist/Xfilecopy'))
+
+ " Can't copy a non-existing file.
+ call assert_false(filecopy('Xdoesnotexist', 'Xfilecopy2'))
+ call assert_equal('', glob('Xfilecopy2'))
+
+ " Can't copy to en empty file name.
+ call assert_false(filecopy('Xfilecopy', ''))
+
+ call assert_fails('call filecopy("Xfilecopy", [])', 'E1174:')
+ call assert_fails('call filecopy(0z, "Xfilecopy")', 'E1174:')
+endfunc
+
+" vim: shiftwidth=2 sts=2 expandtab
diff --git a/src/testdir/test_filetype.vim b/src/testdir/test_filetype.vim
index f8fe9ec..d0a078f 100644
--- a/src/testdir/test_filetype.vim
+++ b/src/testdir/test_filetype.vim
@@ -131,7 +131,7 @@ def s:GetFilenameChecks(): dict<list<string>>
bst: ['file.bst'],
bzl: ['file.bazel', 'file.bzl', 'WORKSPACE', 'WORKSPACE.bzlmod'],
bzr: ['bzr_log.any', 'bzr_log.file'],
- c: ['enlightenment/file.cfg', 'file.qc', 'file.c', 'some-enlightenment/file.cfg'],
+ c: ['enlightenment/file.cfg', 'file.qc', 'file.c', 'some-enlightenment/file.cfg', 'file.mdh', 'file.epro'],
cabal: ['file.cabal'],
cabalconfig: ['cabal.config', expand("$HOME/.config/cabal/config")] + WhenConfigHome('$XDG_CONFIG_HOME/cabal/config'),
cabalproject: ['cabal.project', 'cabal.project.local'],
@@ -336,6 +336,7 @@ def s:GetFilenameChecks(): dict<list<string>>
htmlm4: ['file.html.m4'],
httest: ['file.htt', 'file.htb'],
hurl: ['file.hurl'],
+ hyprlang: ['hyprlock.conf', 'hyprland.conf', 'hypridle.conf', 'hyprpaper.conf'],
i3config: ['/home/user/.i3/config', '/home/user/.config/i3/config', '/etc/i3/config', '/etc/xdg/i3/config'],
ibasic: ['file.iba', 'file.ibi'],
icemenu: ['/.icewm/menu', 'any/.icewm/menu'],
@@ -344,6 +345,7 @@ def s:GetFilenameChecks(): dict<list<string>>
inform: ['file.inf', 'file.INF'],
initng: ['/etc/initng/any/file.i', 'file.ii', 'any/etc/initng/any/file.i'],
inittab: ['inittab'],
+ inko: ['file.inko'],
ipfilter: ['ipf.conf', 'ipf6.conf', 'ipf.rules'],
iss: ['file.iss'],
ist: ['file.ist', 'file.mst'],
@@ -358,10 +360,11 @@ def s:GetFilenameChecks(): dict<list<string>>
javascriptreact: ['file.jsx'],
jess: ['file.clp'],
jgraph: ['file.jgr'],
+ jj: ['file.jjdescription'],
jq: ['file.jq'],
jovial: ['file.jov', 'file.j73', 'file.jovial'],
jproperties: ['file.properties', 'file.properties_xx', 'file.properties_xx_xx', 'some.properties_xx_xx_file', 'org.eclipse.xyz.prefs'],
- json: ['file.json', 'file.jsonp', 'file.json-patch', 'file.geojson', 'file.webmanifest', 'Pipfile.lock', 'file.ipynb', 'file.jupyterlab-settings', '.prettierrc', '.firebaserc', '.stylelintrc', 'file.slnf', 'file.sublime-project', 'file.sublime-settings', 'file.sublime-workspace', 'file.bd', 'file.bda', 'file.xci', 'flake.lock'],
+ json: ['file.json', 'file.jsonp', 'file.json-patch', 'file.geojson', 'file.webmanifest', 'Pipfile.lock', 'file.ipynb', 'file.jupyterlab-settings', '.prettierrc', '.firebaserc', '.stylelintrc', '.lintstagedrc', 'file.slnf', 'file.sublime-project', 'file.sublime-settings', 'file.sublime-workspace', 'file.bd', 'file.bda', 'file.xci', 'flake.lock'],
json5: ['file.json5'],
jsonc: ['file.jsonc', '.babelrc', '.eslintrc', '.jsfmtrc', '.jshintrc', '.jscsrc', '.vsconfig', '.hintrc', '.swrc', 'jsconfig.json', 'tsconfig.json', 'tsconfig.test.json', 'tsconfig-test.json', '.luaurc'],
jsonl: ['file.jsonl'],
@@ -417,7 +420,7 @@ def s:GetFilenameChecks(): dict<list<string>>
mail: ['snd.123', '.letter', '.letter.123', '.followup', '.article', '.article.123', 'pico.123', 'mutt-xx-xxx', 'muttng-xx-xxx', 'ae123.txt', 'file.eml', 'reportbug-file'],
mailaliases: ['/etc/mail/aliases', '/etc/aliases', 'any/etc/aliases', 'any/etc/mail/aliases'],
mailcap: ['.mailcap', 'mailcap'],
- make: ['file.mk', 'file.mak', 'file.dsp', 'makefile', 'Makefile', 'makefile-file', 'Makefile-file', 'some-makefile', 'some-Makefile'],
+ make: ['file.mk', 'file.mak', 'file.dsp', 'makefile', 'Makefile', 'makefile-file', 'Makefile-file', 'some-makefile', 'some-Makefile', 'Kbuild'],
mallard: ['file.page'],
man: ['file.man'],
manconf: ['/etc/man.conf', 'man.config', 'any/etc/man.conf'],
@@ -574,6 +577,7 @@ def s:GetFilenameChecks(): dict<list<string>>
psl: ['file.psl'],
pug: ['file.pug'],
puppet: ['file.pp'],
+ purescript: ['file.purs'],
pymanifest: ['MANIFEST.in'],
pyret: ['file.arr'],
pyrex: ['file.pyx', 'file.pxd'],
@@ -588,6 +592,7 @@ def s:GetFilenameChecks(): dict<list<string>>
radiance: ['file.rad', 'file.mat'],
raku: ['file.pm6', 'file.p6', 'file.t6', 'file.pod6', 'file.raku', 'file.rakumod', 'file.rakudoc', 'file.rakutest'],
raml: ['file.raml'],
+ rasi: ['file.rasi'],
ratpoison: ['.ratpoisonrc', 'ratpoisonrc'],
rbs: ['file.rbs'],
rc: ['file.rc', 'file.rch'],
@@ -640,7 +645,7 @@ def s:GetFilenameChecks(): dict<list<string>>
sh: ['.bashrc', '.bash_profile', '.bash-profile', '.bash_logout', '.bash-logout', '.bash_aliases', '.bash-aliases', '.bash_history', '.bash-history',
'/tmp/bash-fc-3Ozjlw', '/tmp/bash-fc.3Ozjlw', 'PKGBUILD', 'APKBUILD', 'file.bash', '/usr/share/doc/bash-completion/filter.sh',
'/etc/udev/cdsymlinks.conf', 'any/etc/udev/cdsymlinks.conf', 'file.bats', '.ash_history', 'any/etc/neofetch/config.conf', '.xprofile',
- 'user-dirs.defaults', 'user-dirs.dirs', 'makepkg.conf', '.makepkg.conf'],
+ 'user-dirs.defaults', 'user-dirs.dirs', 'makepkg.conf', '.makepkg.conf', 'file.mdd', 'file.cygport'],
sieve: ['file.siv', 'file.sieve'],
sil: ['file.sil'],
simula: ['file.sim'],
@@ -651,6 +656,7 @@ def s:GetFilenameChecks(): dict<list<string>>
slang: ['file.sl'],
sage: ['file.sage'],
slice: ['file.ice'],
+ slint: ['file.slint'],
slpconf: ['/etc/slp.conf', 'any/etc/slp.conf'],
slpreg: ['/etc/slp.reg', 'any/etc/slp.reg'],
slpspi: ['/etc/slp.spi', 'any/etc/slp.spi'],
@@ -663,6 +669,7 @@ def s:GetFilenameChecks(): dict<list<string>>
smith: ['file.smt', 'file.smith'],
smithy: ['file.smithy'],
sml: ['file.sml'],
+ snakemake: ['file.smk', 'Snakefile'],
snobol4: ['file.sno', 'file.spt'],
solidity: ['file.sol'],
solution: ['file.sln'],
@@ -686,6 +693,7 @@ def s:GetFilenameChecks(): dict<list<string>>
starlark: ['file.ipd', 'file.star', 'file.starlark'],
stata: ['file.ado', 'file.do', 'file.imata', 'file.mata'],
stp: ['file.stp'],
+ stylus: ['a.styl', 'file.stylus'],
sudoers: ['any/etc/sudoers', 'sudoers.tmp', '/etc/sudoers', 'any/etc/sudoers.d/file'],
supercollider: ['file.quark'],
surface: ['file.sface'],
@@ -746,11 +754,12 @@ def s:GetFilenameChecks(): dict<list<string>>
tcl: ['file.tcl', 'file.tm', 'file.tk', 'file.itcl', 'file.itk', 'file.jacl', '.tclshrc', 'tclsh.rc', '.wishrc', '.tclsh-history', '.xsctcmdhistory', '.xsdbcmdhistory'],
tablegen: ['file.td'],
teal: ['file.tl'],
+ templ: ['file.templ'],
template: ['file.tmpl'],
teraterm: ['file.ttl'],
terminfo: ['file.ti'],
'terraform-vars': ['file.tfvars'],
- tex: ['file.latex', 'file.sty', 'file.dtx', 'file.ltx', 'file.bbl', 'any/.texlive/texmf-config/tex/latex/file/file.cfg', 'file.pgf', 'file.nlo', 'file.nls', 'file.out', 'file.thm', 'file.eps_tex', 'file.pygtex', 'file.pygstyle', 'file.clo', 'file.aux', 'file.brf', 'file.ind', 'file.lof', 'file.loe', 'file.nav', 'file.vrb', 'file.ins', 'file.tikz', 'file.bbx', 'file.cbx', 'file.beamer'],
+ tex: ['file.latex', 'file.sty', 'file.dtx', 'file.ltx', 'file.bbl', 'any/.texlive/texmf-config/tex/latex/file/file.cfg', 'file.pgf', 'file.nlo', 'file.nls', 'file.thm', 'file.eps_tex', 'file.pygtex', 'file.pygstyle', 'file.clo', 'file.aux', 'file.brf', 'file.ind', 'file.lof', 'file.loe', 'file.nav', 'file.vrb', 'file.ins', 'file.tikz', 'file.bbx', 'file.cbx', 'file.beamer'],
texinfo: ['file.texinfo', 'file.texi', 'file.txi'],
texmf: ['texmf.cnf'],
text: ['file.text', 'file.txt', 'README', 'LICENSE', 'COPYING', 'AUTHORS', '/usr/share/doc/bash-completion/AUTHORS', '/etc/apt/apt.conf.d/README', '/etc/Muttrc.d/README'],
@@ -985,6 +994,7 @@ def s:GetScriptChecks(): dict<list<list<string>>>
['#!/path/regina']],
janet: [['#!/path/janet']],
dart: [['#!/path/dart']],
+ vim: [['#!/path/vim']],
}
enddef
@@ -1506,6 +1516,41 @@ func Test_git_file()
filetype off
endfunc
+func Test_haredoc_file()
+ filetype on
+ call assert_true(mkdir('foo/bar', 'pR'))
+
+ call writefile([], 'README', 'D')
+ split README
+ call assert_notequal('haredoc', &filetype)
+ bwipe!
+
+ let g:filetype_haredoc = 1
+ split README
+ call assert_notequal('haredoc', &filetype)
+ bwipe!
+
+ call writefile([], 'foo/quux.ha')
+ split README
+ call assert_equal('haredoc', &filetype)
+ bwipe!
+ call delete('foo/quux.ha')
+
+ call writefile([], 'foo/bar/baz.ha', 'D')
+ split README
+ call assert_notequal('haredoc', &filetype)
+ bwipe!
+
+ let g:haredoc_search_depth = 2
+ split README
+ call assert_equal('haredoc', &filetype)
+ bwipe!
+ unlet g:filetype_haredoc
+ unlet g:haredoc_search_depth
+
+ filetype off
+endfunc
+
func Test_hook_file()
filetype on
@@ -1684,14 +1729,14 @@ func Test_mod_file()
call assert_equal('pim', b:modula2.dialect)
bwipe!
- " Modula-2 program MODULE with priorty (and uppercase extension)
+ " Modula-2 program MODULE with priority (and uppercase extension)
call writefile(['MODULE Module2Mod [42];'], 'Xfile.MOD')
split Xfile.MOD
call assert_equal('modula2', &filetype)
call assert_equal('pim', b:modula2.dialect)
bwipe!
- " Modula-2 implementation MODULE with priorty (and uppercase extension)
+ " Modula-2 implementation MODULE with priority (and uppercase extension)
call writefile(['IMPLEMENTATION MODULE Module2Mod [42];'], 'Xfile.MOD')
split Xfile.MOD
call assert_equal('modula2', &filetype)
diff --git a/src/testdir/test_fold.vim b/src/testdir/test_fold.vim
index 3c78e62..dedc4a2 100644
--- a/src/testdir/test_fold.vim
+++ b/src/testdir/test_fold.vim
@@ -8,7 +8,73 @@ func PrepIndent(arg)
return [a:arg] + repeat(["\t".a:arg], 5)
endfu
-func Test_address_fold()
+func Test_address_fold_new_default_commentstring()
+ " Test with the new commentstring defaults, that includes padding after v9.1.464
+ new
+ call setline(1, ['int FuncName() {/* {{{ */', 1, 2, 3, 4, 5, '}/* }}} */',
+ \ 'after fold 1', 'after fold 2', 'after fold 3'])
+ setl fen fdm=marker
+ " The next commands should all copy the same part of the buffer,
+ " regardless of the addressing type, since the part to be copied
+ " is folded away
+ :1y
+ call assert_equal(['int FuncName() {/* {{{ */', '1', '2', '3', '4', '5', '}/* }}} */'], getreg(0,1,1))
+ :.y
+ call assert_equal(['int FuncName() {/* {{{ */', '1', '2', '3', '4', '5', '}/* }}} */'], getreg(0,1,1))
+ :.+y
+ call assert_equal(['int FuncName() {/* {{{ */', '1', '2', '3', '4', '5', '}/* }}} */'], getreg(0,1,1))
+ :.,.y
+ call assert_equal(['int FuncName() {/* {{{ */', '1', '2', '3', '4', '5', '}/* }}} */'], getreg(0,1,1))
+ :sil .1,.y
+ call assert_equal(['int FuncName() {/* {{{ */', '1', '2', '3', '4', '5', '}/* }}} */'], getreg(0,1,1))
+ " use silent to make E493 go away
+ :sil .+,.y
+ call assert_equal(['int FuncName() {/* {{{ */', '1', '2', '3', '4', '5', '}/* }}} */'], getreg(0,1,1))
+ :,y
+ call assert_equal(['int FuncName() {/* {{{ */', '1', '2', '3', '4', '5', '}/* }}} */'], getreg(0,1,1))
+ :,+y
+ call assert_equal(['int FuncName() {/* {{{ */', '1', '2', '3', '4', '5', '}/* }}} */','after fold 1'], getreg(0,1,1))
+ " using .+3 as second address should c opy the whole folded line + the next 3
+ " lines
+ :.,+3y
+ call assert_equal(['int FuncName() {/* {{{ */', '1', '2', '3', '4', '5', '}/* }}} */',
+ \ 'after fold 1', 'after fold 2' , 'after fold 3'], getreg(0,1,1))
+ :sil .,-2y
+ call assert_equal(['int FuncName() {/* {{{ */', '1', '2', '3', '4', '5', '}/* }}} */'], getreg(0,1,1))
+
+ " now test again with folding disabled
+ set nofoldenable
+ :1y
+ call assert_equal(['int FuncName() {/* {{{ */'], getreg(0,1,1))
+ :.y
+ call assert_equal(['int FuncName() {/* {{{ */'], getreg(0,1,1))
+ :.+y
+ call assert_equal(['1'], getreg(0,1,1) )
+ :.,.y
+ call assert_equal(['int FuncName() {/* {{{ */'], getreg(0,1,1))
+ " use silent to make E493 go away
+ :sil .1,.y
+ call assert_equal(['int FuncName() {/* {{{ */', '1'], getreg(0,1,1))
+ " use silent to make E493 go away
+ :sil .+,.y
+ call assert_equal(['int FuncName() {/* {{{ */', '1'], getreg(0,1,1))
+ :,y
+ call assert_equal(['int FuncName() {/* {{{ */'], getreg(0,1,1))
+ :,+y
+ call assert_equal(['int FuncName() {/* {{{ */', '1'], getreg(0,1,1))
+ " using .+3 as second address should c opy the whole folded line + the next 3
+ " lines
+ :.,+3y
+ call assert_equal(['int FuncName() {/* {{{ */', '1', '2', '3'], getreg(0,1,1))
+ :7
+ :sil .,-2y
+ call assert_equal(['4', '5', '}/* }}} */'], getreg(0,1,1))
+
+ quit!
+endfunc
+
+func Test_address_fold_old_default_commentstring()
+ " Test with the old commentstring defaults, before v9.1.464
new
call setline(1, ['int FuncName() {/*{{{*/', 1, 2, 3, 4, 5, '}/*}}}*/',
\ 'after fold 1', 'after fold 2', 'after fold 3'])
@@ -719,7 +785,7 @@ func Test_fold_create_marker_in_C()
call append(0, content)
call cursor(c + 1, 1)
norm! zfG
- call assert_equal(content[c] . (c < 4 ? '{{{' : '/*{{{*/'), getline(c + 1))
+ call assert_equal(content[c] . (c < 4 ? '{{{' : '/* {{{ */'), getline(c + 1))
endfor
set fdm& fdl&
@@ -1601,6 +1667,63 @@ func Test_foldtext_scriptlocal_func()
delfunc s:FoldText
endfunc
+" Test for setting 'foldtext' from the modeline and executing the expression
+" in a sandbox
+func Test_foldtext_in_modeline()
+ func ModelineFoldText()
+ call feedkeys('aFoo', 'xt')
+ return "folded text"
+ endfunc
+ let lines =<< trim END
+ func T()
+ let i = 1
+ endfunc
+ " vim: foldenable foldtext=ModelineFoldText()
+ END
+ call writefile(lines, 'Xmodelinefoldtext', 'D')
+
+ set modeline modelineexpr
+ split Xmodelinefoldtext
+
+ call cursor(1, 1)
+ normal! zf3j
+ call assert_equal('folded text', foldtextresult(1))
+ call assert_equal(lines, getbufline('', 1, '$'))
+
+ bw!
+ set modeline& modelineexpr&
+ delfunc ModelineFoldText
+endfunc
+
+" Test for setting 'foldexpr' from the modeline and executing the expression
+" in a sandbox
+func Test_foldexpr_in_modeline()
+ func ModelineFoldExpr()
+ call feedkeys('aFoo', 'xt')
+ return strlen(matchstr(getline(v:lnum),'^\s*'))
+ endfunc
+ let lines =<< trim END
+ aaa
+ bbb
+ ccc
+ ccc
+ bbb
+ aaa
+ " vim: foldenable foldmethod=expr foldexpr=ModelineFoldExpr()
+ END
+ call writefile(lines, 'Xmodelinefoldexpr', 'D')
+
+ set modeline modelineexpr
+ split Xmodelinefoldexpr
+
+ call assert_equal(2, foldlevel(3))
+ call assert_equal(lines, getbufline('', 1, '$'))
+
+ bw!
+ set modeline& modelineexpr&
+ delfunc ModelineFoldExpr
+endfunc
+
" Make sure a fold containing a nested fold is split correctly when using
" foldmethod=indent
func Test_fold_split()
diff --git a/src/testdir/test_functions.vim b/src/testdir/test_functions.vim
index f0d7385..acdb954 100644
--- a/src/testdir/test_functions.vim
+++ b/src/testdir/test_functions.vim
@@ -3697,6 +3697,73 @@ func Test_getmousepos()
\ column: 8,
\ coladd: 21,
\ }, getmousepos())
+
+ 30vnew
+ setlocal smoothscroll number
+ call setline(1, join(range(100)))
+ exe "normal! \<C-E>"
+ call test_setmouse(1, 5)
+ call assert_equal(#{
+ \ screenrow: 1,
+ \ screencol: 5,
+ \ winid: win_getid(),
+ \ winrow: 1,
+ \ wincol: 5,
+ \ line: 1,
+ \ column: 27,
+ \ coladd: 0,
+ \ }, getmousepos())
+ call test_setmouse(2, 5)
+ call assert_equal(#{
+ \ screenrow: 2,
+ \ screencol: 5,
+ \ winid: win_getid(),
+ \ winrow: 2,
+ \ wincol: 5,
+ \ line: 1,
+ \ column: 53,
+ \ coladd: 0,
+ \ }, getmousepos())
+
+ exe "normal! \<C-E>"
+ call test_setmouse(1, 5)
+ call assert_equal(#{
+ \ screenrow: 1,
+ \ screencol: 5,
+ \ winid: win_getid(),
+ \ winrow: 1,
+ \ wincol: 5,
+ \ line: 1,
+ \ column: 53,
+ \ coladd: 0,
+ \ }, getmousepos())
+ call test_setmouse(2, 5)
+ call assert_equal(#{
+ \ screenrow: 2,
+ \ screencol: 5,
+ \ winid: win_getid(),
+ \ winrow: 2,
+ \ wincol: 5,
+ \ line: 1,
+ \ column: 79,
+ \ coladd: 0,
+ \ }, getmousepos())
+
+ vert resize 4
+ call test_setmouse(2, 2)
+ " This used to crash Vim
+ call assert_equal(#{
+ \ screenrow: 2,
+ \ screencol: 2,
+ \ winid: win_getid(),
+ \ winrow: 2,
+ \ wincol: 2,
+ \ line: 1,
+ \ column: 53,
+ \ coladd: 0,
+ \ }, getmousepos())
+
+ bwipe!
bwipe!
endfunc
@@ -3728,6 +3795,33 @@ func Test_glob()
call assert_fails("call glob('*', 0, {})", 'E728:')
endfunc
+func Test_glob2()
+ call mkdir('[XglobDir]', 'R')
+ call mkdir('abc[glob]def', 'R')
+
+ call writefile(['glob'], '[XglobDir]/Xglob')
+ call writefile(['glob'], 'abc[glob]def/Xglob')
+ if has("unix")
+ call assert_equal([], (glob('[XglobDir]/*', 0, 1)))
+ call assert_equal([], (glob('abc[glob]def/*', 0, 1)))
+ call assert_equal(['[XglobDir]/Xglob'], (glob('\[XglobDir]/*', 0, 1)))
+ call assert_equal(['abc[glob]def/Xglob'], (glob('abc\[glob]def/*', 0, 1)))
+ elseif has("win32")
+ let _sl=&shellslash
+ call assert_equal([], (glob('[XglobDir]\*', 0, 1)))
+ call assert_equal([], (glob('abc[glob]def\*', 0, 1)))
+ call assert_equal([], (glob('\[XglobDir]\*', 0, 1)))
+ call assert_equal([], (glob('abc\[glob]def\*', 0, 1)))
+ set noshellslash
+ call assert_equal(['[XglobDir]\Xglob'], (glob('[[]XglobDir]/*', 0, 1)))
+ call assert_equal(['abc[glob]def\Xglob'], (glob('abc[[]glob]def/*', 0, 1)))
+ set shellslash
+ call assert_equal(['[XglobDir]/Xglob'], (glob('[[]XglobDir]/*', 0, 1)))
+ call assert_equal(['abc[glob]def/Xglob'], (glob('abc[[]glob]def/*', 0, 1)))
+ let &shellslash=_sl
+ endif
+endfunc
+
" Test for browse()
func Test_browse()
CheckFeature browse
@@ -4039,6 +4133,8 @@ func Test_slice()
call assert_equal('', 'ὰ̳β̳́γ̳̂δ̳̃ε̳̄ζ̳̅'->slice(1, -6))
END
call v9.CheckLegacyAndVim9Success(lines)
+
+ call assert_equal(0, slice(v:true, 1))
endfunc
" vim: shiftwidth=2 sts=2 expandtab
diff --git a/src/testdir/test_global.vim b/src/testdir/test_global.vim
index 34857b2..0f72c3c 100644
--- a/src/testdir/test_global.vim
+++ b/src/testdir/test_global.vim
@@ -116,7 +116,16 @@ func Test_global_newline()
close!
endfunc
-func Test_wrong_delimiter()
+" Test :g with ? as delimiter.
+func Test_global_question_delimiter()
+ new
+ call setline(1, ['aaaaa', 'b?bbb', 'ccccc', 'ddd?d', 'eeeee'])
+ g?\??delete
+ call assert_equal(['aaaaa', 'ccccc', 'eeeee'], getline(1, '$'))
+ bwipe!
+endfunc
+
+func Test_global_wrong_delimiter()
call assert_fails('g x^bxd', 'E146:')
endfunc
diff --git a/src/testdir/test_gui.vim b/src/testdir/test_gui.vim
index 2ff8d34..d53750f 100644
--- a/src/testdir/test_gui.vim
+++ b/src/testdir/test_gui.vim
@@ -899,7 +899,7 @@ func Test_set_term()
endfunc
func Test_windowid_variable()
- if (g:x11_based_gui && empty($WAYLAND_DISPLAY)) || has('win32')
+ if g:x11_based_gui || has('win32')
call assert_true(v:windowid > 0)
else
call assert_equal(0, v:windowid)
diff --git a/src/testdir/test_history.vim b/src/testdir/test_history.vim
index 19490f2..b288abc 100644
--- a/src/testdir/test_history.vim
+++ b/src/testdir/test_history.vim
@@ -96,6 +96,60 @@ function Test_History()
call assert_fails('history xyz', 'E488:')
call assert_fails('history ,abc', 'E488:')
call assert_fails('call histdel(":", "\\%(")', 'E53:')
+
+ " Test for filtering the history list
+ let hist_filter = execute(':filter /_\d/ :history all')->split('\n')
+ call assert_equal(20, len(hist_filter))
+ let expected = [' # cmd history',
+ \ ' 2 text_2',
+ \ ' 3 text_3',
+ \ '> 4 text_4',
+ \ ' # search history',
+ \ ' 2 text_2',
+ \ ' 3 text_3',
+ \ '> 4 text_4',
+ \ ' # expr history',
+ \ ' 2 text_2',
+ \ ' 3 text_3',
+ \ '> 4 text_4',
+ \ ' # input history',
+ \ ' 2 text_2',
+ \ ' 3 text_3',
+ \ '> 4 text_4',
+ \ ' # debug history',
+ \ ' 2 text_2',
+ \ ' 3 text_3',
+ \ '> 4 text_4']
+ call assert_equal(expected, hist_filter)
+
+ let cmds = {'c': 'cmd', 's': 'search', 'e': 'expr', 'i': 'input', 'd': 'debug'}
+ for h in sort(keys(cmds))
+ " find some items
+ let hist_filter = execute(':filter /_\d/ :history ' .. h)->split('\n')
+ call assert_equal(4, len(hist_filter))
+
+ let expected = [' # ' .. cmds[h] .. ' history',
+ \ ' 2 text_2',
+ \ ' 3 text_3',
+ \ '> 4 text_4']
+ call assert_equal(expected, hist_filter)
+
+ " Search for an item that is not there
+ let hist_filter = execute(':filter /XXXX/ :history ' .. h)->split('\n')
+ call assert_equal(1, len(hist_filter))
+
+ let expected = [' # ' .. cmds[h] .. ' history']
+ call assert_equal(expected, hist_filter)
+
+ " Invert the filter condition, find non-matches
+ let hist_filter = execute(':filter! /_3$/ :history ' .. h)->split('\n')
+ call assert_equal(3, len(hist_filter))
+
+ let expected = [' # ' .. cmds[h] .. ' history',
+ \ ' 2 text_2',
+ \ '> 4 text_4']
+ call assert_equal(expected, hist_filter)
+ endfor
endfunction
function Test_history_truncates_long_entry()
diff --git a/src/testdir/test_ins_complete.vim b/src/testdir/test_ins_complete.vim
index eb89a15..48589ce 100644
--- a/src/testdir/test_ins_complete.vim
+++ b/src/testdir/test_ins_complete.vim
@@ -630,14 +630,14 @@ func Test_pum_with_preview_win()
CheckScreendump
let lines =<< trim END
- funct Omni_test(findstart, base)
- if a:findstart
- return col(".") - 1
- endif
- return [#{word: "one", info: "1info"}, #{word: "two", info: "2info"}, #{word: "three", info: "3info"}]
- endfunc
- set omnifunc=Omni_test
- set completeopt+=longest
+ func Omni_test(findstart, base)
+ if a:findstart
+ return col(".") - 1
+ endif
+ return [#{word: "one", info: "1info"}, #{word: "two", info: "2info"}, #{word: "three", info: "3info"}]
+ endfunc
+ set omnifunc=Omni_test
+ set completeopt+=longest
END
call writefile(lines, 'Xpreviewscript', 'D')
@@ -809,6 +809,74 @@ func Test_complete_with_longest()
bwipe!
endfunc
+" Test for buffer-local value of 'completeopt'
+func Test_completeopt_buffer_local()
+ set completeopt=menu
+ new
+ call setline(1, ['foofoo', 'foobar', 'foobaz', ''])
+ call assert_equal('', &l:completeopt)
+ call assert_equal('menu', &completeopt)
+ call assert_equal('menu', &g:completeopt)
+
+ setlocal bufhidden=hide
+ enew
+ call setline(1, ['foofoo', 'foobar', 'foobaz', ''])
+ call assert_equal('', &l:completeopt)
+ call assert_equal('menu', &completeopt)
+ call assert_equal('menu', &g:completeopt)
+
+ setlocal completeopt+=fuzzy,noinsert
+ call assert_equal('menu,fuzzy,noinsert', &l:completeopt)
+ call assert_equal('menu,fuzzy,noinsert', &completeopt)
+ call assert_equal('menu', &g:completeopt)
+ call feedkeys("Gccf\<C-X>\<C-N>bz\<C-Y>", 'tnix')
+ call assert_equal('foobaz', getline('.'))
+
+ setlocal completeopt=
+ call assert_equal('', &l:completeopt)
+ call assert_equal('menu', &completeopt)
+ call assert_equal('menu', &g:completeopt)
+ call feedkeys("Gccf\<C-X>\<C-N>\<C-Y>", 'tnix')
+ call assert_equal('foofoo', getline('.'))
+
+ setlocal completeopt+=longest
+ call assert_equal('menu,longest', &l:completeopt)
+ call assert_equal('menu,longest', &completeopt)
+ call assert_equal('menu', &g:completeopt)
+ call feedkeys("Gccf\<C-X>\<C-N>\<C-X>\<C-Z>", 'tnix')
+ call assert_equal('foo', getline('.'))
+
+ setlocal bufhidden=hide
+ buffer #
+ call assert_equal('', &l:completeopt)
+ call assert_equal('menu', &completeopt)
+ call assert_equal('menu', &g:completeopt)
+ call feedkeys("Gccf\<C-X>\<C-N>\<C-Y>", 'tnix')
+ call assert_equal('foofoo', getline('.'))
+
+ setlocal completeopt+=fuzzy,noinsert
+ call assert_equal('menu,fuzzy,noinsert', &l:completeopt)
+ call assert_equal('menu,fuzzy,noinsert', &completeopt)
+ call assert_equal('menu', &g:completeopt)
+ call feedkeys("Gccf\<C-X>\<C-N>bz\<C-Y>", 'tnix')
+ call assert_equal('foobaz', getline('.'))
+
+ buffer #
+ call assert_equal('menu,longest', &l:completeopt)
+ call assert_equal('menu,longest', &completeopt)
+ call assert_equal('menu', &g:completeopt)
+ call feedkeys("Gccf\<C-X>\<C-N>\<C-X>\<C-Z>", 'tnix')
+ call assert_equal('foo', getline('.'))
+
+ setlocal bufhidden=wipe
+ buffer! #
+ bwipe!
+ call assert_equal('', &l:completeopt)
+ call assert_equal('menu', &completeopt)
+ call assert_equal('menu', &g:completeopt)
+
+ set completeopt&
+endfunc
" Test for completing words following a completed word in a line
func Test_complete_wrapscan()
@@ -2451,4 +2519,104 @@ func Test_completefunc_first_call_complete_add()
bwipe!
endfunc
+func Test_complete_fuzzy_match()
+ func OnPumChange()
+ let g:item = get(v:event, 'completed_item', {})
+ let g:word = get(g:item, 'word', v:null)
+ endfunction
+
+ augroup AAAAA_Group
+ au!
+ autocmd CompleteChanged * :call OnPumChange()
+ augroup END
+
+ func Omni_test(findstart, base)
+ if a:findstart
+ return col(".")
+ endif
+ return [#{word: "foo"}, #{word: "foobar"}, #{word: "fooBaz"}, #{word: "foobala"}]
+ endfunc
+
+ new
+ set omnifunc=Omni_test
+ set completeopt+=noinsert,fuzzy
+ call feedkeys("Gi\<C-x>\<C-o>", 'tx')
+ call assert_equal('foo', g:word)
+ call feedkeys("S\<C-x>\<C-o>fb", 'tx')
+ call assert_equal('fooBaz', g:word)
+ call feedkeys("S\<C-x>\<C-o>fa", 'tx')
+ call assert_equal('foobar', g:word)
+ " select next
+ call feedkeys("S\<C-x>\<C-o>fb\<C-n>", 'tx')
+ call assert_equal('foobar', g:word)
+ " can cyclically select next
+ call feedkeys("S\<C-x>\<C-o>fb\<C-n>\<C-n>\<C-n>", 'tx')
+ call assert_equal(v:null, g:word)
+ " select prev
+ call feedkeys("S\<C-x>\<C-o>fb\<C-p>", 'tx')
+ call assert_equal(v:null, g:word)
+ " can cyclically select prev
+ call feedkeys("S\<C-x>\<C-o>fb\<C-p>\<C-p>\<C-p>\<C-p>", 'tx')
+ call assert_equal('fooBaz', g:word)
+
+ func Comp()
+ call complete(col('.'), ["fooBaz", "foobar", "foobala"])
+ return ''
+ endfunc
+ call feedkeys("i\<C-R>=Comp()\<CR>", 'tx')
+ call assert_equal('fooBaz', g:word)
+
+ " respect noselect
+ set completeopt+=noselect
+ call feedkeys("S\<C-x>\<C-o>fb", 'tx')
+ call assert_equal(v:null, g:word)
+ call feedkeys("S\<C-x>\<C-o>fb\<C-n>", 'tx')
+ call assert_equal('fooBaz', g:word)
+
+ " avoid breaking default completion behavior
+ set completeopt=fuzzy,menu
+ call setline(1, ['hello help hero h'])
+ " Use "!" flag of feedkeys() so that ex_normal_busy is not set and
+ " ins_compl_check_keys() is not skipped.
+ " Add a "0" after the <Esc> to avoid waiting for an escape sequence.
+ call feedkeys("A\<C-X>\<C-N>\<Esc>0", 'tx!')
+ call assert_equal('hello help hero hello', getline('.'))
+ set completeopt+=noinsert
+ call setline(1, ['hello help hero h'])
+ call feedkeys("A\<C-X>\<C-N>\<Esc>0", 'tx!')
+ call assert_equal('hello help hero h', getline('.'))
+
+ " clean up
+ set omnifunc=
+ bw!
+ set complete& completeopt&
+ autocmd! AAAAA_Group
+ augroup! AAAAA_Group
+ delfunc OnPumChange
+ delfunc Omni_test
+ delfunc Comp
+ unlet g:item
+ unlet g:word
+endfunc
+
+" Check that tie breaking is stable for completeopt+=fuzzy (which should
+" behave the same on different platforms).
+func Test_complete_fuzzy_match_tie()
+ new
+ set completeopt+=fuzzy,noselect
+ call setline(1, ['aaabbccc', 'aaabbCCC', 'aaabbcccc', 'aaabbCCCC', ''])
+
+ call feedkeys("Gcc\<C-X>\<C-N>ab\<C-N>\<C-Y>", 'tx')
+ call assert_equal('aaabbccc', getline('.'))
+ call feedkeys("Gcc\<C-X>\<C-N>ab\<C-N>\<C-N>\<C-Y>", 'tx')
+ call assert_equal('aaabbCCC', getline('.'))
+ call feedkeys("Gcc\<C-X>\<C-N>ab\<C-N>\<C-N>\<C-N>\<C-Y>", 'tx')
+ call assert_equal('aaabbcccc', getline('.'))
+ call feedkeys("Gcc\<C-X>\<C-N>ab\<C-N>\<C-N>\<C-N>\<C-N>\<C-Y>", 'tx')
+ call assert_equal('aaabbCCCC', getline('.'))
+
+ bwipe!
+ set completeopt&
+endfunc
+
" vim: shiftwidth=2 sts=2 expandtab nofoldenable
diff --git a/src/testdir/test_listdict.vim b/src/testdir/test_listdict.vim
index 4c69476..12a6dd4 100644
--- a/src/testdir/test_listdict.vim
+++ b/src/testdir/test_listdict.vim
@@ -60,6 +60,9 @@ func Test_list_slice()
assert_equal([1, 2], l[-3 : -1])
END
call v9.CheckDefAndScriptSuccess(lines)
+
+ call assert_fails('let l[[]] = 1', 'E730: Using a List as a String')
+ call assert_fails('let l[1 : []] = [1]', 'E730: Using a List as a String')
endfunc
" List identity
@@ -178,6 +181,19 @@ func Test_list_assign()
END
call v9.CheckScriptFailure(['vim9script'] + lines, 'E688:')
call v9.CheckDefExecFailure(lines, 'E1093: Expected 2 items but got 1')
+
+ let lines =<< trim END
+ VAR l = [2]
+ LET l += test_null_list()
+ call assert_equal([2], l)
+ LET l = test_null_list()
+ LET l += [1]
+ call assert_equal([1], l)
+ END
+ call v9.CheckLegacyAndVim9Success(lines)
+
+ let d = {'abc': [1, 2, 3]}
+ call assert_fails('let d.abc[0:0z10] = [10, 20]', 'E976: Using a Blob as a String')
endfunc
" test for range assign
@@ -447,6 +463,9 @@ func Test_dict_assign()
n.key = 3
END
call v9.CheckDefFailure(lines, 'E1141:')
+
+ let d = {'abc': {}}
+ call assert_fails("let d.abc[0z10] = 10", 'E976: Using a Blob as a String')
endfunc
" Function in script-local List or Dict
@@ -1505,6 +1524,8 @@ func Test_indexof()
call assert_equal(-1, indexof(test_null_list(), {i, v -> v == 'a'}))
call assert_equal(-1, indexof(l, test_null_string()))
call assert_equal(-1, indexof(l, test_null_function()))
+ call assert_equal(-1, indexof(l, ""))
+ call assert_fails('let i = indexof(l, " ")', 'E15:')
" failure cases
call assert_fails('let i = indexof(l, "v:val == ''cyan''")', 'E735:')
diff --git a/src/testdir/test_method.vim b/src/testdir/test_method.vim
index 120fade..f18ac14 100644
--- a/src/testdir/test_method.vim
+++ b/src/testdir/test_method.vim
@@ -136,6 +136,13 @@ func Test_method_syntax()
call assert_fails('eval [1, 2, 3] ->sort ()', 'E274:')
call assert_fails('eval [1, 2, 3]-> sort ()', 'E274:')
call assert_fails('eval [1, 2, 3]-> sort()', 'E274:')
+
+ " Test for using a method name containing a curly brace name
+ let s = 'len'
+ call assert_equal(4, "xxxx"->str{s}())
+
+ " Test for using a method in an interpolated string
+ call assert_equal('4', $'{"xxxx"->strlen()}')
endfunc
func Test_method_lambda()
diff --git a/src/testdir/test_normal.vim b/src/testdir/test_normal.vim
index 4b7e5e6..83594d2 100644
--- a/src/testdir/test_normal.vim
+++ b/src/testdir/test_normal.vim
@@ -402,17 +402,17 @@ func Test_normal08_fold()
" First fold
norm! V4jzf
" check that folds have been created
- call assert_equal(['50/*{{{*/', '51', '52', '53', '54/*}}}*/'], getline(50,54))
+ call assert_equal(['50/* {{{ */', '51', '52', '53', '54/* }}} */'], getline(50,54))
" Second fold
46
norm! V10jzf
" check that folds have been created
- call assert_equal('46/*{{{*/', getline(46))
- call assert_equal('60/*}}}*/', getline(60))
+ call assert_equal('46/* {{{ */', getline(46))
+ call assert_equal('60/* }}} */', getline(60))
norm! k
call assert_equal('45', getline('.'))
norm! j
- call assert_equal('46/*{{{*/', getline('.'))
+ call assert_equal('46/* {{{ */', getline('.'))
norm! j
call assert_equal('61', getline('.'))
norm! k
@@ -421,12 +421,12 @@ func Test_normal08_fold()
norm! k
call assert_equal('45', getline('.'))
norm! j
- call assert_equal('46/*{{{*/', getline('.'))
+ call assert_equal('46/* {{{ */', getline('.'))
norm! j
call assert_equal('47', getline('.'))
norm! k
norm! zcVzO
- call assert_equal('46/*{{{*/', getline('.'))
+ call assert_equal('46/* {{{ */', getline('.'))
norm! j
call assert_equal('47', getline('.'))
norm! j
@@ -434,7 +434,7 @@ func Test_normal08_fold()
norm! j
call assert_equal('49', getline('.'))
norm! j
- call assert_equal('50/*{{{*/', getline('.'))
+ call assert_equal('50/* {{{ */', getline('.'))
norm! j
call assert_equal('51', getline('.'))
" delete folds
@@ -1383,14 +1383,14 @@ func Test_normal18_z_fold()
" First fold
norm! 4zF
" check that folds have been created
- call assert_equal(['50/*{{{*/', '51', '52', '53/*}}}*/'], getline(50,53))
+ call assert_equal(['50/* {{{ */', '51', '52', '53/* }}} */'], getline(50,53))
" Test for zd
51
norm! 2zF
call assert_equal(2, foldlevel('.'))
norm! kzd
- call assert_equal(['50', '51/*{{{*/', '52/*}}}*/', '53'], getline(50,53))
+ call assert_equal(['50', '51/* {{{ */', '52/* }}} */', '53'], getline(50,53))
norm! j
call assert_equal(1, foldlevel('.'))
@@ -1409,7 +1409,7 @@ func Test_normal18_z_fold()
norm! 2zF
90
norm! 4zF
- call assert_equal(['85/*{{{*/', '86/*{{{*/', '87/*}}}*/', '88/*}}}*/', '89', '90/*{{{*/', '91', '92', '93/*}}}*/'], getline(85,93))
+ call assert_equal(['85/* {{{ */', '86/* {{{ */', '87/* }}} */', '88/* }}} */', '89', '90/* {{{ */', '91', '92', '93/* }}} */'], getline(85,93))
norm! zE
call assert_equal(['85', '86', '87', '88', '89', '90', '91', '92', '93'], getline(85,93))
@@ -1421,9 +1421,9 @@ func Test_normal18_z_fold()
norm! k
call assert_equal('49', getline('.'))
norm! j
- call assert_equal('50/*{{{*/', getline('.'))
+ call assert_equal('50/* {{{ */', getline('.'))
norm! j
- call assert_equal('51/*}}}*/', getline('.'))
+ call assert_equal('51/* }}} */', getline('.'))
norm! j
call assert_equal('52', getline('.'))
call assert_equal(0, &foldenable)
@@ -1433,7 +1433,7 @@ func Test_normal18_z_fold()
norm! zN
call assert_equal('49', getline('.'))
norm! j
- call assert_equal('50/*{{{*/', getline('.'))
+ call assert_equal('50/* {{{ */', getline('.'))
norm! j
call assert_equal('52', getline('.'))
call assert_equal(1, &foldenable)
@@ -1454,9 +1454,9 @@ func Test_normal18_z_fold()
norm! k
call assert_equal('49', getline('.'))
norm! j
- call assert_equal('50/*{{{*/', getline('.'))
+ call assert_equal('50/* {{{ */', getline('.'))
norm! j
- call assert_equal('51/*}}}*/', getline('.'))
+ call assert_equal('51/* }}} */', getline('.'))
norm! j
call assert_equal('52', getline('.'))
50
@@ -1464,7 +1464,7 @@ func Test_normal18_z_fold()
norm! k
call assert_equal('49', getline('.'))
norm! j
- call assert_equal('50/*{{{*/', getline('.'))
+ call assert_equal('50/* {{{ */', getline('.'))
norm! j
call assert_equal('52', getline('.'))
@@ -1473,14 +1473,14 @@ func Test_normal18_z_fold()
norm! k
call assert_equal('48', getline('.'))
norm! j
- call assert_equal('49/*{{{*/', getline('.'))
+ call assert_equal('49/* {{{ */', getline('.'))
norm! j
call assert_equal('55', getline('.'))
49
norm! za
- call assert_equal('49/*{{{*/', getline('.'))
+ call assert_equal('49/* {{{ */', getline('.'))
norm! j
- call assert_equal('50/*{{{*/', getline('.'))
+ call assert_equal('50/* {{{ */', getline('.'))
norm! j
call assert_equal('52', getline('.'))
set nofoldenable
@@ -1494,11 +1494,11 @@ func Test_normal18_z_fold()
norm! 2k
call assert_equal('48', getline('.'))
norm! j
- call assert_equal('49/*{{{*/', getline('.'))
+ call assert_equal('49/* {{{ */', getline('.'))
norm! j
- call assert_equal('50/*{{{*/', getline('.'))
+ call assert_equal('50/* {{{ */', getline('.'))
norm! j
- call assert_equal('51/*}}}*/', getline('.'))
+ call assert_equal('51/* }}} */', getline('.'))
norm! j
call assert_equal('52', getline('.'))
@@ -1510,11 +1510,11 @@ func Test_normal18_z_fold()
norm! 2k
call assert_equal('48', getline('.'))
norm! j
- call assert_equal('49/*{{{*/', getline('.'))
+ call assert_equal('49/* {{{ */', getline('.'))
norm! j
- call assert_equal('50/*{{{*/', getline('.'))
+ call assert_equal('50/* {{{ */', getline('.'))
norm! j
- call assert_equal('51/*}}}*/', getline('.'))
+ call assert_equal('51/* }}} */', getline('.'))
norm! j
call assert_equal('52', getline('.'))
@@ -1526,7 +1526,7 @@ func Test_normal18_z_fold()
norm! k
call assert_equal('48', getline('.'))
norm! j
- call assert_equal('49/*{{{*/', getline('.'))
+ call assert_equal('49/* {{{ */', getline('.'))
norm! j
call assert_equal('55', getline('.'))
@@ -1546,7 +1546,7 @@ func Test_normal18_z_fold()
norm! k
call assert_equal('48', getline('.'))
norm! j
- call assert_equal('49/*{{{*/', getline('.'))
+ call assert_equal('49/* {{{ */', getline('.'))
norm! j
call assert_equal('55', getline('.'))
set nofoldenable
@@ -1555,7 +1555,7 @@ func Test_normal18_z_fold()
norm! k
call assert_equal('48', getline('.'))
norm! j
- call assert_equal('49/*{{{*/', getline('.'))
+ call assert_equal('49/* {{{ */', getline('.'))
norm! j
call assert_equal('55', getline('.'))
@@ -1565,7 +1565,7 @@ func Test_normal18_z_fold()
norm! zCk
call assert_equal('48', getline('.'))
norm! j
- call assert_equal('49/*{{{*/', getline('.'))
+ call assert_equal('49/* {{{ */', getline('.'))
norm! j
call assert_equal('55', getline('.'))
@@ -1576,7 +1576,7 @@ func Test_normal18_z_fold()
norm! zx
call assert_equal(1, &foldenable)
norm! j
- call assert_equal('49/*{{{*/', getline('.'))
+ call assert_equal('49/* {{{ */', getline('.'))
norm! j
call assert_equal('55', getline('.'))
@@ -1588,17 +1588,17 @@ func Test_normal18_z_fold()
norm! 3k
call assert_equal('48', getline('.'))
norm! j
- call assert_equal('49/*{{{*/', getline('.'))
+ call assert_equal('49/* {{{ */', getline('.'))
norm! j
- call assert_equal('50/*{{{*/', getline('.'))
+ call assert_equal('50/* {{{ */', getline('.'))
norm! j
- call assert_equal('51/*}}}*/', getline('.'))
+ call assert_equal('51/* }}} */', getline('.'))
norm! j
call assert_equal('52', getline('.'))
norm! j
call assert_equal('53', getline('.'))
norm! j
- call assert_equal('54/*}}}*/', getline('.'))
+ call assert_equal('54/* }}} */', getline('.'))
norm! j
call assert_equal('55', getline('.'))
@@ -1610,15 +1610,15 @@ func Test_normal18_z_fold()
call assert_equal(1, &foldenable)
call assert_equal('48', getline('.'))
norm! j
- call assert_equal('49/*{{{*/', getline('.'))
+ call assert_equal('49/* {{{ */', getline('.'))
norm! j
- call assert_equal('50/*{{{*/', getline('.'))
+ call assert_equal('50/* {{{ */', getline('.'))
norm! j
call assert_equal('52', getline('.'))
norm! j
call assert_equal('53', getline('.'))
norm! j
- call assert_equal('54/*}}}*/', getline('.'))
+ call assert_equal('54/* }}} */', getline('.'))
norm! j
call assert_equal('55', getline('.'))
@@ -1631,7 +1631,7 @@ func Test_normal18_z_fold()
norm! k
call assert_equal('48', getline('.'))
norm! j
- call assert_equal('49/*{{{*/', getline('.'))
+ call assert_equal('49/* {{{ */', getline('.'))
norm! j
call assert_equal('55', getline('.'))
@@ -1648,7 +1648,7 @@ func Test_normal18_z_fold()
norm! k
call assert_equal('48', getline('.'))
norm! j
- call assert_equal('49/*{{{*/', getline('.'))
+ call assert_equal('49/* {{{ */', getline('.'))
norm! j
call assert_equal('55', getline('.'))
@@ -1667,7 +1667,7 @@ func Test_normal18_z_fold()
call assert_equal(0, &foldlevel)
call assert_equal('48', getline('.'))
norm! j
- call assert_equal('49/*{{{*/', getline('.'))
+ call assert_equal('49/* {{{ */', getline('.'))
norm! j
call assert_equal('55', getline('.'))
@@ -1685,11 +1685,11 @@ func Test_normal18_z_fold()
call assert_equal(2, &foldlevel)
call assert_equal('48', getline('.'))
norm! j
- call assert_equal('49/*{{{*/', getline('.'))
+ call assert_equal('49/* {{{ */', getline('.'))
norm! j
- call assert_equal('50/*{{{*/', getline('.'))
+ call assert_equal('50/* {{{ */', getline('.'))
norm! j
- call assert_equal('51/*}}}*/', getline('.'))
+ call assert_equal('51/* }}} */', getline('.'))
norm! j
call assert_equal('52', getline('.'))
@@ -1705,24 +1705,24 @@ func Test_normal18_z_fold()
call assert_equal(2, &foldlevel)
call assert_equal('48', getline('.'))
norm! j
- call assert_equal('49/*{{{*/', getline('.'))
+ call assert_equal('49/* {{{ */', getline('.'))
norm! j
- call assert_equal('50/*{{{*/', getline('.'))
+ call assert_equal('50/* {{{ */', getline('.'))
norm! j
- call assert_equal('51/*}}}*/', getline('.'))
+ call assert_equal('51/* }}} */', getline('.'))
norm! j
call assert_equal('52', getline('.'))
- call append(50, ['a /*{{{*/', 'b /*}}}*/'])
+ call append(50, ['a /* {{{ */', 'b /* }}} */'])
48
call assert_equal('48', getline('.'))
norm! j
- call assert_equal('49/*{{{*/', getline('.'))
+ call assert_equal('49/* {{{ */', getline('.'))
norm! j
- call assert_equal('50/*{{{*/', getline('.'))
+ call assert_equal('50/* {{{ */', getline('.'))
norm! j
- call assert_equal('a /*{{{*/', getline('.'))
+ call assert_equal('a /* {{{ */', getline('.'))
norm! j
- call assert_equal('51/*}}}*/', getline('.'))
+ call assert_equal('51/* }}} */', getline('.'))
norm! j
call assert_equal('52', getline('.'))
48
@@ -1731,15 +1731,15 @@ func Test_normal18_z_fold()
call assert_equal(3, &foldlevel)
call assert_equal('48', getline('.'))
norm! j
- call assert_equal('49/*{{{*/', getline('.'))
+ call assert_equal('49/* {{{ */', getline('.'))
norm! j
- call assert_equal('50/*{{{*/', getline('.'))
+ call assert_equal('50/* {{{ */', getline('.'))
norm! j
- call assert_equal('a /*{{{*/', getline('.'))
+ call assert_equal('a /* {{{ */', getline('.'))
norm! j
- call assert_equal('b /*}}}*/', getline('.'))
+ call assert_equal('b /* }}} */', getline('.'))
norm! j
- call assert_equal('51/*}}}*/', getline('.'))
+ call assert_equal('51/* }}} */', getline('.'))
norm! j
call assert_equal('52', getline('.'))
@@ -4260,4 +4260,22 @@ func Test_page_cursor_topbot()
bwipe!
endfunc
+" Test for Ctrl-D with long line
+func Test_halfpage_longline()
+ 10new
+ call setline(1, ['long'->repeat(1000), 'short'])
+ exe "norm! \<C-D>"
+ call assert_equal(2, line('.'))
+ bwipe!
+endfunc
+
+" Test for Ctrl-E with long line and very narrow window,
+" used to cause an inifite loop
+func Test_scroll_longline_no_loop()
+ 4vnew
+ setl smoothscroll number showbreak=> scrolloff=2
+ call setline(1, repeat(['Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.'], 3))
+ exe "normal! \<C-E>"
+ bwipe!
+endfunc
" vim: shiftwidth=2 sts=2 expandtab nofoldenable
diff --git a/src/testdir/test_partial.vim b/src/testdir/test_partial.vim
index 4b054b5..b5a58f6 100644
--- a/src/testdir/test_partial.vim
+++ b/src/testdir/test_partial.vim
@@ -406,4 +406,18 @@ func Test_compare_partials()
call assert_false(F1 is N1)
endfunc
+func Test_partial_method()
+ func Foo(x, y, z)
+ return x + y + z
+ endfunc
+ let d = {"Fn": function('Foo', [10, 20])}
+ call assert_fails('echo 30->d.Fn()', 'E1265: Cannot use a partial here')
+ delfunc Foo
+endfunc
+
+func Test_non_callable_type_as_method()
+ let d = {"Fn": 10}
+ call assert_fails('echo 30->d.Fn()', 'E1085: Not a callable type: d.Fn')
+endfunc
+
" vim: shiftwidth=2 sts=2 expandtab
diff --git a/src/testdir/test_popup.vim b/src/testdir/test_popup.vim
index f5cb8b2..dd01a57 100644
--- a/src/testdir/test_popup.vim
+++ b/src/testdir/test_popup.vim
@@ -908,6 +908,13 @@ func Test_popup_command_dump()
call term_sendkeys(buf, "\<Esc>")
+ if has('rightleft')
+ call term_sendkeys(buf, ":set rightleft\<CR>")
+ call term_sendkeys(buf, "/X\<CR>:popup PopUp\<CR>")
+ call VerifyScreenDump(buf, 'Test_popup_command_rl', {})
+ call term_sendkeys(buf, "\<Esc>:set norightleft\<CR>")
+ endif
+
" Set a timer to change a menu entry while it's displayed. The text should
" not change but the command does. Making the screendump also verifies that
" "changed" shows up, which means the timer triggered.
@@ -930,6 +937,37 @@ func Test_popup_command_dump()
call StopVimInTerminal(buf)
endfunc
+" Test position of right-click menu when clicking near window edge.
+func Test_mouse_popup_position()
+ CheckFeature menu
+ CheckScreendump
+
+ let script =<< trim END
+ set mousemodel=popup_setpos
+ source $VIMRUNTIME/menu.vim
+ call setline(1, join(range(20)))
+ func Trigger(col)
+ call test_setmouse(1, a:col)
+ call feedkeys("\<RightMouse>", 't')
+ endfunc
+ END
+ call writefile(script, 'XmousePopupPosition', 'D')
+ let buf = RunVimInTerminal('-S XmousePopupPosition', #{rows: 20, cols: 50})
+
+ call term_sendkeys(buf, ":call Trigger(45)\<CR>")
+ call VerifyScreenDump(buf, 'Test_mouse_popup_position_01', {})
+ call term_sendkeys(buf, "\<Esc>")
+
+ if has('rightleft')
+ call term_sendkeys(buf, ":set rightleft\<CR>")
+ call term_sendkeys(buf, ":call Trigger(50 + 1 - 45)\<CR>")
+ call VerifyScreenDump(buf, 'Test_mouse_popup_position_02', {})
+ call term_sendkeys(buf, "\<Esc>:set norightleft\<CR>")
+ endif
+
+ call StopVimInTerminal(buf)
+endfunc
+
func Test_popup_complete_backwards()
new
call setline(1, ['Post', 'Port', 'Po'])
@@ -1175,6 +1213,8 @@ func Test_CompleteChanged()
set completeopt=menu,menuone
call feedkeys("i\<C-X>\<C-O>\<BS>\<BS>\<BS>f", 'tx')
call assert_equal('five', g:word)
+ call feedkeys("i\<C-X>\<C-O>\<BS>\<BS>\<BS>f\<BS>", 'tx')
+ call assert_equal('one', g:word)
autocmd! AAAAA_Group
set complete& completeopt&
@@ -1339,4 +1379,113 @@ func Test_pum_highlights_custom()
call StopVimInTerminal(buf)
endfunc
+" Test match relate highlight group in pmenu
+func Test_pum_highlights_match()
+ CheckScreendump
+ let lines =<< trim END
+ func Omni_test(findstart, base)
+ if a:findstart
+ return col(".")
+ endif
+ return {
+ \ 'words': [
+ \ { 'word': 'foo', 'kind': 'fookind' },
+ \ { 'word': 'foofoo', 'kind': 'fookind' },
+ \ { 'word': 'foobar', 'kind': 'fookind' },
+ \ { 'word': 'fooBaz', 'kind': 'fookind' },
+ \ { 'word': 'foobala', 'kind': 'fookind' },
+ \ { 'word': '你好' },
+ \ { 'word': '你好吗' },
+ \ { 'word': '你不好吗' },
+ \ { 'word': '你可好吗' },
+ \]}
+ endfunc
+
+ func Comp()
+ let col = col('.')
+ if getline('.') == 'f'
+ let col -= 1
+ endif
+ call complete(col, [
+ \ #{word: "foo", icase: 1},
+ \ #{word: "Foobar", icase: 1},
+ \ #{word: "fooBaz", icase: 1},
+ \])
+ return ''
+ endfunc
+
+ set omnifunc=Omni_test
+ set completeopt=menu,noinsert,fuzzy
+ hi PmenuMatchSel ctermfg=6 ctermbg=7
+ hi PmenuMatch ctermfg=4 ctermbg=225
+ END
+ call writefile(lines, 'Xscript', 'D')
+ let buf = RunVimInTerminal('-S Xscript', {})
+ call TermWait(buf)
+ call term_sendkeys(buf, "i\<C-X>\<C-O>")
+ call TermWait(buf, 50)
+ call term_sendkeys(buf, "fo")
+ call TermWait(buf, 50)
+ call VerifyScreenDump(buf, 'Test_pum_highlights_03', {})
+ call term_sendkeys(buf, "\<Esc>S\<C-X>\<C-O>")
+ call TermWait(buf, 50)
+ call term_sendkeys(buf, "你")
+ call TermWait(buf, 50)
+ call VerifyScreenDump(buf, 'Test_pum_highlights_04', {})
+ call term_sendkeys(buf, "吗")
+ call TermWait(buf, 50)
+ call VerifyScreenDump(buf, 'Test_pum_highlights_05', {})
+ call term_sendkeys(buf, "\<C-E>\<Esc>")
+
+ if has('rightleft')
+ call term_sendkeys(buf, ":set rightleft\<CR>")
+ call TermWait(buf, 50)
+ call term_sendkeys(buf, "S\<C-X>\<C-O>")
+ call TermWait(buf, 50)
+ call term_sendkeys(buf, "fo")
+ call TermWait(buf, 50)
+ call VerifyScreenDump(buf, 'Test_pum_highlights_06', {})
+ call term_sendkeys(buf, "\<Esc>S\<C-X>\<C-O>")
+ call TermWait(buf, 50)
+ call term_sendkeys(buf, "你")
+ call VerifyScreenDump(buf, 'Test_pum_highlights_06a', {})
+ call term_sendkeys(buf, "吗")
+ call VerifyScreenDump(buf, 'Test_pum_highlights_06b', {})
+ call term_sendkeys(buf, "\<C-E>\<Esc>")
+ call term_sendkeys(buf, ":set norightleft\<CR>")
+ call TermWait(buf)
+ endif
+
+ call term_sendkeys(buf, ":set completeopt-=fuzzy\<CR>")
+ call TermWait(buf)
+ call term_sendkeys(buf, "S\<C-X>\<C-O>")
+ call TermWait(buf, 50)
+ call term_sendkeys(buf, "fo")
+ call TermWait(buf, 50)
+ call VerifyScreenDump(buf, 'Test_pum_highlights_07', {})
+ call term_sendkeys(buf, "\<C-E>\<Esc>")
+
+ if has('rightleft')
+ call term_sendkeys(buf, ":set rightleft\<CR>")
+ call TermWait(buf, 50)
+ call term_sendkeys(buf, "S\<C-X>\<C-O>")
+ call TermWait(buf, 50)
+ call term_sendkeys(buf, "fo")
+ call TermWait(buf, 50)
+ call VerifyScreenDump(buf, 'Test_pum_highlights_08', {})
+ call term_sendkeys(buf, "\<C-E>\<Esc>")
+ call term_sendkeys(buf, ":set norightleft\<CR>")
+ endif
+
+ call term_sendkeys(buf, "S\<C-R>=Comp()\<CR>f")
+ call VerifyScreenDump(buf, 'Test_pum_highlights_09', {})
+ call term_sendkeys(buf, "o\<BS>\<C-R>=Comp()\<CR>")
+ call VerifyScreenDump(buf, 'Test_pum_highlights_09', {})
+
+ call term_sendkeys(buf, "\<C-E>\<Esc>")
+ call TermWait(buf)
+
+ call StopVimInTerminal(buf)
+endfunc
+
" vim: shiftwidth=2 sts=2 expandtab
diff --git a/src/testdir/test_quickfix.vim b/src/testdir/test_quickfix.vim
index c784a2d..0b61815 100644
--- a/src/testdir/test_quickfix.vim
+++ b/src/testdir/test_quickfix.vim
@@ -6496,4 +6496,74 @@ func Test_efm_format_b()
call setqflist([], 'f')
endfunc
+func XbufferTests_range(cchar)
+ call s:setup_commands(a:cchar)
+
+ enew!
+ let lines =<< trim END
+ Xtestfile7:700:10:Line 700
+ Xtestfile8:800:15:Line 800
+ END
+ silent! call setline(1, lines)
+ norm! Vy
+ " Note: We cannot use :Xbuffer here,
+ " it doesn't properly fail, so we need to
+ " test using the raw c/l commands.
+ " (also further down)
+ if (a:cchar == 'c')
+ exe "'<,'>cbuffer!"
+ else
+ exe "'<,'>lbuffer!"
+ endif
+ let l = g:Xgetlist()
+ call assert_true(len(l) == 1 &&
+ \ l[0].lnum == 700 && l[0].col == 10 && l[0].text ==# 'Line 700')
+
+ enew!
+ let lines =<< trim END
+ Xtestfile9:900:55:Line 900
+ Xtestfile10:950:66:Line 950
+ END
+ silent! call setline(1, lines)
+ if (a:cchar == 'c')
+ 1cgetbuffer
+ else
+ 1lgetbuffer
+ endif
+ let l = g:Xgetlist()
+ call assert_true(len(l) == 1 &&
+ \ l[0].lnum == 900 && l[0].col == 55 && l[0].text ==# 'Line 900')
+
+ enew!
+ let lines =<< trim END
+ Xtestfile11:700:20:Line 700
+ Xtestfile12:750:25:Line 750
+ END
+ silent! call setline(1, lines)
+ if (a:cchar == 'c')
+ 1,1caddbuffer
+ else
+ 1,1laddbuffer
+ endif
+ let l = g:Xgetlist()
+ call assert_true(len(l) == 2 &&
+ \ l[0].lnum == 900 && l[0].col == 55 && l[0].text ==# 'Line 900' &&
+ \ l[1].lnum == 700 && l[1].col == 20 && l[1].text ==# 'Line 700')
+ enew!
+
+ " Check for invalid range
+ " Using Xbuffer will not run the range check in the cbuffer/lbuffer
+ " commands. So directly call the commands.
+ if (a:cchar == 'c')
+ call assert_fails('900,999caddbuffer', 'E16:')
+ else
+ call assert_fails('900,999laddbuffer', 'E16:')
+ endif
+endfunc
+
+func Test_cbuffer_range()
+ call XbufferTests_range('c')
+ call XbufferTests_range('l')
+endfunc
+
" vim: shiftwidth=2 sts=2 expandtab
diff --git a/src/testdir/test_remote.vim b/src/testdir/test_remote.vim
index 1475052..fd8b0af 100644
--- a/src/testdir/test_remote.vim
+++ b/src/testdir/test_remote.vim
@@ -12,7 +12,7 @@ source term_util.vim
let s:remote_works = 0
let s:skip = 'Skipped: --remote feature is not possible'
-" nees to be run as first test to verify, that vim --servername works
+" needs to be run as first test to verify, that vim --servername works
func Verify_remote_feature_works()
CheckRunVimInTerminal
enew
diff --git a/src/testdir/test_scroll_opt.vim b/src/testdir/test_scroll_opt.vim
index cda9bf0..1b60019 100644
--- a/src/testdir/test_scroll_opt.vim
+++ b/src/testdir/test_scroll_opt.vim
@@ -961,6 +961,51 @@ func Test_smoothscroll_insert_bottom()
call StopVimInTerminal(buf)
endfunc
+func Test_smoothscroll_in_qf_window()
+ CheckFeature quickfix
+ CheckScreendump
+
+ let lines =<< trim END
+ set nocompatible display=lastline
+ copen 5
+ setlocal number smoothscroll
+ let g:l = [{'text': 'foo'}] + repeat([{'text': join(range(30))}], 10)
+ call setqflist(g:l, 'r')
+ normal! G
+ wincmd t
+ let g:l1 = [{'text': join(range(1000))}]
+ END
+ call writefile(lines, 'XSmoothScrollInQfWindow', 'D')
+ let buf = RunVimInTerminal('-u NONE -S XSmoothScrollInQfWindow', #{rows: 20, cols: 60})
+ call VerifyScreenDump(buf, 'Test_smoothscroll_in_qf_window_1', {})
+
+ call term_sendkeys(buf, ":call setqflist([], 'r')\<CR>")
+ call VerifyScreenDump(buf, 'Test_smoothscroll_in_qf_window_2', {})
+
+ call term_sendkeys(buf, ":call setqflist(g:l, 'r')\<CR>")
+ call VerifyScreenDump(buf, 'Test_smoothscroll_in_qf_window_3', {})
+
+ call term_sendkeys(buf, ":call setqflist(g:l1, 'r')\<CR>")
+ call VerifyScreenDump(buf, 'Test_smoothscroll_in_qf_window_4', {})
+
+ call term_sendkeys(buf, "\<C-W>b$\<C-W>t")
+ call VerifyScreenDump(buf, 'Test_smoothscroll_in_qf_window_5', {})
+
+ call term_sendkeys(buf, ":call setqflist([], 'r')\<CR>")
+ call VerifyScreenDump(buf, 'Test_smoothscroll_in_qf_window_2', {})
+
+ call term_sendkeys(buf, ":call setqflist(g:l1, 'r')\<CR>")
+ call VerifyScreenDump(buf, 'Test_smoothscroll_in_qf_window_4', {})
+
+ call term_sendkeys(buf, "\<C-W>b$\<C-W>t")
+ call VerifyScreenDump(buf, 'Test_smoothscroll_in_qf_window_5', {})
+
+ call term_sendkeys(buf, ":call setqflist(g:l, 'r')\<CR>")
+ call VerifyScreenDump(buf, 'Test_smoothscroll_in_qf_window_3', {})
+
+ call StopVimInTerminal(buf)
+endfunc
+
func Test_smoothscroll_in_zero_width_window()
set cpo+=n number smoothscroll
set winwidth=99999 winminwidth=0
@@ -1108,4 +1153,39 @@ func Test_smoothscroll_long_line_zb()
bwipe!
endfunc
+func Test_smooth_long_scrolloff()
+ CheckScreendump
+
+ let lines =<< trim END
+ set smoothscroll scrolloff=3
+ call setline(1, ['one', 'two long '->repeat(100), 'three', 'four', 'five', 'six'])
+ END
+ call writefile(lines, 'XSmoothLongScrolloff', 'D')
+ let buf = RunVimInTerminal('-u NONE -S XSmoothLongScrolloff', #{rows: 8, cols: 40})
+ "FIXME: empty screen due to reset_skipcol()/curs_columns() shenanigans
+ call term_sendkeys(buf, ":norm j721|\<CR>")
+ call VerifyScreenDump(buf, 'Test_smooth_long_scrolloff_1', {})
+
+ call term_sendkeys(buf, "gj")
+ call VerifyScreenDump(buf, 'Test_smooth_long_scrolloff_2', {})
+
+ call term_sendkeys(buf, "gj")
+ call VerifyScreenDump(buf, 'Test_smooth_long_scrolloff_3', {})
+
+ call term_sendkeys(buf, "gj")
+ call VerifyScreenDump(buf, 'Test_smooth_long_scrolloff_4', {})
+
+ call term_sendkeys(buf, "gj")
+ call VerifyScreenDump(buf, 'Test_smooth_long_scrolloff_5', {})
+
+ call term_sendkeys(buf, "gj")
+ call VerifyScreenDump(buf, 'Test_smooth_long_scrolloff_6', {})
+
+ call term_sendkeys(buf, "gk")
+ "FIXME: empty screen due to reset_skipcol()/curs_columns() shenanigans
+ call VerifyScreenDump(buf, 'Test_smooth_long_scrolloff_7', {})
+
+ call StopVimInTerminal(buf)
+endfunc
+
" vim: shiftwidth=2 sts=2 expandtab
diff --git a/src/testdir/test_shell.vim b/src/testdir/test_shell.vim
index 7d91dff..2ac5596 100644
--- a/src/testdir/test_shell.vim
+++ b/src/testdir/test_shell.vim
@@ -158,6 +158,10 @@ func Test_shellescape()
call assert_equal("'te\\#xt'", shellescape("te#xt", 1))
call assert_equal("'te!xt'", shellescape("te!xt"))
call assert_equal("'te\\!xt'", shellescape("te!xt", 1))
+ call assert_equal("'te<cword>xt'", shellescape("te<cword>xt"))
+ call assert_equal("'te\\<cword>xt'", shellescape("te<cword>xt", 1))
+ call assert_equal("'te<cword>%xt'", shellescape("te<cword>%xt"))
+ call assert_equal("'te\\<cword>\\%xt'", shellescape("te<cword>%xt", 1))
call assert_equal("'te\nxt'", shellescape("te\nxt"))
call assert_equal("'te\\\nxt'", shellescape("te\nxt", 1))
diff --git a/src/testdir/test_shortpathname.vim b/src/testdir/test_shortpathname.vim
index 5964630..0c41692 100644
--- a/src/testdir/test_shortpathname.vim
+++ b/src/testdir/test_shortpathname.vim
@@ -16,18 +16,14 @@ func TestIt(file, bits, expected)
endif
endfunc
-func Test_ColonEight()
- let save_dir = getcwd()
-
- " This could change for CygWin to //cygdrive/c .
- let dir1 = 'c:/x.x.y'
+func s:SetupDir(dir)
let trycount = 5
while 1
- if !filereadable(dir1) && !isdirectory(dir1)
+ if !filereadable(a:dir) && !isdirectory(a:dir)
break
endif
if trycount == 1
- call assert_report("Fatal: '" . dir1 . "' exists, cannot run this test")
+ call assert_report("Fatal: '" . a:dir . "' exists, cannot run this test")
return
endif
" When tests run in parallel the directory may exist, wait a bit until it
@@ -35,6 +31,15 @@ func Test_ColonEight()
sleep 5
let trycount -= 1
endwhile
+endfunc
+
+
+func Test_ColonEight()
+ let save_dir = getcwd()
+
+ " This could change for CygWin to //cygdrive/c .
+ let dir1 = 'c:/x.x.y'
+ call s:SetupDir(dir1)
let file1 = dir1 . '/zz.y.txt'
let nofile1 = dir1 . '/z.y.txt'
@@ -78,7 +83,8 @@ func Test_ColonEight()
endfunc
func Test_ColonEight_MultiByte()
- let dir = 'Xtest'
+ let dir = 'c:/Xtest_C8MB'
+ call s:SetupDir(dir)
let file = dir . '/日本語のファイル.txt'
diff --git a/src/testdir/test_spellrare.vim b/src/testdir/test_spellrare.vim
new file mode 100644
index 0000000..ceb35cb
--- /dev/null
+++ b/src/testdir/test_spellrare.vim
@@ -0,0 +1,61 @@
+" Test spell checking
+
+source check.vim
+CheckFeature spell
+
+" Test spellbadword() with argument, specifically to move to "rare" words
+" in normal mode.
+func Test_spellrareword()
+ set spell
+
+ " Create a small word list to test that spellbadword('...')
+ " can return ['...', 'rare'].
+ let lines =<< trim END
+ foo
+ foobar/?
+ foobara/?
+ END
+ call writefile(lines, 'Xwords', 'D')
+
+ mkspell! Xwords.spl Xwords
+ set spelllang=Xwords.spl
+ call assert_equal(['foobar', 'rare'], spellbadword('foo foobar'))
+
+ new
+ call setline(1, ['foo', '', 'foo bar foo bar foobara foo foo foo foobar', '', 'End'])
+ set spell wrapscan
+ normal ]s
+ call assert_equal('foo', expand('<cword>'))
+ normal ]s
+ call assert_equal('bar', expand('<cword>'))
+
+ normal ]r
+ call assert_equal('foobara', expand('<cword>'))
+ normal ]r
+ call assert_equal('foobar', expand('<cword>'))
+ normal ]r
+ call assert_equal('foobara', expand('<cword>'))
+ normal 2]r
+ call assert_equal('foobara', expand('<cword>'))
+
+ normal [r
+ call assert_equal('foobar', expand('<cword>'))
+ normal [r
+ call assert_equal('foobara', expand('<cword>'))
+ normal [r
+ call assert_equal('foobar', expand('<cword>'))
+ normal 2[r
+ call assert_equal('foobar', expand('<cword>'))
+
+ bwipe!
+ set nospell
+
+ call delete('Xwords.spl')
+ set spelllang&
+ set spell&
+
+ " set 'encoding' to clear the word list
+ set encoding=utf-8
+endfunc
+
+" vim: shiftwidth=2 sts=2 expandtab
diff --git a/src/testdir/test_substitute.vim b/src/testdir/test_substitute.vim
index 7c2bbb4..afdc104 100644
--- a/src/testdir/test_substitute.vim
+++ b/src/testdir/test_substitute.vim
@@ -173,6 +173,16 @@ func Test_substitute_repeat()
call feedkeys("Qsc\<CR>y", 'tx')
bwipe!
endfunc
+
+" Test :s with ? as delimiter.
+func Test_substitute_question_delimiter()
+ new
+ call setline(1, '??:??')
+ %s?\?\??!!?g
+ call assert_equal('!!:!!', getline(1))
+ bwipe!
+endfunc
+
" Test %s/\n// which is implemented as a special case to use a
" more efficient join rather than doing a regular substitution.
func Test_substitute_join()
@@ -1498,4 +1508,18 @@ func Test_substitute_expr_recursive()
exe bufnr .. "bw!"
endfunc
+" Test for changing 'cpo' in a substitute expression
+func Test_substitute_expr_cpo()
+ func XSubExpr()
+ set cpo=
+ return 'x'
+ endfunc
+
+ let save_cpo = &cpo
+ call assert_equal('xxx', substitute('abc', '.', '\=XSubExpr()', 'g'))
+ call assert_equal(save_cpo, &cpo)
+
+ delfunc XSubExpr
+endfunc
+
" vim: shiftwidth=2 sts=2 expandtab
diff --git a/src/testdir/test_tagjump.vim b/src/testdir/test_tagjump.vim
index 2abf1f6..432906e 100644
--- a/src/testdir/test_tagjump.vim
+++ b/src/testdir/test_tagjump.vim
@@ -1560,4 +1560,22 @@ func Test_tagbsearch()
set tags& tagbsearch&
endfunc
+" Test tag guessing with very short names
+func Test_tag_guess_short()
+ call writefile(["!_TAG_FILE_ENCODING\tutf-8\t//",
+ \ "y\tXf\t/^y()/"],
+ \ 'Xt', 'D')
+ set tags=Xt cpoptions+=t
+ call writefile(['', 'int * y () {}', ''], 'Xf', 'D')
+
+ let v:statusmsg = ''
+ let @/ = ''
+ ta y
+ call assert_match('E435:', v:statusmsg)
+ call assert_equal(2, line('.'))
+ call assert_match('<y', @/)
+
+ set tags& cpoptions-=t
+endfunc
+
" vim: shiftwidth=2 sts=2 expandtab
diff --git a/src/testdir/test_termdebug.vim b/src/testdir/test_termdebug.vim
index 68bffd4..a9762df 100644
--- a/src/testdir/test_termdebug.vim
+++ b/src/testdir/test_termdebug.vim
@@ -230,26 +230,26 @@ endfunc
func Test_termdebug_mapping()
%bw!
- call assert_equal(maparg('K', 'n', 0, 1)->empty(), 1)
- call assert_equal(maparg('-', 'n', 0, 1)->empty(), 1)
- call assert_equal(maparg('+', 'n', 0, 1)->empty(), 1)
+ call assert_true(maparg('K', 'n', 0, 1)->empty())
+ call assert_true(maparg('-', 'n', 0, 1)->empty())
+ call assert_true(maparg('+', 'n', 0, 1)->empty())
Termdebug
call WaitForAssert({-> assert_equal(3, winnr('$'))})
wincmd b
- call assert_equal(maparg('K', 'n', 0, 1)->empty(), 0)
- call assert_equal(maparg('-', 'n', 0, 1)->empty(), 0)
- call assert_equal(maparg('+', 'n', 0, 1)->empty(), 0)
- call assert_equal(maparg('K', 'n', 0, 1).buffer, 0)
- call assert_equal(maparg('-', 'n', 0, 1).buffer, 0)
- call assert_equal(maparg('+', 'n', 0, 1).buffer, 0)
- call assert_equal(maparg('K', 'n', 0, 1).rhs, ':Evaluate<CR>')
+ call assert_false(maparg('K', 'n', 0, 1)->empty())
+ call assert_false(maparg('-', 'n', 0, 1)->empty())
+ call assert_false(maparg('+', 'n', 0, 1)->empty())
+ call assert_false(maparg('K', 'n', 0, 1).buffer)
+ call assert_false(maparg('-', 'n', 0, 1).buffer)
+ call assert_false(maparg('+', 'n', 0, 1).buffer)
+ call assert_equal(':Evaluate<CR>', maparg('K', 'n', 0, 1).rhs)
wincmd t
quit!
redraw!
call WaitForAssert({-> assert_equal(1, winnr('$'))})
- call assert_equal(maparg('K', 'n', 0, 1)->empty(), 1)
- call assert_equal(maparg('-', 'n', 0, 1)->empty(), 1)
- call assert_equal(maparg('+', 'n', 0, 1)->empty(), 1)
+ call assert_true(maparg('K', 'n', 0, 1)->empty())
+ call assert_true(maparg('-', 'n', 0, 1)->empty())
+ call assert_true(maparg('+', 'n', 0, 1)->empty())
%bw!
nnoremap K :echom "K"<cr>
@@ -258,24 +258,24 @@ func Test_termdebug_mapping()
Termdebug
call WaitForAssert({-> assert_equal(3, winnr('$'))})
wincmd b
- call assert_equal(maparg('K', 'n', 0, 1)->empty(), 0)
- call assert_equal(maparg('-', 'n', 0, 1)->empty(), 0)
- call assert_equal(maparg('+', 'n', 0, 1)->empty(), 0)
- call assert_equal(maparg('K', 'n', 0, 1).buffer, 0)
- call assert_equal(maparg('-', 'n', 0, 1).buffer, 0)
- call assert_equal(maparg('+', 'n', 0, 1).buffer, 0)
- call assert_equal(maparg('K', 'n', 0, 1).rhs, ':Evaluate<CR>')
+ call assert_false(maparg('K', 'n', 0, 1)->empty())
+ call assert_false(maparg('-', 'n', 0, 1)->empty())
+ call assert_false(maparg('+', 'n', 0, 1)->empty())
+ call assert_false(maparg('K', 'n', 0, 1).buffer)
+ call assert_false(maparg('-', 'n', 0, 1).buffer)
+ call assert_false(maparg('+', 'n', 0, 1).buffer)
+ call assert_equal(':Evaluate<CR>', maparg('K', 'n', 0, 1).rhs)
wincmd t
quit!
redraw!
call WaitForAssert({-> assert_equal(1, winnr('$'))})
- call assert_equal(maparg('K', 'n', 0, 1)->empty(), 0)
- call assert_equal(maparg('-', 'n', 0, 1)->empty(), 0)
- call assert_equal(maparg('+', 'n', 0, 1)->empty(), 0)
- call assert_equal(maparg('K', 'n', 0, 1).buffer, 0)
- call assert_equal(maparg('-', 'n', 0, 1).buffer, 0)
- call assert_equal(maparg('+', 'n', 0, 1).buffer, 0)
- call assert_equal(maparg('K', 'n', 0, 1).rhs, ':echom "K"<cr>')
+ call assert_false(maparg('K', 'n', 0, 1)->empty())
+ call assert_false(maparg('-', 'n', 0, 1)->empty())
+ call assert_false(maparg('+', 'n', 0, 1)->empty())
+ call assert_false(maparg('K', 'n', 0, 1).buffer)
+ call assert_false(maparg('-', 'n', 0, 1).buffer)
+ call assert_false(maparg('+', 'n', 0, 1).buffer)
+ call assert_equal(':echom "K"<cr>', maparg('K', 'n', 0, 1).rhs)
%bw!
nnoremap <buffer> K :echom "bK"<cr>
@@ -284,20 +284,70 @@ func Test_termdebug_mapping()
Termdebug
call WaitForAssert({-> assert_equal(3, winnr('$'))})
wincmd b
- call assert_equal(maparg('K', 'n', 0, 1).buffer, 1)
- call assert_equal(maparg('-', 'n', 0, 1).buffer, 1)
- call assert_equal(maparg('+', 'n', 0, 1).buffer, 1)
+ call assert_true(maparg('K', 'n', 0, 1).buffer)
+ call assert_true(maparg('-', 'n', 0, 1).buffer)
+ call assert_true(maparg('+', 'n', 0, 1).buffer)
call assert_equal(maparg('K', 'n', 0, 1).rhs, ':echom "bK"<cr>')
wincmd t
quit!
redraw!
call WaitForAssert({-> assert_equal(1, winnr('$'))})
- call assert_equal(maparg('K', 'n', 0, 1).buffer, 1)
- call assert_equal(maparg('-', 'n', 0, 1).buffer, 1)
- call assert_equal(maparg('+', 'n', 0, 1).buffer, 1)
- call assert_equal(maparg('K', 'n', 0, 1).rhs, ':echom "bK"<cr>')
+ call assert_true(maparg('K', 'n', 0, 1).buffer)
+ call assert_true(maparg('-', 'n', 0, 1).buffer)
+ call assert_true(maparg('+', 'n', 0, 1).buffer)
+ call assert_equal(':echom "bK"<cr>', maparg('K', 'n', 0, 1).rhs)
%bw!
endfunc
+func Test_termdebug_bufnames()
+ " Test if user has filename/folders named gdb, Termdebug-gdb-console,
+ " etc. in the current directory
+ let g:termdebug_config = {}
+ let g:termdebug_config['use_prompt'] = 1
+ let filename = 'gdb'
+ let replacement_filename = 'Termdebug-gdb-console'
+
+ call writefile(['This', 'is', 'a', 'test'], filename, 'D')
+ " Throw away the file once the test has done.
+ Termdebug
+ " Once termdebug has completed the startup you should have 3 windows on screen
+ call WaitForAssert({-> assert_equal(3, winnr('$'))})
+ " A file named filename already exists in the working directory,
+ " hence you must call the newly created buffer differently
+ call WaitForAssert({-> assert_false(bufexists(filename))})
+ call WaitForAssert({-> assert_true(bufexists(replacement_filename))})
+ quit!
+ call WaitForAssert({-> assert_equal(1, winnr('$'))})
+
+ " Check if error message is in :message
+ let g:termdebug_config['disasm_window'] = 1
+ let filename = 'Termdebug-asm-listing'
+ call writefile(['This', 'is', 'a', 'test'], filename, 'D')
+ " Check only the head of the error message
+ let error_message = "You have a file/folder named '" .. filename .. "'"
+ Termdebug
+ " Once termdebug has completed the startup you should have 4 windows on screen
+ call WaitForAssert({-> assert_equal(4, winnr('$'))})
+ call WaitForAssert({-> assert_notequal(-1, stridx(execute('messages'), error_message))})
+ quit!
+ wincmd b
+ wincmd q
+ call WaitForAssert({-> assert_equal(1, winnr('$'))})
+
+ unlet g:termdebug_config
+endfunc
+
+function Test_termdebug_save_restore_variables()
+ let &mousemodel=''
+ Termdebug
+ call WaitForAssert({-> assert_equal(3, winnr('$'))})
+ call WaitForAssert({-> assert_match(&mousemodel, 'popup_setpos')})
+ wincmd t
+ quit!
+ call WaitForAssert({-> assert_equal(1, winnr('$'))})
+ call WaitForAssert({-> assert_true(empty(&mousemodel))})
+endfunction
+
+
" vim: shiftwidth=2 sts=2 expandtab
diff --git a/src/testdir/test_terminal3.vim b/src/testdir/test_terminal3.vim
index 223bcc5..3cca1b0 100644
--- a/src/testdir/test_terminal3.vim
+++ b/src/testdir/test_terminal3.vim
@@ -10,6 +10,8 @@ source screendump.vim
source mouse.vim
source term_util.vim
+import './vim9.vim' as v9
+
let $PROMPT_COMMAND=''
func Test_terminal_altscreen()
@@ -935,7 +937,14 @@ func Test_terminal_vt420()
CheckRunVimInTerminal
" For Termcap
CheckUnix
- let rows=15
+ CheckExecutable infocmp
+ let a = system('infocmp vt420')
+ if v:shell_error
+ " reset v:shell_error
+ let a = system('true')
+ throw 'Skipped: vt420 terminfo not available'
+ endif
+ let rows = 15
call writefile([':set term=vt420'], 'Xterm420', 'D')
let buf = RunVimInTerminal('-S Xterm420', #{rows: rows})
@@ -952,4 +961,18 @@ func Test_terminal_vt420()
call StopVimInTerminal(buf)
endfunc
+" Test for using 'vertical' with term_start(). If a following term_start(),
+" doesn't have the 'vertical' attribute, then it should be split horizontally.
+func Test_terminal_vertical()
+ let lines =<< trim END
+ call term_start("NONE", {'vertical': 1})
+ call term_start("NONE")
+ VAR layout = winlayout()
+ call assert_equal('row', layout[0], string(layout))
+ call assert_equal('col', layout[1][0][0], string(layout))
+ :%bw!
+ END
+ call v9.CheckLegacyAndVim9Success(lines)
+endfunc
+
" vim: shiftwidth=2 sts=2 expandtab
diff --git a/src/testdir/test_textformat.vim b/src/testdir/test_textformat.vim
index 5d58486..e31ea22 100644
--- a/src/testdir/test_textformat.vim
+++ b/src/testdir/test_textformat.vim
@@ -1304,7 +1304,7 @@ func Test_correct_cursor_position()
endfunc
" This was crashing Vim
-func Test_textwdith_overflow()
+func Test_textwidth_overflow()
new
setl tw=999999999
normal 10ig
diff --git a/src/testdir/test_vartabs.vim b/src/testdir/test_vartabs.vim
index e15a072..bae00dd 100644
--- a/src/testdir/test_vartabs.vim
+++ b/src/testdir/test_vartabs.vim
@@ -454,5 +454,64 @@ func Test_vartabstop_latin1()
set nocompatible linebreak& list& revins& smarttab& vartabstop&
endfunc
+" Verify that right-shifting and left-shifting adjust lines to the proper
+" tabstops.
+func Test_vartabstop_shift_right_left()
+ new
+ set expandtab
+ set shiftwidth=0
+ set vartabstop=17,11,7
+ exe "norm! aword"
+ let expect = "word"
+ call assert_equal(expect, getline(1))
+
+ " Shift to first tabstop.
+ norm! >>
+ let expect = " word"
+ call assert_equal(expect, getline(1))
+
+ " Shift to second tabstop.
+ norm! >>
+ let expect = " word"
+ call assert_equal(expect, getline(1))
+
+ " Shift to third tabstop.
+ norm! >>
+ let expect = " word"
+ call assert_equal(expect, getline(1))
+
+ " Shift to fourth tabstop, repeating the third shift width.
+ norm! >>
+ let expect = " word"
+ call assert_equal(expect, getline(1))
+
+ " Shift back to the third tabstop.
+ norm! <<
+ let expect = " word"
+ call assert_equal(expect, getline(1))
+
+ " Shift back to the second tabstop.
+ norm! <<
+ let expect = " word"
+ call assert_equal(expect, getline(1))
+
+ " Shift back to the first tabstop.
+ norm! <<
+ let expect = " word"
+ call assert_equal(expect, getline(1))
+
+ " Shift back to the left margin.
+ norm! <<
+ let expect = "word"
+ call assert_equal(expect, getline(1))
+
+ " Shift again back to the left margin.
+ norm! <<
+ let expect = "word"
+ call assert_equal(expect, getline(1))
+
+ bwipeout!
+endfunc
+
" vim: shiftwidth=2 sts=2 expandtab
diff --git a/src/testdir/test_vim9_assign.vim b/src/testdir/test_vim9_assign.vim
index 4296c37..bb08943 100644
--- a/src/testdir/test_vim9_assign.vim
+++ b/src/testdir/test_vim9_assign.vim
@@ -650,7 +650,7 @@ def Test_assign_index()
var bl = 0z11
bl[1] = g:val
END
- v9.CheckDefExecAndScriptFailure(lines, 'E1030: Using a String as a Number: "22"')
+ v9.CheckDefExecAndScriptFailure(lines, ['E1030: Using a String as a Number: "22"', 'E1012: Type mismatch; expected number but got string'])
# should not read the next line when generating "a.b"
var a = {}
@@ -3687,4 +3687,16 @@ def Test_final_var_with_blob_value()
v9.CheckScriptSuccess(lines)
enddef
+" Test for overwriting a script-local function using the s: dictionary
+def Test_override_script_local_func()
+ var lines =<< trim END
+ vim9script
+ def MyFunc()
+ enddef
+ var d: dict<any> = s:
+ d.MyFunc = function('min')
+ END
+ v9.CheckScriptFailure(lines, 'E705: Variable name conflicts with existing function: MyFunc', 5)
+enddef
+
" vim: ts=8 sw=2 sts=2 expandtab tw=80 fdm=marker
diff --git a/src/testdir/test_vim9_builtin.vim b/src/testdir/test_vim9_builtin.vim
index 42d09fe..6b1a50d 100644
--- a/src/testdir/test_vim9_builtin.vim
+++ b/src/testdir/test_vim9_builtin.vim
@@ -960,6 +960,8 @@ def Test_execute()
assert_equal("\nhello", res)
res = execute(["echo 'here'", "echo 'there'"])
assert_equal("\nhere\nthere", res)
+ res = execute("echo 'hi'\n# foo")
+ assert_equal("\nhi", res)
v9.CheckSourceDefAndScriptFailure(['execute(123)'], ['E1013: Argument 1: type mismatch, expected string but got number', 'E1222: String or List required for argument 1'])
v9.CheckSourceDefFailure(['execute([123])'], 'E1013: Argument 1: type mismatch, expected list<string> but got list<number>')
@@ -2195,6 +2197,7 @@ def Test_indexof()
indexof(l, (i, v) => v.color == 'blue')->assert_equal(1)
indexof(l, (i, v) => v.color == 'blue', {startidx: 1})->assert_equal(1)
indexof(l, (i, v) => v.color == 'blue', {startidx: 2})->assert_equal(3)
+ indexof(l, "")->assert_equal(-1)
var b = 0zdeadbeef
indexof(b, "v:val == 0xef")->assert_equal(3)
@@ -4554,6 +4557,7 @@ enddef
def Test_term_getjob()
CheckRunVimInTerminal
v9.CheckSourceDefAndScriptFailure(['term_getjob(0z10)'], ['E1013: Argument 1: type mismatch, expected string but got blob', 'E1220: String or Number required for argument 1'])
+ v9.CheckSourceDefAndScriptSuccess(['assert_true(term_getjob(0) == null_job)'])
enddef
def Test_term_getline()
@@ -4783,8 +4787,6 @@ def Test_typename()
if has('channel')
assert_equal('channel', test_null_channel()->typename())
endif
- assert_equal('class<Unknown>', typename(null_class))
- assert_equal('object<Unknown>', typename(null_object))
var l: list<func(list<number>): number> = [function('min')]
assert_equal('list<func(list<number>): number>', typename(l))
enddef
@@ -5183,10 +5185,26 @@ enddef
def Test_getregion()
assert_equal(['x'], getregion(getpos('.'), getpos('.'))->map((_, _) => 'x'))
-
- v9.CheckSourceDefAndScriptFailure(['getregion(10, getpos("."))'], ['E1013: Argument 1: type mismatch, expected list<any> but got number', 'E1211: List required for argument 1'])
- assert_equal([''], getregion(getpos('.'), getpos('.')))
+ assert_equal(['x'], getregionpos(getpos('.'), getpos('.'))->map((_, _) => 'x'))
+
+ v9.CheckSourceDefAndScriptFailure(
+ ['getregion(10, getpos("."))'],
+ ['E1013: Argument 1: type mismatch, expected list<any> but got number', 'E1211: List required for argument 1']
+ )
+ v9.CheckSourceDefAndScriptFailure(
+ ['getregionpos(10, getpos("."))'],
+ ['E1013: Argument 1: type mismatch, expected list<any> but got number', 'E1211: List required for argument 1']
+ )
+ assert_equal(
+ [''],
+ getregion(getpos('.'), getpos('.'))
+ )
+ assert_equal(
+ [[[bufnr('%'), 1, 0, 0], [bufnr('%'), 1, 0, 0]]],
+ getregionpos(getpos('.'), getpos('.'))
+ )
v9.CheckSourceDefExecFailure(['getregion(getpos("a"), getpos("."))'], 'E1209:')
+ v9.CheckSourceDefExecFailure(['getregionpos(getpos("a"), getpos("."))'], 'E1209:')
enddef
" vim: ts=8 sw=2 sts=2 expandtab tw=80 fdm=marker
diff --git a/src/testdir/test_vim9_class.vim b/src/testdir/test_vim9_class.vim
index bd06c6e..e92fcc5 100644
--- a/src/testdir/test_vim9_class.vim
+++ b/src/testdir/test_vim9_class.vim
@@ -103,6 +103,18 @@ def Test_class_basic()
END
v9.CheckSourceFailure(lines, "E488: Trailing characters: | var y = 10", 3)
+ # Comments are allowed after an inline block
+ lines =<< trim END
+ vim9script
+ class Foo
+ static const bar = { # {{{
+ baz: 'qux'
+ } # }}}
+ endclass
+ assert_equal({baz: 'qux'}, Foo.bar)
+ END
+ v9.CheckSourceSuccess(lines)
+
# Try to define a class with the same name as an existing variable
lines =<< trim END
vim9script
@@ -533,6 +545,28 @@ def Test_using_null_class()
@_ = null_class.member
END
v9.CheckDefExecAndScriptFailure(lines, ['E715: Dictionary required', 'E1363: Incomplete type'])
+
+ # Test for using a null class as a value
+ lines =<< trim END
+ vim9script
+ echo empty(null_class)
+ END
+ v9.CheckSourceFailure(lines, 'E1405: Class "" cannot be used as a value', 2)
+
+ # Test for using a null class with string()
+ lines =<< trim END
+ vim9script
+ assert_equal('class [unknown]', string(null_class))
+ END
+ v9.CheckSourceSuccess(lines)
+
+ # Test for using a null class with type() and typename()
+ lines =<< trim END
+ vim9script
+ assert_equal(12, type(null_class))
+ assert_equal('class<Unknown>', typename(null_class))
+ END
+ v9.CheckSourceSuccess(lines)
enddef
def Test_class_interface_wrong_end()
@@ -10690,4 +10724,24 @@ def Test_class_definition_in_a_function()
v9.CheckScriptFailure(lines, 'E1429: Class can only be used in a script', 1)
enddef
+" Test for using [] with a class and an object
+def Test_class_object_index()
+ var lines =<< trim END
+ vim9script
+ class A
+ endclass
+ A[10] = 1
+ END
+ v9.CheckScriptFailure(lines, 'E689: Index not allowed after a class: A[10] = 1', 4)
+
+ lines =<< trim END
+ vim9script
+ class A
+ endclass
+ var a = A.new()
+ a[10] = 1
+ END
+ v9.CheckScriptFailure(lines, 'E689: Index not allowed after a object: a[10] = 1', 5)
+enddef
+
" vim: ts=8 sw=2 sts=2 expandtab tw=80 fdm=marker
diff --git a/src/testdir/test_vim9_expr.vim b/src/testdir/test_vim9_expr.vim
index 7764b37..5734731 100644
--- a/src/testdir/test_vim9_expr.vim
+++ b/src/testdir/test_vim9_expr.vim
@@ -309,6 +309,9 @@ def Test_expr2()
g:vals = [1]
endif
assert_equal([1], g:vals)
+
+ # string interpolation with ||
+ assert_equal('true', $"{0 || 1}")
END
v9.CheckDefAndScriptSuccess(lines)
@@ -415,6 +418,7 @@ def Test_expr2_fails()
v9.CheckDefExecAndScriptFailure(['var x = 3', 'if x', 'endif'], 'E1023:', 2)
v9.CheckDefAndScriptFailure(["var x = [] || false"], ['E1012: Type mismatch; expected bool but got list<any>', 'E745:'], 1)
+ v9.CheckDefAndScriptFailure(["var x = $'{false || []}'"], ['E1012: Type mismatch; expected bool but got list<any>', 'E745:'], 1)
var lines =<< trim END
vim9script
@@ -475,6 +479,9 @@ def Test_expr3()
failed = true
endif
assert_false(failed)
+
+ # string interpolation with &&
+ assert_equal('false', $"{1 && 0}")
END
v9.CheckDefAndScriptSuccess(lines)
enddef
@@ -574,6 +581,8 @@ def Test_expr3_fails()
echo true && s
END
v9.CheckDefAndScriptFailure(lines, ['E1012: Type mismatch; expected bool but got string', 'E1135: Using a String as a Bool: "asdf"'])
+
+ v9.CheckDefAndScriptFailure(["var x = $'{true && []}'"], ['E1012: Type mismatch; expected bool but got list<any>', 'E745:'], 1)
enddef
" global variables to use for tests with the "any" type
@@ -2109,6 +2118,12 @@ def Test_expr9_number()
Test()
END
v9.CheckDefAndScriptSuccess(lines)
+
+ lines =<< trim END
+ vim9script
+ eval("10\n")
+ END
+ v9.CheckSourceScriptFailure(lines, "E488: Trailing characters: \n")
enddef
def Test_expr9_float()
@@ -2152,6 +2167,7 @@ def Test_expr9_blob()
v9.CheckDefAndScriptSuccess(lines)
v9.CheckDefAndScriptFailure(["var x = 0z123"], 'E973:', 1)
+ v9.CheckDefAndScriptFailure(["var x = null_blox"], ['E1001:', 'E121:'], 1)
enddef
def Test_expr9_string()
diff --git a/src/testdir/test_vim9_func.vim b/src/testdir/test_vim9_func.vim
index b008929..d07bbfb 100644
--- a/src/testdir/test_vim9_func.vim
+++ b/src/testdir/test_vim9_func.vim
@@ -4633,6 +4633,19 @@ def Run_Test_keytyped_in_nested_function()
g:StopVimInTerminal(buf)
enddef
+" Test for test_override('defcompile')
+def Test_test_override_defcompile()
+ var lines =<< trim END
+ vim9script
+ def Foo()
+ xxx
+ enddef
+ END
+ test_override('defcompile', 1)
+ v9.CheckScriptFailure(lines, 'E476: Invalid command: xxx')
+ test_override('defcompile', 0)
+enddef
+
" The following messes up syntax highlight, keep near the end.
if has('python3')
def Test_python3_command()
diff --git a/src/testdir/test_vim9_import.vim b/src/testdir/test_vim9_import.vim
index 581925d..fb309cb 100644
--- a/src/testdir/test_vim9_import.vim
+++ b/src/testdir/test_vim9_import.vim
@@ -3068,7 +3068,10 @@ def Test_vim9_import_symlink()
var lines =<< trim END
vim9script
import autoload 'bar.vim'
- g:resultFunc = bar.Func()
+ def FooFunc(): string
+ return bar.Func()
+ enddef
+ g:resultFunc = FooFunc()
g:resultValue = bar.value
END
writefile(lines, 'Xto/plugin/foo.vim')
@@ -3222,4 +3225,109 @@ def Test_autoload_import_dict_func()
&rtp = save_rtp
enddef
+" Test for changing the value of an imported Dict item
+def Test_set_imported_dict_item()
+ var lines =<< trim END
+ vim9script
+ export var dict1: dict<bool> = {bflag: false}
+ export var dict2: dict<dict<bool>> = {x: {bflag: false}}
+ END
+ writefile(lines, 'XimportedDict.vim', 'D')
+
+ lines =<< trim END
+ vim9script
+ import './XimportedDict.vim'
+ assert_equal(XimportedDict.dict1.bflag, false)
+ XimportedDict.dict1.bflag = true
+ assert_equal(XimportedDict.dict1.bflag, true)
+ XimportedDict.dict2.x.bflag = true
+ assert_equal(XimportedDict.dict2.x.bflag, true)
+ assert_equal('bool', typename(XimportedDict.dict1.bflag))
+ assert_equal('bool', typename(XimportedDict.dict2.x.bflag))
+ assert_equal('bool', typename(XimportedDict.dict2['x'].bflag))
+ assert_equal('bool', typename(XimportedDict.dict2.x['bflag']))
+
+ assert_equal(XimportedDict.dict1['bflag'], true)
+ XimportedDict.dict1['bflag'] = false
+ assert_equal(XimportedDict.dict1.bflag, false)
+ XimportedDict.dict2['x']['bflag'] = false
+ assert_equal(XimportedDict.dict2['x'].bflag, false)
+ END
+ v9.CheckScriptSuccess(lines)
+
+ lines =<< trim END
+ vim9script
+ import './XimportedDict.vim'
+ XimportedDict.dict2.x.bflag = []
+ END
+ v9.CheckScriptFailure(lines, 'E1012: Type mismatch; expected bool but got list<any>', 3)
+enddef
+
+" Test for changing the value of an imported class member
+def Test_set_imported_class_member()
+ var lines =<< trim END
+ vim9script
+ export class Config
+ public static var option = false
+ endclass
+ END
+ writefile(lines, 'XimportedClass.vim', 'D')
+
+ lines =<< trim END
+ vim9script
+ import './XimportedClass.vim' as foo
+ type FooConfig = foo.Config
+ assert_equal(false, FooConfig.option)
+ assert_equal(false, foo.Config.option)
+ foo.Config.option = true
+ assert_equal(true, foo.Config.option)
+ assert_equal(true, FooConfig.option)
+ END
+ v9.CheckScriptSuccess(lines)
+enddef
+
+" Test for using an imported function from the vimrc file.  The function is
+" defined in the 'start' directory of a package.
+def Test_import_from_vimrc()
+ mkdir('Ximport/pack/foobar/start/foo/autoload', 'pR')
+ var lines =<< trim END
+ vim9script
+ export def Foo()
+ writefile(['Foo called'], 'Xoutput.log')
+ enddef
+ END
+ writefile(lines, 'Ximport/pack/foobar/start/foo/autoload/foo.vim')
+ lines =<< trim END
+ vim9script
+ set packpath+=./Ximport
+ try
+ import autoload 'foo.vim'
+ foo.Foo()
+ catch
+ writefile(['Failed to import foo.vim'], 'Xoutput.log')
+ endtry
+ qall!
+ END
+ writefile(lines, 'Xvimrc', 'D')
+ g:RunVim([], [], '-u Xvimrc')
+ assert_equal(['Foo called'], readfile('Xoutput.log'))
+ delete('Xoutput.log')
+enddef
+
+" Test for changing a locked imported variable
+def Test_import_locked_var()
+ var lines =<< trim END
+ vim9script
+ export var Foo: number = 10
+ lockvar Foo
+ END
+ writefile(lines, 'Ximportlockedvar.vim', 'D')
+ lines =<< trim END
+ vim9script
+ import './Ximportlockedvar.vim' as Bar
+ Bar.Foo = 20
+ END
+ v9.CheckScriptFailure(lines, 'E741: Value is locked: Foo', 3)
+enddef
+
" vim: ts=8 sw=2 sts=2 expandtab tw=80 fdm=marker
diff --git a/src/testdir/test_vim9_script.vim b/src/testdir/test_vim9_script.vim
index a3f21be..0b17150 100644
--- a/src/testdir/test_vim9_script.vim
+++ b/src/testdir/test_vim9_script.vim
@@ -2159,6 +2159,18 @@ def Test_echo_cmd()
assert_match('^two$', g:Screenline(&lines))
v9.CheckDefFailure(['echo "xxx"# comment'], 'E488:')
+
+ # Test for echoing a script local function name
+ var lines =<< trim END
+ vim9script
+ def ScriptLocalEcho()
+ enddef
+ echo ScriptLocalEcho
+ END
+ new
+ setline(1, lines)
+ assert_match('<SNR>\d\+_ScriptLocalEcho', execute('source')->split("\n")[0])
+ bw!
enddef
def Test_echomsg_cmd()
@@ -2510,8 +2522,20 @@ def Test_for_loop()
reslist->add('x')
endfor
assert_equal(['x', 'x', 'x'], reslist)
+
+ # Test for trying to use the loop variable "_" inside the loop
+ for _ in "a"
+ assert_fails('echo _', 'E1181: Cannot use an underscore here')
+ endfor
END
v9.CheckDefAndScriptSuccess(lines)
+
+ lines =<< trim END
+ for i : number : [1, 2]
+ echo i
+ endfor
+ END
+ v9.CheckSourceDefAndScriptFailure(lines, 'E1059: No white space allowed before colon: : [1, 2]', 1)
enddef
def Test_for_loop_list_of_lists()
@@ -4551,11 +4575,11 @@ def Run_Test_debug_with_lambda()
Func()
END
writefile(lines, 'XdebugFunc', 'D')
- var buf = g:RunVimInTerminal('-S XdebugFunc', {rows: 6, wait_for_ruler: 0})
- g:WaitForAssert(() => assert_match('^>', term_getline(buf, 6)))
+ var buf = g:RunVimInTerminal('-S XdebugFunc', {rows: 10, wait_for_ruler: 0})
+ g:WaitForAssert(() => assert_match('^>', term_getline(buf, 10)))
term_sendkeys(buf, "cont\<CR>")
- g:WaitForAssert(() => assert_match('\[0\]', term_getline(buf, 5)))
+ g:WaitForAssert(() => assert_match('\[0\]', term_getline(buf, 9)))
g:StopVimInTerminal(buf)
enddef
@@ -4586,12 +4610,12 @@ def Run_Test_debug_running_out_of_lines()
Crash()
END
writefile(lines, 'XdebugFunc', 'D')
- var buf = g:RunVimInTerminal('-S XdebugFunc', {rows: 6, wait_for_ruler: 0})
- g:WaitForAssert(() => assert_match('^>', term_getline(buf, 6)))
+ var buf = g:RunVimInTerminal('-S XdebugFunc', {rows: 10, wait_for_ruler: 0})
+ g:WaitForAssert(() => assert_match('^>', term_getline(buf, 10)))
term_sendkeys(buf, "next\<CR>")
g:TermWait(buf)
- g:WaitForAssert(() => assert_match('^>', term_getline(buf, 6)))
+ g:WaitForAssert(() => assert_match('^>', term_getline(buf, 10)))
term_sendkeys(buf, "cont\<CR>")
g:TermWait(buf)
@@ -5002,7 +5026,7 @@ def Test_invalid_type_in_for()
enddef
defcompile
END
- v9.CheckSourceFailure(lines, 'E1010: Type not recognized: x in range(10)', 1)
+ v9.CheckSourceFailure(lines, 'E1010: Type not recognized: x', 1)
enddef
" Test for using a line break between the variable name and the type in a for
@@ -5055,6 +5079,56 @@ def Test_eval_lambda_block()
v9.CheckSourceSuccess(lines)
enddef
+" Test for using various null values
+def Test_null_values()
+ var lines =<< trim END
+ var nullValues = [
+ [null, 1, 'null', 7, 'special'],
+ [null_blob, 1, '0z', 10, 'blob'],
+ [null_channel, 1, 'channel fail', 9, 'channel'],
+ [null_dict, 1, '{}', 4, 'dict<any>'],
+ [null_function, 1, "function('')", 2, 'func(...): unknown'],
+ [null_job, 1, 'no process', 8, 'job'],
+ [null_list, 1, '[]', 3, 'list<any>'],
+ [null_object, 1, 'object of [unknown]', 13, 'object<Unknown>'],
+ [null_partial, 1, "function('')", 2, 'func(...): unknown'],
+ [null_string, 1, "''", 1, 'string']
+ ]
+
+ for [Val, emptyExp, stringExp, typeExp, typenameExp] in nullValues
+ assert_equal(emptyExp, empty(Val))
+ assert_equal(stringExp, string(Val))
+ assert_equal(typeExp, type(Val))
+ assert_equal(typenameExp, typename(Val))
+ assert_equal(Val, copy(Val))
+ assert_equal(-1, test_refcount(Val))
+ endfor
+ END
+ v9.CheckSourceDefAndScriptSuccess(lines)
+enddef
+
+" Test for using an unknown type in a typecast
+def Test_unknown_type_in_typecast()
+ var lines =<< trim END
+ vim9script
+ var a = <MyType>b
+ END
+ v9.CheckSourceFailure(lines, 'E1010: Type not recognized: MyType', 2)
+
+ lines =<< trim END
+ vim9script
+ var Fn = <funcx(number, number): number>b
+ END
+ v9.CheckSourceFailure(lines, 'E1010: Type not recognized: funcx(number, number): number', 2)
+
+ # Wrong type in a type cast
+ lines =<< trim END
+ vim9script
+ var i: number = <number>true
+ END
+ v9.CheckSourceFailure(lines, 'E1012: Type mismatch; expected number but got bool', 2)
+enddef
+
" Keep this last, it messes up highlighting.
def Test_substitute_cmd()
new
diff --git a/src/testdir/test_vim9_typealias.vim b/src/testdir/test_vim9_typealias.vim
index cf540c2..2792d45 100644
--- a/src/testdir/test_vim9_typealias.vim
+++ b/src/testdir/test_vim9_typealias.vim
@@ -363,7 +363,7 @@ def Test_typealias_import()
var myNum: A.SomeType = 10
END
- v9.CheckScriptFailure(lines, 'E1010: Type not recognized: A.SomeType = 10', 4)
+ v9.CheckScriptFailure(lines, 'E1010: Type not recognized: A.SomeType', 4)
# Use a type alias that is not exported
lines =<< trim END
diff --git a/src/testdir/test_viminfo.vim b/src/testdir/test_viminfo.vim
index 1f4a72d..7aab271 100644
--- a/src/testdir/test_viminfo.vim
+++ b/src/testdir/test_viminfo.vim
@@ -1299,4 +1299,34 @@ func Test_viminfo_merge_old_jumplist()
bw!
endfunc
+func Test_viminfo_oldfiles_filter()
+ let v:oldfiles = []
+ let _viminfofile = &viminfofile
+ let &viminfofile=''
+ let lines = [
+ \ '# comment line',
+ \ '*encoding=utf-8',
+ \ "> /tmp/vimrc_one.vim",
+ \ "\t\"\t11\t0",
+ \ "",
+ \ "> /tmp/foobar.txt",
+ \ "\t\"\t11\t0",
+ \ "",
+ \ ]
+ call writefile(lines, 'Xviminfo1', 'D')
+ rviminfo! Xviminfo1
+ new
+ " filter returns a single item
+ let a = execute('filter /vim/ oldfiles')->split('\n')
+ call assert_equal(1, len(a))
+ " filter returns more than a single match
+ let a = execute('filter #tmp# oldfiles')->split('\n')
+ call assert_equal(2, len(a))
+ " don't get prompted for the file, but directly open it
+ filter /vim/ browse oldfiles
+ call assert_equal("/tmp/vimrc_one.vim", expand("%"))
+ bw
+ let &viminfofile = _viminfofile
+endfunc
+
" vim: shiftwidth=2 sts=2 expandtab
diff --git a/src/testdir/test_vimscript.vim b/src/testdir/test_vimscript.vim
index 0c4aedb..8976779 100644
--- a/src/testdir/test_vimscript.vim
+++ b/src/testdir/test_vimscript.vim
@@ -7509,6 +7509,14 @@ func Test_for_over_string()
let res ..= c .. '-'
endfor
call assert_equal('', res)
+
+ " Test for using "_" as the loop variable
+ let i = 0
+ let s = 'abc'
+ for _ in s
+ call assert_equal(s[i], _)
+ let i += 1
+ endfor
endfunc
" Test for deeply nested :source command {{{1
diff --git a/src/testdir/test_virtualedit.vim b/src/testdir/test_virtualedit.vim
index 48d4aa0..3d3fdd0 100644
--- a/src/testdir/test_virtualedit.vim
+++ b/src/testdir/test_virtualedit.vim
@@ -709,5 +709,27 @@ func Test_virtualedit_replace_after_tab()
bwipe!
endfunc
+" Test that setpos('.') and cursor() behave the same for v:maxcol
+func Test_virtualedit_set_cursor_pos_maxcol()
+ new
+ set virtualedit=all
+
+ call setline(1, 'foobar')
+ exe "normal! V\<Esc>"
+ call assert_equal([0, 1, 1, 0], getpos("'<"))
+ call assert_equal([0, 1, v:maxcol, 0], getpos("'>"))
+ let pos = getpos("'>")
+
+ call cursor(1, 1)
+ call setpos('.', pos)
+ call assert_equal([0, 1, 7, 0], getpos('.'))
+
+ call cursor(1, 1)
+ call cursor(pos[1:])
+ call assert_equal([0, 1, 7, 0], getpos('.'))
+
+ set virtualedit&
+ bwipe!
+endfunc
" vim: shiftwidth=2 sts=2 expandtab
diff --git a/src/testdir/test_visual.vim b/src/testdir/test_visual.vim
index adcc3e9..3750ebf 100644
--- a/src/testdir/test_visual.vim
+++ b/src/testdir/test_visual.vim
@@ -1631,6 +1631,22 @@ func Test_visual_substitute_visual()
bwipe!
endfunc
+func Test_virtualedit_exclusive_selection()
+ new
+ set virtualedit=all selection=exclusive
+
+ call setline(1, "a\tb")
+ normal! 0v8ly
+ call assert_equal("a\t", getreg('"'))
+ normal! 0v6ly
+ call assert_equal('a ', getreg('"'))
+ normal! 06lv2ly
+ call assert_equal(' ', getreg('"'))
+
+ set virtualedit& selection&
+ bwipe!
+endfunc
+
func Test_visual_getregion()
let lines =<< trim END
new
@@ -1640,18 +1656,52 @@ func Test_visual_getregion()
#" Visual mode
call cursor(1, 1)
call feedkeys("\<ESC>vjl", 'tx')
+
call assert_equal(['one', 'tw'],
\ 'v'->getpos()->getregion(getpos('.')))
+ call assert_equal([
+ \ [[bufnr('%'), 1, 1, 0], [bufnr('%'), 1, 3, 0]],
+ \ [[bufnr('%'), 2, 1, 0], [bufnr('%'), 2, 2, 0]]
+ \ ],
+ \ 'v'->getpos()->getregionpos(getpos('.')))
+
call assert_equal(['one', 'tw'],
\ '.'->getpos()->getregion(getpos('v')))
+ call assert_equal([
+ \ [[bufnr('%'), 1, 1, 0], [bufnr('%'), 1, 3, 0]],
+ \ [[bufnr('%'), 2, 1, 0], [bufnr('%'), 2, 2, 0]]
+ \ ],
+ \ '.'->getpos()->getregionpos(getpos('v')))
+
call assert_equal(['o'],
\ 'v'->getpos()->getregion(getpos('v')))
+ call assert_equal([
+ \ [[bufnr('%'), 1, 1, 0], [bufnr('%'), 1, 1, 0]],
+ \ ],
+ \ 'v'->getpos()->getregionpos(getpos('v')))
+
call assert_equal(['w'],
\ '.'->getpos()->getregion(getpos('.'), {'type': 'v' }))
+ call assert_equal([
+ \ [[bufnr('%'), 2, 2, 0], [bufnr('%'), 2, 2, 0]],
+ \ ],
+ \ '.'->getpos()->getregionpos(getpos('.'), {'type': 'v' }))
+
call assert_equal(['one', 'two'],
\ getpos('.')->getregion(getpos('v'), {'type': 'V' }))
+ call assert_equal([
+ \ [[bufnr('%'), 1, 1, 0], [bufnr('%'), 1, 3, 0]],
+ \ [[bufnr('%'), 2, 1, 0], [bufnr('%'), 2, 3, 0]],
+ \ ],
+ \ getpos('.')->getregionpos(getpos('v'), {'type': 'V' }))
+
call assert_equal(['on', 'tw'],
\ getpos('.')->getregion(getpos('v'), {'type': "\<C-v>" }))
+ call assert_equal([
+ \ [[bufnr('%'), 1, 1, 0], [bufnr('%'), 1, 2, 0]],
+ \ [[bufnr('%'), 2, 1, 0], [bufnr('%'), 2, 2, 0]],
+ \ ],
+ \ getpos('.')->getregionpos(getpos('v'), {'type': "\<C-v>" }))
#" Line visual mode
call cursor(1, 1)
@@ -1698,6 +1748,9 @@ func Test_visual_getregion()
\ "'a"->getpos()->getregion(getpos("'a"), {'type': 'V' }))
call assert_equal(['one', 'two'],
\ "."->getpos()->getregion(getpos("'a"), {'type': "\<c-v>" }))
+ call feedkeys("\<ESC>jVj\<ESC>", 'tx')
+ call assert_equal(['two', 'three'], getregion(getpos("'<"), getpos("'>")))
+ call assert_equal(['two', 'three'], getregion(getpos("'>"), getpos("'<")))
#" Using List
call cursor(1, 1)
@@ -1717,24 +1770,185 @@ func Test_visual_getregion()
call feedkeys("\<ESC>Vjj", 'tx')
call assert_equal(['one', 'two', 'three'],
\ getregion(getpos('v'), getpos('.'), {'type': 'V' }))
+ call assert_equal([
+ \ [[bufnr('%'), 1, 1, 0], [bufnr('%'), 1, 3, 0]],
+ \ [[bufnr('%'), 2, 1, 0], [bufnr('%'), 2, 3, 0]],
+ \ [[bufnr('%'), 3, 1, 0], [bufnr('%'), 3, 5, 0]],
+ \ ],
+ \ getregionpos(getpos('v'), getpos('.'), {'type': 'V' }))
+ call assert_equal([
+ \ [[bufnr('%'), 1, 1, 0], [bufnr('%'), 1, 4, 0]],
+ \ [[bufnr('%'), 2, 1, 0], [bufnr('%'), 2, 4, 0]],
+ \ [[bufnr('%'), 3, 1, 0], [bufnr('%'), 3, 6, 0]],
+ \ ],
+ \ getregionpos(getpos('v'), getpos('.'),
+ \ {'type': 'V', 'eol': v:true }))
#" Multiline with block visual mode
call cursor(1, 1)
call feedkeys("\<ESC>\<C-v>jj", 'tx')
call assert_equal(['o', 't', 't'],
\ getregion(getpos('v'), getpos('.'), {'type': "\<C-v>" }))
+ call assert_equal([
+ \ [[bufnr('%'), 1, 1, 0], [bufnr('%'), 1, 1, 0]],
+ \ [[bufnr('%'), 2, 1, 0], [bufnr('%'), 2, 1, 0]],
+ \ [[bufnr('%'), 3, 1, 0], [bufnr('%'), 3, 1, 0]],
+ \ ],
+ \ getregionpos(getpos('v'), getpos('.'), {'type': "\<C-v>" }))
call cursor(1, 1)
call feedkeys("\<ESC>\<C-v>jj$", 'tx')
call assert_equal(['one', 'two', 'three'],
\ getregion(getpos('v'), getpos('.'), {'type': "\<C-v>" }))
+ call assert_equal([
+ \ [[bufnr('%'), 1, 1, 0], [bufnr('%'), 1, 3, 0]],
+ \ [[bufnr('%'), 2, 1, 0], [bufnr('%'), 2, 3, 0]],
+ \ [[bufnr('%'), 3, 1, 0], [bufnr('%'), 3, 5, 0]],
+ \ ],
+ \ getregionpos(getpos('v'), getpos('.'), {'type': "\<C-v>" }))
+ call assert_equal([
+ \ [[bufnr('%'), 1, 1, 0], [bufnr('%'), 1, 3, 0]],
+ \ [[bufnr('%'), 2, 1, 0], [bufnr('%'), 2, 3, 0]],
+ \ [[bufnr('%'), 3, 1, 0], [bufnr('%'), 3, 5, 0]],
+ \ ],
+ \ getregionpos(getpos('v'), getpos('.'),
+ \ {'type': "\<C-v>", 'eol': v:true }))
#" 'virtualedit'
set virtualedit=all
+
call cursor(1, 1)
call feedkeys("\<ESC>\<C-v>10ljj$", 'tx')
call assert_equal(['one ', 'two ', 'three '],
\ getregion(getpos('v'), getpos('.'), {'type': "\<C-v>" }))
+ call assert_equal([
+ \ [[bufnr('%'), 1, 1, 0], [bufnr('%'), 1, 3, 0]],
+ \ [[bufnr('%'), 2, 1, 0], [bufnr('%'), 2, 3, 0]],
+ \ [[bufnr('%'), 3, 1, 0], [bufnr('%'), 3, 5, 0]],
+ \ ],
+ \ getregionpos(getpos('v'), getpos('.'), {'type': "\<C-v>" }))
+ call assert_equal([
+ \ [[bufnr('%'), 1, 1, 0], [bufnr('%'), 1, 4, 3]],
+ \ [[bufnr('%'), 2, 1, 0], [bufnr('%'), 2, 4, 3]],
+ \ [[bufnr('%'), 3, 1, 0], [bufnr('%'), 3, 6, 1]],
+ \ ],
+ \ getregionpos(getpos('v'), getpos('.'),
+ \ {'type': "\<C-v>", 'eol': v:true }))
+
+ call cursor(3, 5)
+ call feedkeys("\<ESC>\<C-v>hkk", 'tx')
+ call assert_equal([' ', ' ', 'ee'],
+ \ getregion(getpos('v'), getpos('.'), {'type': "\<C-v>" }))
+ call assert_equal([
+ \ [[bufnr('%'), 1, 0, 0], [bufnr('%'), 1, 0, 0]],
+ \ [[bufnr('%'), 2, 0, 0], [bufnr('%'), 2, 0, 0]],
+ \ [[bufnr('%'), 3, 4, 0], [bufnr('%'), 3, 5, 0]],
+ \ ],
+ \ getregionpos(getpos('v'), getpos('.'), {'type': "\<C-v>" }))
+ call assert_equal([
+ \ [[bufnr('%'), 1, 4, 0], [bufnr('%'), 1, 4, 2]],
+ \ [[bufnr('%'), 2, 4, 0], [bufnr('%'), 2, 4, 2]],
+ \ [[bufnr('%'), 3, 4, 0], [bufnr('%'), 3, 5, 0]],
+ \ ],
+ \ getregionpos(getpos('v'), getpos('.'),
+ \ {'type': "\<C-v>", 'eol': v:true }))
+
+ call cursor(3, 5)
+ call feedkeys("\<ESC>\<C-v>kk", 'tx')
+ call assert_equal([' ', ' ', 'e'],
+ \ getregion(getpos('v'), getpos('.'), {'type': "\<C-v>" }))
+ call assert_equal([
+ \ [[bufnr('%'), 1, 0, 0], [bufnr('%'), 1, 0, 0]],
+ \ [[bufnr('%'), 2, 0, 0], [bufnr('%'), 2, 0, 0]],
+ \ [[bufnr('%'), 3, 5, 0], [bufnr('%'), 3, 5, 0]],
+ \ ],
+ \ getregionpos(getpos('v'), getpos('.'), {'type': "\<C-v>" }))
+ call assert_equal([
+ \ [[bufnr('%'), 1, 4, 1], [bufnr('%'), 1, 4, 2]],
+ \ [[bufnr('%'), 2, 4, 1], [bufnr('%'), 2, 4, 2]],
+ \ [[bufnr('%'), 3, 5, 0], [bufnr('%'), 3, 5, 0]],
+ \ ],
+ \ getregionpos(getpos('v'), getpos('.'),
+ \ {'type': "\<C-v>", 'eol': v:true }))
+
+ call cursor(1, 3)
+ call feedkeys("\<ESC>vjj4l", 'tx')
+ call assert_equal(['e', 'two', 'three '],
+ \ getregion(getpos('v'), getpos('.'), {'type': 'v' }))
+ call assert_equal([
+ \ [[bufnr('%'), 1, 3, 0], [bufnr('%'), 1, 3, 0]],
+ \ [[bufnr('%'), 2, 1, 0], [bufnr('%'), 2, 3, 0]],
+ \ [[bufnr('%'), 3, 1, 0], [bufnr('%'), 3, 5, 0]],
+ \ ],
+ \ getregionpos(getpos('v'), getpos('.'), {'type': 'v' }))
+ call assert_equal([
+ \ [[bufnr('%'), 1, 3, 0], [bufnr('%'), 1, 4, 0]],
+ \ [[bufnr('%'), 2, 1, 0], [bufnr('%'), 2, 4, 0]],
+ \ [[bufnr('%'), 3, 1, 0], [bufnr('%'), 3, 6, 2]],
+ \ ],
+ \ getregionpos(getpos('v'), getpos('.'),
+ \ {'type': 'v', 'eol': v:true }))
+
+ call cursor(1, 3)
+ call feedkeys("\<ESC>lvjj3l", 'tx')
+ call assert_equal(['', 'two', 'three '],
+ \ getregion(getpos('v'), getpos('.'), {'type': 'v' }))
+ call assert_equal([
+ \ [[bufnr('%'), 1, 0, 0], [bufnr('%'), 1, 0, 0]],
+ \ [[bufnr('%'), 2, 1, 0], [bufnr('%'), 2, 3, 0]],
+ \ [[bufnr('%'), 3, 1, 0], [bufnr('%'), 3, 5, 0]],
+ \ ],
+ \ getregionpos(getpos('v'), getpos('.'), {'type': 'v' }))
+ call assert_equal([
+ \ [[bufnr('%'), 1, 4, 0], [bufnr('%'), 1, 4, 0]],
+ \ [[bufnr('%'), 2, 1, 0], [bufnr('%'), 2, 4, 0]],
+ \ [[bufnr('%'), 3, 1, 0], [bufnr('%'), 3, 6, 2]],
+ \ ],
+ \ getregionpos(getpos('v'), getpos('.'),
+ \ {'type': 'v', 'eol': v:true }))
+
+ call cursor(3, 5)
+ call feedkeys("\<ESC>v3l", 'tx')
+ call assert_equal(['e '],
+ \ getregion(getpos('v'), getpos('.'), {'type': 'v' }))
+ call assert_equal([
+ \ [[bufnr('%'), 3, 5, 0], [bufnr('%'), 3, 5, 0]],
+ \ ],
+ \ getregionpos(getpos('v'), getpos('.'), {'type': 'v' }))
+ call assert_equal([
+ \ [[bufnr('%'), 3, 5, 0], [bufnr('%'), 3, 6, 3]],
+ \ ],
+ \ getregionpos(getpos('v'), getpos('.'),
+ \ {'type': 'v', 'eol': v:true }))
+
+ call cursor(3, 5)
+ call feedkeys("\<ESC>lv3l", 'tx')
+ call assert_equal([' '],
+ \ getregion(getpos('v'), getpos('.'), {'type': 'v' }))
+ call assert_equal([
+ \ [[bufnr('%'), 3, 0, 0], [bufnr('%'), 3, 0, 0]],
+ \ ],
+ \ getregionpos(getpos('v'), getpos('.'), {'type': 'v' }))
+ call assert_equal([
+ \ [[bufnr('%'), 3, 6, 0], [bufnr('%'), 3, 6, 4]],
+ \ ],
+ \ getregionpos(getpos('v'), getpos('.'),
+ \ {'type': 'v', 'eol': v:true }))
+
+ call cursor(3, 5)
+ call feedkeys("\<ESC>3lv3l", 'tx')
+ call assert_equal([' '],
+ \ getregion(getpos('v'), getpos('.'), {'type': 'v' }))
+ call assert_equal([
+ \ [[bufnr('%'), 3, 0, 0], [bufnr('%'), 3, 0, 0]],
+ \ ],
+ \ getregionpos(getpos('v'), getpos('.'), {'type': 'v' }))
+ call assert_equal([
+ \ [[bufnr('%'), 3, 6, 2], [bufnr('%'), 3, 6, 6]],
+ \ ],
+ \ getregionpos(getpos('v'), getpos('.'),
+ \ {'type': 'v', 'eol': v:true }))
+
set virtualedit&
#" using wrong types for positions
@@ -1743,9 +1957,21 @@ func Test_visual_getregion()
call assert_fails("call getregion(1, 2)", 'E1211:')
call assert_fails("call getregion(getpos('.'), {})", 'E1211:')
call assert_fails(':echo "."->getpos()->getregion("$", [])', 'E1211:')
+ call assert_fails("call getregionpos(1, 2)", 'E1211:')
+ call assert_fails("call getregionpos(getpos('.'), {})", 'E1211:')
+ call assert_fails(':echo "."->getpos()->getregionpos("$", [])', 'E1211:')
#" using invalid value for "type"
call assert_fails("call getregion(getpos('.'), getpos('.'), {'type': '' })", 'E475:')
+ call assert_fails("call getregionpos(getpos('.'), getpos('.'), {'type': '' })", 'E475:')
+ call assert_fails("call getregion(getpos('.'), getpos('.'), {'type': 'v0' })", 'E475:')
+ call assert_fails("call getregionpos(getpos('.'), getpos('.'), {'type': 'v0' })", 'E475:')
+ call assert_fails("call getregion(getpos('.'), getpos('.'), {'type': 'V0' })", 'E475:')
+ call assert_fails("call getregionpos(getpos('.'), getpos('.'), {'type': 'V0' })", 'E475:')
+ call assert_fails("call getregion(getpos('.'), getpos('.'), {'type': '\<C-v>0' })", 'E475:')
+ call assert_fails("call getregionpos(getpos('.'), getpos('.'), {'type': '\<C-v>0' })", 'E475:')
+ call assert_fails("call getregion(getpos('.'), getpos('.'), {'type': '\<C-v>1:' })", 'E475:')
+ call assert_fails("call getregionpos(getpos('.'), getpos('.'), {'type': '\<C-v>1:' })", 'E475:')
#" using a mark from another buffer to current buffer
new
@@ -1756,13 +1982,20 @@ func Test_visual_getregion()
call assert_equal([g:buf, 10, 1, 0], getpos("'A"))
call assert_equal([], getregion(getpos('.'), getpos("'A"), {'type': 'v' }))
call assert_equal([], getregion(getpos("'A"), getpos('.'), {'type': 'v' }))
+ call assert_equal([], getregionpos(getpos('.'), getpos("'A"), {'type': 'v' }))
+ call assert_equal([], getregionpos(getpos("'A"), getpos('.'), {'type': 'v' }))
#" using two marks from another buffer
wincmd p
normal! GmB
wincmd p
call assert_equal([g:buf, 10, 1, 0], getpos("'B"))
- call assert_equal(['9'], getregion(getpos("'B"), getpos("'A"), {'type': 'v' }))
+ call assert_equal(['9'],
+ \ getregion(getpos("'B"), getpos("'A"), {'type': 'v' }))
+ call assert_equal([
+ \ [[g:buf, 10, 1, 0], [g:buf, 10, 1, 0]],
+ \ ],
+ \ getregionpos(getpos("'B"), getpos("'A"), {'type': 'v' }))
#" using two positions from another buffer
for type in ['v', 'V', "\<C-V>"]
@@ -1773,6 +2006,12 @@ func Test_visual_getregion()
call assert_equal(range(10)->mapnew('string(v:val)'),
\ getregion([g:buf, 10, 2, 0], [g:buf, 1, 1, 0],
\ {'type': type, 'exclusive': exclusive }))
+ call assert_equal(range(1, 10)->mapnew('repeat([[g:buf, v:val, 1, 0]], 2)'),
+ \ getregionpos([g:buf, 1, 1, 0], [g:buf, 10, 2, 0],
+ \ {'type': type, 'exclusive': exclusive }))
+ call assert_equal(range(1, 10)->mapnew('repeat([[g:buf, v:val, 1, 0]], 2)'),
+ \ getregionpos([g:buf, 10, 2, 0], [g:buf, 1, 1, 0],
+ \ {'type': type, 'exclusive': exclusive }))
endfor
endfor
@@ -1785,17 +2024,18 @@ func Test_visual_getregion()
call assert_fails('call getregion([g:buf, 10, 0, 0], [g:buf, 1, 1, 0])', 'E964:')
call assert_fails('call getregion([g:buf, 1, 1, 0], [g:buf, 10, 3, 0])', 'E964:')
call assert_fails('call getregion([g:buf, 10, 3, 0], [g:buf, 1, 1, 0])', 'E964:')
+ call assert_fails('call getregion([g:buf, 1, 0, 0], [g:buf, 1, 1, 0])', 'E964:')
+ call assert_fails('call getregion([g:buf, 1, 1, 0], [g:buf, 1, 0, 0])', 'E964:')
#" using invalid buffer
call assert_fails('call getregion([10000, 10, 1, 0], [10000, 10, 1, 0])', 'E681:')
exe $':{g:buf}bwipe!'
unlet g:buf
+ bwipe!
END
call v9.CheckLegacyAndVim9Success(lines)
- bwipe!
-
let lines =<< trim END
#" Selection in starts or ends in the middle of a multibyte character
new
@@ -1804,35 +2044,119 @@ func Test_visual_getregion()
\ "\U0001f1e6\u00ab\U0001f1e7\u00ab\U0001f1e8\u00ab\U0001f1e9",
\ "1234567890"
\ ])
+
call cursor(1, 3)
call feedkeys("\<Esc>\<C-v>ljj", 'xt')
call assert_equal(['cd', "\u00ab ", '34'],
\ getregion(getpos('v'), getpos('.'), {'type': "\<C-v>" }))
+ call assert_equal([
+ \ [[bufnr('%'), 1, 3, 0], [bufnr('%'), 1, 4, 0]],
+ \ [[bufnr('%'), 2, 5, 0], [bufnr('%'), 2, 7, 1]],
+ \ [[bufnr('%'), 3, 3, 0], [bufnr('%'), 3, 4, 0]],
+ \ ],
+ \ getregionpos(getpos('v'), getpos('.'), {'type': "\<C-v>" }))
+
call cursor(1, 4)
call feedkeys("\<Esc>\<C-v>ljj", 'xt')
call assert_equal(['de', "\U0001f1e7", '45'],
\ getregion(getpos('v'), getpos('.'), {'type': "\<C-v>" }))
+ call assert_equal([
+ \ [[bufnr('%'), 1, 4, 0], [bufnr('%'), 1, 5, 0]],
+ \ [[bufnr('%'), 2, 7, 0], [bufnr('%'), 2, 10, 0]],
+ \ [[bufnr('%'), 3, 4, 0], [bufnr('%'), 3, 5, 0]],
+ \ ],
+ \ getregionpos(getpos('v'), getpos('.'), {'type': "\<C-v>" }))
+
call cursor(1, 5)
call feedkeys("\<Esc>\<C-v>jj", 'xt')
call assert_equal(['e', ' ', '5'],
\ getregion(getpos('v'), getpos('.'), {'type': "\<C-v>" }))
+ call assert_equal([
+ \ [[bufnr('%'), 1, 5, 0], [bufnr('%'), 1, 5, 0]],
+ \ [[bufnr('%'), 2, 7, 1], [bufnr('%'), 2, 7, 2]],
+ \ [[bufnr('%'), 3, 5, 0], [bufnr('%'), 3, 5, 0]],
+ \ ],
+ \ getregionpos(getpos('v'), getpos('.'), {'type': "\<C-v>" }))
+ call assert_equal(['efghijk«', '🇦«🇧«🇨«🇩', '12345'],
+ \ getregion(getpos('v'), getpos('.'), {'type': 'v' }))
+ call assert_equal([
+ \ [[bufnr('%'), 1, 5, 0], [bufnr('%'), 1, 13, 0]],
+ \ [[bufnr('%'), 2, 1, 0], [bufnr('%'), 2, 22, 0]],
+ \ [[bufnr('%'), 3, 1, 0], [bufnr('%'), 3, 5, 0]],
+ \ ],
+ \ getregionpos(getpos('v'), getpos('.'), {'type': 'v' }))
+
+ call cursor(1, 5)
+ call feedkeys("\<Esc>\<C-v>5l2j", 'xt')
+ call assert_equal(['efghij', ' «🇨« ', '567890'],
+ \ getregion(getpos('v'), getpos('.'), {'type': "\<C-v>" }))
+ call assert_equal([
+ \ [[bufnr('%'), 1, 5, 0], [bufnr('%'), 1, 10, 0]],
+ \ [[bufnr('%'), 2, 7, 1], [bufnr('%'), 2, 19, 1]],
+ \ [[bufnr('%'), 3, 5, 0], [bufnr('%'), 3, 10, 0]],
+ \ ],
+ \ getregionpos(getpos('v'), getpos('.'), {'type': "\<C-v>" }))
+
+ call cursor(1, 4)
+ call feedkeys("\<Esc>\<C-v>02j", 'xt')
+ call assert_equal(['abcd', '🇦« ', '1234'],
+ \ getregion(getpos('v'), getpos('.'), {'type': "\<C-v>" }))
+ call assert_equal([
+ \ [[bufnr('%'), 1, 1, 0], [bufnr('%'), 1, 4, 0]],
+ \ [[bufnr('%'), 2, 1, 0], [bufnr('%'), 2, 7, 1]],
+ \ [[bufnr('%'), 3, 1, 0], [bufnr('%'), 3, 4, 0]],
+ \ ],
+ \ getregionpos(getpos('v'), getpos('.'), {'type': "\<C-v>" }))
+
+ #" characterwise selection with multibyte chars
call cursor(1, 1)
call feedkeys("\<Esc>vj", 'xt')
call assert_equal(['abcdefghijk«', "\U0001f1e6"],
\ getregion(getpos('v'), getpos('.'), {'type': 'v' }))
+ call assert_equal([
+ \ [[bufnr('%'), 1, 1, 0], [bufnr('%'), 1, 13, 0]],
+ \ [[bufnr('%'), 2, 1, 0], [bufnr('%'), 2, 4, 0]],
+ \ ],
+ \ getregionpos(getpos('v'), getpos('.'), {'type': 'v' }))
+
+ set selection=exclusive
+ call feedkeys('l', 'xt')
+ call assert_equal(['abcdefghijk«', "\U0001f1e6"],
+ \ getregion(getpos('v'), getpos('.'), {'type': 'v' }))
+ call assert_equal([
+ \ [[bufnr('%'), 1, 1, 0], [bufnr('%'), 1, 13, 0]],
+ \ [[bufnr('%'), 2, 1, 0], [bufnr('%'), 2, 4, 0]],
+ \ ],
+ \ getregionpos(getpos('v'), getpos('.'), {'type': 'v' }))
#" marks on multibyte chars
- :set selection=exclusive
call setpos("'a", [0, 1, 11, 0])
call setpos("'b", [0, 2, 16, 0])
call setpos("'c", [0, 2, 0, 0])
call cursor(1, 1)
+
call assert_equal(['ghijk', '🇨«🇩'],
- \ getregion(getpos("'a"), getpos("'b"), {'type': "\<c-v>" }))
+ \ getregion(getpos("'a"), getpos("'b"), {'type': "\<C-v>" }))
+ call assert_equal([
+ \ [[bufnr('%'), 1, 7, 0], [bufnr('%'), 1, 11, 0]],
+ \ [[bufnr('%'), 2, 13, 0], [bufnr('%'), 2, 22, 0]],
+ \ ],
+ \ getregionpos(getpos("'a"), getpos("'b"), {'type': "\<C-v>" }))
+
call assert_equal(['k«', '🇦«🇧«🇨'],
\ getregion(getpos("'a"), getpos("'b"), {'type': 'v' }))
+ call assert_equal([
+ \ [[bufnr('%'), 1, 11, 0], [bufnr('%'), 1, 13, 0]],
+ \ [[bufnr('%'), 2, 1, 0], [bufnr('%'), 2, 16, 0]],
+ \ ],
+ \ getregionpos(getpos("'a"), getpos("'b"), {'type': 'v' }))
+
call assert_equal(['k«'],
\ getregion(getpos("'a"), getpos("'c"), {'type': 'v' }))
+ call assert_equal([
+ \ [[bufnr('%'), 1, 11, 0], [bufnr('%'), 1, 13, 0]],
+ \ ],
+ \ getregionpos(getpos("'a"), getpos("'c"), {'type': 'v' }))
#" use inclusive selection, although 'selection' is exclusive
call setpos("'a", [0, 1, 11, 0])
@@ -1855,12 +2179,12 @@ func Test_visual_getregion()
call assert_equal(['abcdefghijk«'],
\ getregion(getpos("'a"), getpos("'b"),
\ {'type': 'V', 'exclusive': 1 }))
- :set selection&
+
+ set selection&
+ bwipe!
END
call v9.CheckLegacyAndVim9Success(lines)
- bwipe!
-
let lines =<< trim END
#" Exclusive selection
new
@@ -1891,51 +2215,346 @@ func Test_visual_getregion()
call assert_equal(["c", "x\tz"],
\ getregion(getpos('v'), getpos('.'), {'type': 'v' }))
set selection&
+ bwipe!
#" Exclusive selection 2
new
call setline(1, ["a\tc", "x\tz", '', ''])
+
call cursor(1, 1)
call feedkeys("\<Esc>v2l", 'xt')
call assert_equal(["a\t"],
\ getregion(getpos('v'), getpos('.'), {'exclusive': v:true }))
+ call assert_equal([
+ \ [[bufnr('%'), 1, 1, 0], [bufnr('%'), 1, 2, 0]],
+ \ ],
+ \ getregionpos(getpos('v'), getpos('.'), {'exclusive': v:true }))
+
call cursor(1, 1)
call feedkeys("\<Esc>v$G", 'xt')
call assert_equal(["a\tc", "x\tz", ''],
\ getregion(getpos('v'), getpos('.'), {'exclusive': v:true }))
+ call assert_equal([
+ \ [[bufnr('%'), 1, 1, 0], [bufnr('%'), 1, 3, 0]],
+ \ [[bufnr('%'), 2, 1, 0], [bufnr('%'), 2, 3, 0]],
+ \ [[bufnr('%'), 3, 0, 0], [bufnr('%'), 3, 0, 0]],
+ \ ],
+ \ getregionpos(getpos('v'), getpos('.'), {'exclusive': v:true }))
+
call cursor(1, 1)
call feedkeys("\<Esc>v$j", 'xt')
call assert_equal(["a\tc", "x\tz"],
\ getregion(getpos('v'), getpos('.'), {'exclusive': v:true }))
+ call assert_equal([
+ \ [[bufnr('%'), 1, 1, 0], [bufnr('%'), 1, 3, 0]],
+ \ [[bufnr('%'), 2, 1, 0], [bufnr('%'), 2, 3, 0]],
+ \ ],
+ \ getregionpos(getpos('v'), getpos('.'), {'exclusive': v:true }))
+
call cursor(1, 1)
call feedkeys("\<Esc>\<C-v>$j", 'xt')
call assert_equal(["a\tc", "x\tz"],
\ getregion(getpos('v'), getpos('.'),
\ {'exclusive': v:true, 'type': "\<C-v>" }))
+ call assert_equal([
+ \ [[bufnr('%'), 1, 1, 0], [bufnr('%'), 1, 3, 0]],
+ \ [[bufnr('%'), 2, 1, 0], [bufnr('%'), 2, 3, 0]],
+ \ ],
+ \ getregionpos(getpos('v'), getpos('.'),
+ \ {'exclusive': v:true, 'type': "\<C-v>" }))
+
call cursor(1, 1)
call feedkeys("\<Esc>\<C-v>$G", 'xt')
call assert_equal(["a", "x", '', ''],
\ getregion(getpos('v'), getpos('.'),
\ {'exclusive': v:true, 'type': "\<C-v>" }))
+ call assert_equal([
+ \ [[bufnr('%'), 1, 1, 0], [bufnr('%'), 1, 1, 0]],
+ \ [[bufnr('%'), 2, 1, 0], [bufnr('%'), 2, 1, 0]],
+ \ [[bufnr('%'), 3, 0, 0], [bufnr('%'), 3, 0, 0]],
+ \ [[bufnr('%'), 4, 0, 0], [bufnr('%'), 4, 0, 0]],
+ \ ],
+ \ getregionpos(getpos('v'), getpos('.'),
+ \ {'exclusive': v:true, 'type': "\<C-v>" }))
+
call cursor(1, 1)
call feedkeys("\<Esc>wv2j", 'xt')
call assert_equal(["c", "x\tz"],
\ getregion(getpos('v'), getpos('.'), {'exclusive': v:true }))
+ call assert_equal([
+ \ [[bufnr('%'), 1, 3, 0], [bufnr('%'), 1, 3, 0]],
+ \ [[bufnr('%'), 2, 1, 0], [bufnr('%'), 2, 3, 0]],
+ \ ],
+ \ getregionpos(getpos('v'), getpos('.'), {'exclusive': v:true }))
- #" virtualedit
+ #" 'virtualedit' with exclusive selection
set selection=exclusive
set virtualedit=all
+
+ call cursor(1, 1)
+ call feedkeys("\<Esc>vj", 'xt')
+ call assert_equal(["a\tc"],
+ \ getregion(getpos('v'), getpos('.'), {'type': 'v' }))
+ call assert_equal([
+ \ [[bufnr('%'), 1, 1, 0], [bufnr('%'), 1, 3, 0]],
+ \ ],
+ \ getregionpos(getpos('v'), getpos('.'), {'type': 'v' }))
+
call cursor(1, 1)
- call feedkeys("\<Esc>2lv2lj", 'xt')
+ call feedkeys("\<Esc>v8l", 'xt')
+ call assert_equal(["a\t"],
+ \ getregion(getpos('v'), getpos('.'), {'type': 'v' }))
+ call assert_equal([
+ \ [[bufnr('%'), 1, 1, 0], [bufnr('%'), 1, 2, 0]],
+ \ ],
+ \ getregionpos(getpos('v'), getpos('.'), {'type': 'v' }))
+
+ call cursor(1, 1)
+ call feedkeys("\<Esc>v6l", 'xt')
+ call assert_equal(['a '],
+ \ getregion(getpos('v'), getpos('.'), {'type': 'v' }))
+ call assert_equal([
+ \ [[bufnr('%'), 1, 1, 0], [bufnr('%'), 1, 2, 5]],
+ \ ],
+ \ getregionpos(getpos('v'), getpos('.'), {'type': 'v' }))
+
+ call cursor(1, 1)
+ call feedkeys("\<Esc>6lv2l", 'xt')
+ call assert_equal([' '],
+ \ getregion(getpos('v'), getpos('.'), {'type': 'v' }))
+ call assert_equal([
+ \ [[bufnr('%'), 1, 2, 5], [bufnr('%'), 1, 2, 0]],
+ \ ],
+ \ getregionpos(getpos('v'), getpos('.'), {'type': 'v' }))
+
+ call cursor(1, 1)
+ call feedkeys("\<Esc>lv2l", 'xt')
+ call assert_equal([' '],
+ \ getregion(getpos('v'), getpos('.'), {'type': 'v' }))
+ call assert_equal([
+ \ [[bufnr('%'), 1, 2, 0], [bufnr('%'), 1, 2, 2]],
+ \ ],
+ \ getregionpos(getpos('v'), getpos('.'), {'type': 'v' }))
+
+ call cursor(1, 1)
+ call feedkeys("\<Esc>2lv2l", 'xt')
+ call assert_equal([' '],
+ \ getregion(getpos('v'), getpos('.'), {'type': 'v' }))
+ call assert_equal([
+ \ [[bufnr('%'), 1, 2, 1], [bufnr('%'), 1, 2, 3]],
+ \ ],
+ \ getregionpos(getpos('v'), getpos('.'), {'type': 'v' }))
+
+ call feedkeys('j', 'xt')
call assert_equal([' c', 'x '],
\ getregion(getpos('v'), getpos('.'), {'type': 'v' }))
+ call assert_equal([
+ \ [[bufnr('%'), 1, 2, 1], [bufnr('%'), 1, 3, 0]],
+ \ [[bufnr('%'), 2, 1, 0], [bufnr('%'), 2, 2, 3]],
+ \ ],
+ \ getregionpos(getpos('v'), getpos('.'), {'type': 'v' }))
+
+ call cursor(1, 1)
+ call feedkeys("\<Esc>6l\<C-v>2lj", 'xt')
+ call assert_equal([' ', ' '],
+ \ getregion(getpos('v'), getpos('.'), {'type': "\<C-v>" }))
+ call assert_equal([
+ \ [[bufnr('%'), 1, 2, 5], [bufnr('%'), 1, 2, 7]],
+ \ [[bufnr('%'), 2, 2, 5], [bufnr('%'), 2, 2, 7]],
+ \ ],
+ \ getregionpos(getpos('v'), getpos('.'), {'type': "\<C-v>" }))
+
+ call cursor(1, 1)
+ call feedkeys("\<Esc>l\<C-v>2l2j", 'xt')
+ call assert_equal([' ', ' ', ' '],
+ \ getregion(getpos('v'), getpos('.'), {'type': "\<C-v>" }))
+ call assert_equal([
+ \ [[bufnr('%'), 1, 2, 0], [bufnr('%'), 1, 2, 2]],
+ \ [[bufnr('%'), 2, 2, 0], [bufnr('%'), 2, 2, 2]],
+ \ [[bufnr('%'), 3, 0, 0], [bufnr('%'), 3, 0, 0]],
+ \ ],
+ \ getregionpos(getpos('v'), getpos('.'), {'type': "\<C-v>" }))
+ call assert_equal([
+ \ [[bufnr('%'), 1, 2, 0], [bufnr('%'), 1, 2, 2]],
+ \ [[bufnr('%'), 2, 2, 0], [bufnr('%'), 2, 2, 2]],
+ \ [[bufnr('%'), 3, 1, 1], [bufnr('%'), 3, 1, 3]],
+ \ ],
+ \ getregionpos(getpos('v'), getpos('.'),
+ \ {'type': "\<C-v>", "eol": v:true }))
+
call cursor(1, 1)
call feedkeys("\<Esc>2l\<C-v>2l2j", 'xt')
call assert_equal([' ', ' ', ' '],
\ getregion(getpos('v'), getpos('.'), {'type': "\<C-v>" }))
- set virtualedit&
+ call assert_equal([
+ \ [[bufnr('%'), 1, 2, 1], [bufnr('%'), 1, 2, 3]],
+ \ [[bufnr('%'), 2, 2, 1], [bufnr('%'), 2, 2, 3]],
+ \ [[bufnr('%'), 3, 0, 0], [bufnr('%'), 3, 0, 0]],
+ \ ],
+ \ getregionpos(getpos('v'), getpos('.'), {'type': "\<C-v>" }))
+ call assert_equal([
+ \ [[bufnr('%'), 1, 2, 1], [bufnr('%'), 1, 2, 3]],
+ \ [[bufnr('%'), 2, 2, 1], [bufnr('%'), 2, 2, 3]],
+ \ [[bufnr('%'), 3, 1, 2], [bufnr('%'), 3, 1, 4]],
+ \ ],
+ \ getregionpos(getpos('v'), getpos('.'),
+ \ {'type': "\<C-v>", "eol": v:true }))
+
+ #" 'virtualedit' with inclusive selection
set selection&
+ call cursor(1, 1)
+ call feedkeys("\<Esc>vj", 'xt')
+ call assert_equal(["a\tc", 'x'],
+ \ getregion(getpos('v'), getpos('.'), {'type': 'v' }))
+ call assert_equal([
+ \ [[bufnr('%'), 1, 1, 0], [bufnr('%'), 1, 3, 0]],
+ \ [[bufnr('%'), 2, 1, 0], [bufnr('%'), 2, 1, 0]],
+ \ ],
+ \ getregionpos(getpos('v'), getpos('.'), {'type': 'v' }))
+
+ call cursor(1, 1)
+ call feedkeys("\<Esc>v8l", 'xt')
+ call assert_equal(["a\tc"],
+ \ getregion(getpos('v'), getpos('.'), {'type': 'v' }))
+ call assert_equal([
+ \ [[bufnr('%'), 1, 1, 0], [bufnr('%'), 1, 3, 0]],
+ \ ],
+ \ getregionpos(getpos('v'), getpos('.'), {'type': 'v' }))
+
+ call cursor(1, 1)
+ call feedkeys("\<Esc>v6l", 'xt')
+ call assert_equal(['a '],
+ \ getregion(getpos('v'), getpos('.'), {'type': 'v' }))
+ call assert_equal([
+ \ [[bufnr('%'), 1, 1, 0], [bufnr('%'), 1, 2, 6]],
+ \ ],
+ \ getregionpos(getpos('v'), getpos('.'), {'type': 'v' }))
+
+ call cursor(1, 1)
+ call feedkeys("\<Esc>6lv2l", 'xt')
+ call assert_equal([' c'],
+ \ getregion(getpos('v'), getpos('.'), {'type': 'v' }))
+ call assert_equal([
+ \ [[bufnr('%'), 1, 2, 5], [bufnr('%'), 1, 3, 0]],
+ \ ],
+ \ getregionpos(getpos('v'), getpos('.'), {'type': 'v' }))
+
+ call cursor(1, 1)
+ call feedkeys("\<Esc>lv2l", 'xt')
+ call assert_equal([' '],
+ \ getregion(getpos('v'), getpos('.'), {'type': 'v' }))
+ call assert_equal([
+ \ [[bufnr('%'), 1, 2, 0], [bufnr('%'), 1, 2, 3]],
+ \ ],
+ \ getregionpos(getpos('v'), getpos('.'), {'type': 'v' }))
+
+ call cursor(1, 1)
+ call feedkeys("\<Esc>2lv2l", 'xt')
+ call assert_equal([' '],
+ \ getregion(getpos('v'), getpos('.'), {'type': 'v' }))
+ call assert_equal([
+ \ [[bufnr('%'), 1, 2, 1], [bufnr('%'), 1, 2, 4]],
+ \ ],
+ \ getregionpos(getpos('v'), getpos('.'), {'type': 'v' }))
+
+ call feedkeys('j', 'xt')
+ call assert_equal([' c', 'x '],
+ \ getregion(getpos('v'), getpos('.'), {'type': 'v' }))
+ call assert_equal([
+ \ [[bufnr('%'), 1, 2, 1], [bufnr('%'), 1, 3, 0]],
+ \ [[bufnr('%'), 2, 1, 0], [bufnr('%'), 2, 2, 4]],
+ \ ],
+ \ getregionpos(getpos('v'), getpos('.'), {'type': 'v' }))
+
+ call cursor(1, 1)
+ call feedkeys("\<Esc>6l\<C-v>2lj", 'xt')
+ call assert_equal([' c', ' z'],
+ \ getregion(getpos('v'), getpos('.'), {'type': "\<C-v>" }))
+ call assert_equal([
+ \ [[bufnr('%'), 1, 2, 5], [bufnr('%'), 1, 3, 0]],
+ \ [[bufnr('%'), 2, 2, 5], [bufnr('%'), 2, 3, 0]],
+ \ ],
+ \ getregionpos(getpos('v'), getpos('.'), {'type': "\<C-v>" }))
+
+ call cursor(1, 1)
+ call feedkeys("\<Esc>l\<C-v>2l2j", 'xt')
+ call assert_equal([' ', ' ', ' '],
+ \ getregion(getpos('v'), getpos('.'), {'type': "\<C-v>" }))
+ call assert_equal([
+ \ [[bufnr('%'), 1, 2, 0], [bufnr('%'), 1, 2, 3]],
+ \ [[bufnr('%'), 2, 2, 0], [bufnr('%'), 2, 2, 3]],
+ \ [[bufnr('%'), 3, 0, 0], [bufnr('%'), 3, 0, 0]],
+ \ ],
+ \ getregionpos(getpos('v'), getpos('.'), {'type': "\<C-v>" }))
+ call assert_equal([
+ \ [[bufnr('%'), 1, 2, 0], [bufnr('%'), 1, 2, 3]],
+ \ [[bufnr('%'), 2, 2, 0], [bufnr('%'), 2, 2, 3]],
+ \ [[bufnr('%'), 3, 1, 1], [bufnr('%'), 3, 1, 4]],
+ \ ],
+ \ getregionpos(getpos('v'), getpos('.'),
+ \ {'type': "\<C-v>", "eol": v:true }))
+
+ call cursor(1, 1)
+ call feedkeys("\<Esc>2l\<C-v>2l2j", 'xt')
+ call assert_equal([' ', ' ', ' '],
+ \ getregion(getpos('v'), getpos('.'), {'type': "\<C-v>" }))
+ call assert_equal([
+ \ [[bufnr('%'), 1, 2, 1], [bufnr('%'), 1, 2, 4]],
+ \ [[bufnr('%'), 2, 2, 1], [bufnr('%'), 2, 2, 4]],
+ \ [[bufnr('%'), 3, 0, 0], [bufnr('%'), 3, 0, 0]],
+ \ ],
+ \ getregionpos(getpos('v'), getpos('.'), {'type': "\<C-v>" }))
+ call assert_equal([
+ \ [[bufnr('%'), 1, 2, 1], [bufnr('%'), 1, 2, 4]],
+ \ [[bufnr('%'), 2, 2, 1], [bufnr('%'), 2, 2, 4]],
+ \ [[bufnr('%'), 3, 1, 2], [bufnr('%'), 3, 1, 5]],
+ \ ],
+ \ getregionpos(getpos('v'), getpos('.'),
+ \ {'type': "\<C-v>", "eol": v:true }))
+
+ set virtualedit&
+ bwipe!
+ END
+ call v9.CheckLegacyAndVim9Success(lines)
+
+ let lines =<< trim END
+ #" 'virtualedit' with TABs at end of line
+ new
+ set virtualedit=all
+ call setline(1, ["\t", "a\t", "aa\t"])
+
+ call feedkeys("gg06l\<C-v>3l2j", 'xt')
+ call assert_equal([' ', ' ', ' '],
+ \ getregion(getpos('v'), getpos('.'), {'type': "\<C-v>" }))
+ call assert_equal([
+ \ [[bufnr('%'), 1, 1, 6], [bufnr('%'), 1, 1, 0]],
+ \ [[bufnr('%'), 2, 2, 5], [bufnr('%'), 2, 2, 0]],
+ \ [[bufnr('%'), 3, 3, 4], [bufnr('%'), 3, 3, 0]],
+ \ ],
+ \ getregionpos(getpos('v'), getpos('.'), {'type': "\<C-v>" }))
+ call assert_equal([
+ \ [[bufnr('%'), 1, 1, 6], [bufnr('%'), 1, 2, 2]],
+ \ [[bufnr('%'), 2, 2, 5], [bufnr('%'), 2, 3, 2]],
+ \ [[bufnr('%'), 3, 3, 4], [bufnr('%'), 3, 4, 2]],
+ \ ],
+ \ getregionpos(getpos('v'), getpos('.'),
+ \ {'type': "\<C-v>", "eol": v:true }))
+
+ call feedkeys("gg06lv3l", 'xt')
+ call assert_equal([' '],
+ \ getregion(getpos('v'), getpos('.'), {'type': 'v' }))
+ call assert_equal([
+ \ [[bufnr('%'), 1, 1, 6], [bufnr('%'), 1, 1, 0]],
+ \ ],
+ \ getregionpos(getpos('v'), getpos('.'), {'type': 'v' }))
+ call assert_equal([
+ \ [[bufnr('%'), 1, 1, 6], [bufnr('%'), 1, 2, 2]],
+ \ ],
+ \ getregionpos(getpos('v'), getpos('.'),
+ \ {'type': 'v', "eol": v:true }))
+
+ set virtualedit&
bwipe!
END
call v9.CheckLegacyAndVim9Success(lines)
@@ -1955,4 +2574,144 @@ func Test_getregion_invalid_buf()
bwipe!
endfunc
+func Test_getregion_after_yank()
+ func! Check_Results(type)
+ call assert_equal(g:expected_region,
+ \ getregion(getpos("'["), getpos("']"), #{ type: a:type }))
+ call assert_equal(g:expected_regionpos,
+ \ getregionpos(getpos("'["), getpos("']"), #{ type: a:type }))
+ call assert_equal(g:expected_region,
+ \ getregion(getpos("']"), getpos("'["), #{ type: a:type }))
+ call assert_equal(g:expected_regionpos,
+ \ getregionpos(getpos("']"), getpos("'["), #{ type: a:type }))
+ let g:checked = 1
+ endfunc
+
+ autocmd TextYankPost *
+ \ : if v:event.operator ==? 'y'
+ \ | call Check_Results(v:event.regtype)
+ \ | endif
+
+ new
+ call setline(1, ['abcd', 'efghijk', 'lmn'])
+
+ let g:expected_region = ['abcd']
+ let g:expected_regionpos = [
+ \ [[bufnr('%'), 1, 1, 0], [bufnr('%'), 1, 4, 0]],
+ \ ]
+ let g:checked = 0
+ normal yy
+ call assert_equal(1, g:checked)
+ call Check_Results(getregtype('"'))
+
+ let g:expected_region = ['cd', 'ghijk', 'n']
+ let g:expected_regionpos = [
+ \ [[bufnr('%'), 1, 3, 0], [bufnr('%'), 1, 4, 0]],
+ \ [[bufnr('%'), 2, 3, 0], [bufnr('%'), 2, 7, 0]],
+ \ [[bufnr('%'), 3, 3, 0], [bufnr('%'), 3, 3, 0]],
+ \ ]
+ let g:checked = 0
+ call feedkeys("gg0ll\<C-V>jj$y", 'tx')
+ call assert_equal(1, g:checked)
+ call Check_Results(getregtype('"'))
+ call assert_equal(g:expected_region, getreg('"', v:true, v:true))
+
+ let g:expected_region = ['bc', 'fg', 'mn']
+ let g:expected_regionpos = [
+ \ [[bufnr('%'), 1, 2, 0], [bufnr('%'), 1, 3, 0]],
+ \ [[bufnr('%'), 2, 2, 0], [bufnr('%'), 2, 3, 0]],
+ \ [[bufnr('%'), 3, 2, 0], [bufnr('%'), 3, 3, 0]],
+ \ ]
+ let g:checked = 0
+ call feedkeys("gg0l\<C-V>jjly", 'tx')
+ call assert_equal(1, g:checked)
+ call Check_Results(getregtype('"'))
+ call assert_equal(g:expected_region, getreg('"', v:true, v:true))
+
+ bwipe!
+
+ new
+ let lines = ['asdfghjkl', '«口=口»', 'qwertyuiop', '口口=口口', 'zxcvbnm']
+ call setline(1, lines)
+
+ let g:expected_region = lines
+ let g:expected_regionpos = [
+ \ [[bufnr('%'), 1, 1, 0], [bufnr('%'), 1, 9, 0]],
+ \ [[bufnr('%'), 2, 1, 0], [bufnr('%'), 2, 11, 0]],
+ \ [[bufnr('%'), 3, 1, 0], [bufnr('%'), 3, 10, 0]],
+ \ [[bufnr('%'), 4, 1, 0], [bufnr('%'), 4, 13, 0]],
+ \ [[bufnr('%'), 5, 1, 0], [bufnr('%'), 5, 7, 0]],
+ \ ]
+ let g:checked = 0
+ call feedkeys('ggyG', 'tx')
+ call assert_equal(1, g:checked)
+ call Check_Results(getregtype('"'))
+ call assert_equal(g:expected_region, getreg('"', v:true, v:true))
+
+ let g:expected_region = ['=口»', 'qwertyuiop', '口口=口']
+ let g:expected_regionpos = [
+ \ [[bufnr('%'), 2, 6, 0], [bufnr('%'), 2, 11, 0]],
+ \ [[bufnr('%'), 3, 1, 0], [bufnr('%'), 3, 10, 0]],
+ \ [[bufnr('%'), 4, 1, 0], [bufnr('%'), 4, 10, 0]],
+ \ ]
+ let g:checked = 0
+ call feedkeys('2gg02lv2j2ly', 'tx')
+ call assert_equal(1, g:checked)
+ call Check_Results(getregtype('"'))
+ call assert_equal(g:expected_region, getreg('"', v:true, v:true))
+
+ let g:expected_region = ['asdf', '«口=', 'qwer', '口口', 'zxcv']
+ let g:expected_regionpos = [
+ \ [[bufnr('%'), 1, 1, 0], [bufnr('%'), 1, 4, 0]],
+ \ [[bufnr('%'), 2, 1, 0], [bufnr('%'), 2, 6, 0]],
+ \ [[bufnr('%'), 3, 1, 0], [bufnr('%'), 3, 4, 0]],
+ \ [[bufnr('%'), 4, 1, 0], [bufnr('%'), 4, 6, 0]],
+ \ [[bufnr('%'), 5, 1, 0], [bufnr('%'), 5, 4, 0]],
+ \ ]
+ let g:checked = 0
+ call feedkeys("G0\<C-V>3l4ky", 'tx')
+ call assert_equal(1, g:checked)
+ call Check_Results(getregtype('"'))
+ call assert_equal(g:expected_region, getreg('"', v:true, v:true))
+
+ let g:expected_region = ['ghjkl', '口»', 'tyuiop', '=口口', 'bnm']
+ let g:expected_regionpos = [
+ \ [[bufnr('%'), 1, 5, 0], [bufnr('%'), 1, 9, 0]],
+ \ [[bufnr('%'), 2, 7, 0], [bufnr('%'), 2, 11, 0]],
+ \ [[bufnr('%'), 3, 5, 0], [bufnr('%'), 3, 10, 0]],
+ \ [[bufnr('%'), 4, 7, 0], [bufnr('%'), 4, 13, 0]],
+ \ [[bufnr('%'), 5, 5, 0], [bufnr('%'), 5, 7, 0]],
+ \ ]
+ let g:checked = 0
+ call feedkeys("G04l\<C-V>$4ky", 'tx')
+ call assert_equal(1, g:checked)
+ call Check_Results(getregtype('"'))
+ call assert_equal(g:expected_region, getreg('"', v:true, v:true))
+
+ bwipe!
+
+ unlet g:expected_region
+ unlet g:expected_regionpos
+ unlet g:checked
+ autocmd! TextYankPost
+ delfunc Check_Results
+endfunc
+
+func Test_visual_block_cursor_delete()
+ new
+ call setline(1, 'ab')
+ exe ":norm! $\<c-v>hI\<Del>\<ESC>"
+ call assert_equal(['b'], getline(1, 1))
+ bwipe!
+endfunc
+
+func Test_visual_block_cursor_insert_enter()
+ new
+ call setline(1, ['asdf asdf', 'asdf asdf', 'asdf asdf', 'asdf asdf'])
+ call cursor(1, 5)
+ exe ":norm! \<c-v>3jcw\<cr>"
+ call assert_equal(['asdfw', 'asdf', 'asdfasdf', 'asdfasdf', 'asdfasdf'], getline(1, '$'))
+ bwipe!
+endfunc
+
" vim: shiftwidth=2 sts=2 expandtab
diff --git a/src/testdir/test_xdg.vim b/src/testdir/test_xdg.vim
index 6f35b72..b9ec3c7 100644
--- a/src/testdir/test_xdg.vim
+++ b/src/testdir/test_xdg.vim
@@ -80,6 +80,7 @@ func Test_xdg_runtime_files()
call assert_match('XfakeHOME/\.vimrc', $MYVIMRC)
call filter(g:, {idx, _ -> idx =~ '^rc'})
call assert_equal(#{rc_one: 'one', rc: '.vimrc'}, g:)
+ call assert_match('XfakeHOME/\.vim/view', &viewdir)
call writefile(v:errors, 'Xresult')
quit
END
@@ -94,6 +95,7 @@ func Test_xdg_runtime_files()
call assert_match('XfakeHOME/\.vim/vimrc', $MYVIMRC)
call filter(g:, {idx, _ -> idx =~ '^rc'})
call assert_equal(#{rc_two: 'two', rc: '.vim/vimrc'}, g:)
+ call assert_match('XfakeHOME/\.vim/view', &viewdir)
call writefile(v:errors, 'Xresult')
quit
END
@@ -112,6 +114,7 @@ func Test_xdg_runtime_files()
call assert_match('XfakeHOME/\.config/vim/vimrc', $MYVIMRC, msg)
call filter(g:, {idx, _ -> idx =~ '^rc'})
call assert_equal(#{rc_three: 'three', rc: '.config/vim/vimrc'}, g:)
+ call assert_match('XfakeHOME/\.config/vim/view', &viewdir)
call writefile(v:errors, 'Xresult')
quit
END
@@ -128,6 +131,7 @@ func Test_xdg_runtime_files()
call assert_match('XfakeHOME/xdg/vim/vimrc', $MYVIMRC, msg)
call filter(g:, {idx, _ -> idx =~ '^rc'})
call assert_equal(#{rc_four: 'four', rc: 'xdg/vim/vimrc'}, g:)
+ call assert_match('XfakeHOME/xdg/vim/view, &viewdir)
call writefile(v:errors, 'Xresult')
quit
END
diff --git a/src/testdir/test_xxd.vim b/src/testdir/test_xxd.vim
index 7a2771e..a91a1fc 100644
--- a/src/testdir/test_xxd.vim
+++ b/src/testdir/test_xxd.vim
@@ -411,6 +411,22 @@ func Test_xxd_max_cols()
endfor
endfunc
+
+" This used to trigger a buffer overflow (#14738)
+func Test_xxd_buffer_overflow()
+ CheckUnix
+ if system('file ' .. s:xxd_cmd) =~ '32-bit'
+ throw 'Skipped: test only works on 64-bit architecture'
+ endif
+ new
+ let input = repeat('A', 256)
+ call writefile(['-9223372036854775808: ' . repeat("\e[1;32m41\e[0m ", 256) . ' ' . repeat("\e[1;32mA\e[0m", 256)], 'Xxdexpected', 'D')
+ exe 'r! printf ' . input . '| ' . s:xxd_cmd . ' -Ralways -g1 -c256 -d -o 9223372036854775808 > Xxdout'
+ call assert_equalfile('Xxdexpected', 'Xxdout')
+ call delete('Xxdout')
+ bwipe!
+endfunc
+
" -c0 selects the format specific default column value, as if no -c was given
" except for -ps, where it disables extra newlines
func Test_xxd_c0_is_def_cols()