diff options
-rw-r--r-- | runtime/autoload/vimexpect.vim | 2 | ||||
-rw-r--r-- | runtime/doc/eval.txt | 2 | ||||
-rw-r--r-- | runtime/pack/dist/opt/termdebug/plugin/termdebug.vim | 19 | ||||
-rw-r--r-- | src/nvim/cursor.c | 3 | ||||
-rw-r--r-- | src/nvim/edit.c | 21 | ||||
-rw-r--r-- | src/nvim/eval/funcs.c | 3 | ||||
-rw-r--r-- | src/nvim/memline.c | 1 | ||||
-rw-r--r-- | src/nvim/ops.c | 5 | ||||
-rw-r--r-- | src/nvim/spellfile.c | 3 | ||||
-rw-r--r-- | src/nvim/tag.c | 1 | ||||
-rw-r--r-- | src/nvim/testdir/test_cmdline.vim | 15 | ||||
-rw-r--r-- | src/nvim/testdir/test_excmd.vim | 36 | ||||
-rw-r--r-- | src/nvim/testdir/test_ins_complete_no_halt.vim | 51 | ||||
-rw-r--r-- | src/nvim/testdir/test_number.vim | 11 | ||||
-rw-r--r-- | src/nvim/testdir/test_textformat.vim | 7 | ||||
-rw-r--r-- | src/nvim/testdir/test_writefile.vim | 8 | ||||
-rw-r--r-- | src/nvim/viml/parser/expressions.c | 2 | ||||
-rw-r--r-- | src/nvim/window.c | 77 | ||||
-rw-r--r-- | test/functional/api/vim_spec.lua | 2 | ||||
-rw-r--r-- | test/functional/autocmd/focus_spec.lua (renamed from test/functional/autoread/focus_spec.lua) | 0 | ||||
-rw-r--r-- | test/functional/cmdline/ctrl_r_spec.lua | 34 | ||||
-rw-r--r-- | test/functional/editor/K_spec.lua (renamed from test/functional/normal/K_spec.lua) | 0 | ||||
-rw-r--r-- | test/functional/editor/completion_spec.lua (renamed from test/functional/viml/completion_spec.lua) | 0 | ||||
-rw-r--r-- | test/functional/editor/count_spec.lua (renamed from test/functional/normal/count_spec.lua) | 0 | ||||
-rw-r--r-- | test/functional/editor/fold_spec.lua (renamed from test/functional/normal/fold_spec.lua) | 0 | ||||
-rw-r--r-- | test/functional/editor/jump_spec.lua (renamed from test/functional/normal/jump_spec.lua) | 0 | ||||
-rw-r--r-- | test/functional/editor/lang_spec.lua (renamed from test/functional/normal/lang_spec.lua) | 0 | ||||
-rw-r--r-- | test/functional/editor/langmap_spec.lua (renamed from test/functional/normal/langmap_spec.lua) | 0 | ||||
-rw-r--r-- | test/functional/editor/macro_spec.lua (renamed from test/functional/normal/macro_spec.lua) | 0 | ||||
-rw-r--r-- | test/functional/editor/meta_key_spec.lua (renamed from test/functional/insert/insert_spec.lua) | 38 | ||||
-rw-r--r-- | test/functional/editor/mode_cmdline_spec.lua (renamed from test/functional/cmdline/history_spec.lua) | 39 | ||||
-rw-r--r-- | test/functional/editor/mode_insert_spec.lua | 89 | ||||
-rw-r--r-- | test/functional/editor/mode_visual_spec.lua (renamed from test/functional/visual/ctrl_o_spec.lua) | 7 | ||||
-rw-r--r-- | test/functional/editor/put_spec.lua (renamed from test/functional/normal/put_spec.lua) | 0 | ||||
-rw-r--r-- | test/functional/editor/search_spec.lua (renamed from test/functional/normal/search_spec.lua) | 0 | ||||
-rw-r--r-- | test/functional/editor/tabpage_spec.lua (renamed from test/functional/normal/tabpage_spec.lua) | 0 | ||||
-rw-r--r-- | test/functional/editor/undo_spec.lua (renamed from test/functional/normal/undo_spec.lua) | 0 | ||||
-rw-r--r-- | test/functional/eval/backtick_expansion_spec.lua | 50 | ||||
-rw-r--r-- | test/functional/eval/function_spec.lua | 37 | ||||
-rw-r--r-- | test/functional/eval/interrupt_spec.lua | 61 | ||||
-rw-r--r-- | test/functional/insert/ctrl_o_spec.lua | 54 | ||||
-rw-r--r-- | test/functional/insert/ctrl_r_spec.lua | 19 | ||||
-rw-r--r-- | test/functional/normal/meta_key_spec.lua | 22 | ||||
-rw-r--r-- | test/functional/viml/function_spec.lua | 216 | ||||
-rw-r--r-- | test/functional/vimscript/api_functions_spec.lua (renamed from test/functional/eval/api_functions_spec.lua) | 0 | ||||
-rw-r--r-- | test/functional/vimscript/buf_functions_spec.lua (renamed from test/functional/eval/buf_functions_spec.lua) | 0 | ||||
-rw-r--r-- | test/functional/vimscript/changedtick_spec.lua (renamed from test/functional/eval/changedtick_spec.lua) | 0 | ||||
-rw-r--r-- | test/functional/vimscript/container_functions_spec.lua (renamed from test/functional/eval/container_functions_spec.lua) | 0 | ||||
-rw-r--r-- | test/functional/vimscript/ctx_functions_spec.lua (renamed from test/functional/eval/ctx_functions_spec.lua) | 0 | ||||
-rw-r--r-- | test/functional/vimscript/environ_spec.lua (renamed from test/functional/eval/environ_spec.lua) | 0 | ||||
-rw-r--r-- | test/functional/vimscript/errorlist_spec.lua (renamed from test/functional/viml/errorlist_spec.lua) | 0 | ||||
-rw-r--r-- | test/functional/vimscript/eval_spec.lua | 146 | ||||
-rw-r--r-- | test/functional/vimscript/executable_spec.lua (renamed from test/functional/eval/executable_spec.lua) | 0 | ||||
-rw-r--r-- | test/functional/vimscript/execute_spec.lua (renamed from test/functional/eval/execute_spec.lua) | 0 | ||||
-rw-r--r-- | test/functional/vimscript/exepath_spec.lua (renamed from test/functional/eval/exepath_spec.lua) | 0 | ||||
-rw-r--r-- | test/functional/vimscript/fnamemodify_spec.lua (renamed from test/functional/eval/fnamemodify_spec.lua) | 0 | ||||
-rw-r--r-- | test/functional/vimscript/functions_spec.lua | 20 | ||||
-rw-r--r-- | test/functional/vimscript/getline_spec.lua (renamed from test/functional/eval/getline_spec.lua) | 0 | ||||
-rw-r--r-- | test/functional/vimscript/glob_spec.lua (renamed from test/functional/eval/glob_spec.lua) | 0 | ||||
-rw-r--r-- | test/functional/vimscript/has_spec.lua (renamed from test/functional/eval/has_spec.lua) | 0 | ||||
-rw-r--r-- | test/functional/vimscript/hostname_spec.lua (renamed from test/functional/eval/hostname_spec.lua) | 0 | ||||
-rw-r--r-- | test/functional/vimscript/input_spec.lua (renamed from test/functional/eval/input_spec.lua) | 0 | ||||
-rw-r--r-- | test/functional/vimscript/json_functions_spec.lua (renamed from test/functional/eval/json_functions_spec.lua) | 0 | ||||
-rw-r--r-- | test/functional/vimscript/lang_spec.lua (renamed from test/functional/viml/lang_spec.lua) | 2 | ||||
-rw-r--r-- | test/functional/vimscript/let_spec.lua (renamed from test/functional/eval/let_spec.lua) | 0 | ||||
-rw-r--r-- | test/functional/vimscript/map_functions_spec.lua (renamed from test/functional/eval/map_functions_spec.lua) | 0 | ||||
-rw-r--r-- | test/functional/vimscript/match_functions_spec.lua (renamed from test/functional/eval/match_functions_spec.lua) | 0 | ||||
-rw-r--r-- | test/functional/vimscript/minmax_functions_spec.lua (renamed from test/functional/eval/minmax_functions_spec.lua) | 0 | ||||
-rw-r--r-- | test/functional/vimscript/modeline_spec.lua (renamed from test/functional/eval/modeline_spec.lua) | 0 | ||||
-rw-r--r-- | test/functional/vimscript/msgpack_functions_spec.lua (renamed from test/functional/eval/msgpack_functions_spec.lua) | 0 | ||||
-rw-r--r-- | test/functional/vimscript/null_spec.lua (renamed from test/functional/eval/null_spec.lua) | 0 | ||||
-rw-r--r-- | test/functional/vimscript/operators_spec.lua (renamed from test/functional/eval/operators_spec.lua) | 0 | ||||
-rw-r--r-- | test/functional/vimscript/printf_spec.lua (renamed from test/functional/eval/printf_spec.lua) | 0 | ||||
-rw-r--r-- | test/functional/vimscript/reltime_spec.lua (renamed from test/functional/eval/reltime_spec.lua) | 0 | ||||
-rw-r--r-- | test/functional/vimscript/server_spec.lua (renamed from test/functional/eval/server_spec.lua) | 0 | ||||
-rw-r--r-- | test/functional/vimscript/setpos_spec.lua (renamed from test/functional/eval/setpos_spec.lua) | 0 | ||||
-rw-r--r-- | test/functional/vimscript/sort_spec.lua (renamed from test/functional/eval/sort_spec.lua) | 0 | ||||
-rw-r--r-- | test/functional/vimscript/special_vars_spec.lua (renamed from test/functional/eval/special_vars_spec.lua) | 0 | ||||
-rw-r--r-- | test/functional/vimscript/string_spec.lua (renamed from test/functional/eval/string_spec.lua) | 0 | ||||
-rw-r--r-- | test/functional/vimscript/system_spec.lua (renamed from test/functional/eval/system_spec.lua) | 0 | ||||
-rw-r--r-- | test/functional/vimscript/timer_spec.lua (renamed from test/functional/eval/timer_spec.lua) | 0 | ||||
-rw-r--r-- | test/functional/vimscript/uniq_spec.lua (renamed from test/functional/eval/uniq_spec.lua) | 0 | ||||
-rw-r--r-- | test/functional/vimscript/vvar_event_spec.lua (renamed from test/functional/eval/vvar_event_spec.lua) | 0 | ||||
-rw-r--r-- | test/functional/vimscript/wait_spec.lua (renamed from test/functional/eval/wait_spec.lua) | 0 | ||||
-rw-r--r-- | test/functional/vimscript/writefile_spec.lua (renamed from test/functional/eval/writefile_spec.lua) | 0 | ||||
-rw-r--r-- | test/functional/visual/meta_key_spec.lua | 22 |
86 files changed, 537 insertions, 588 deletions
diff --git a/runtime/autoload/vimexpect.vim b/runtime/autoload/vimexpect.vim index 0ed888d2a4..04c742b894 100644 --- a/runtime/autoload/vimexpect.vim +++ b/runtime/autoload/vimexpect.vim @@ -39,7 +39,7 @@ let s:Parser.LINE_BUFFER_MAX_LEN = 100 " Create a new Parser instance with the initial state and a target. The target " is a dictionary that will be the `self` of every State method call associated " with the parser, and may contain options normally passed to -" `jobstart`(on_stdout/on_stderr will be overriden). Returns the target so it +" `jobstart`(on_stdout/on_stderr will be overridden). Returns the target so it " can be called directly as the second argument of `jobstart`: " " call jobstart(prog_argv, vimexpect#Parser(initial_state, {'pty': 1})) diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index 99e48e602b..d29451f5c3 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -12495,7 +12495,7 @@ Command-line expressions highlighting *expr-highlight* Expressions entered by the user in |i_CTRL-R_=|, |c_CTRL-\_e|, |quote=| are highlighted by the built-in expressions parser. It uses highlight groups -described in the table below, which may be overriden by colorschemes. +described in the table below, which may be overridden by colorschemes. *hl-NvimInvalid* Besides the "Nvim"-prefixed highlight groups described below, there are "NvimInvalid"-prefixed highlight groups which have the same meaning but diff --git a/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim b/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim index 94b97c9f0c..8057d7f284 100644 --- a/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim +++ b/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim @@ -826,7 +826,14 @@ func s:InstallCommands() command Winbar call s:InstallWinbar() if !exists('g:termdebug_map_K') || g:termdebug_map_K - let s:k_map_saved = maparg('K', 'n', 0, 1) + " let s:k_map_saved = maparg('K', 'n', 0, 1) + let s:k_map_saved = {} + for map in nvim_get_keymap('n') + if map.lhs ==# 'K' + let s:k_map_saved = map + break + endif + endfor nnoremap K :Evaluate<CR> endif @@ -870,7 +877,15 @@ func s:DeleteCommands() if empty(s:k_map_saved) nunmap K else - call mapset('n', 0, s:k_map_saved) + " call mapset('n', 0, s:k_map_saved) + let mode = s:k_map_saved.mode !=# ' ' ? s:k_map_saved.mode : '' + call nvim_set_keymap(mode, 'K', s:k_map_saved.rhs, { + \ 'expr': s:k_map_saved.expr ? v:true : v:false, + \ 'noremap': s:k_map_saved.noremap ? v:true : v:false, + \ 'nowait': s:k_map_saved.nowait ? v:true : v:false, + \ 'script': s:k_map_saved.script ? v:true : v:false, + \ 'silent': s:k_map_saved.silent ? v:true : v:false, + \ }) endif unlet s:k_map_saved endif diff --git a/src/nvim/cursor.c b/src/nvim/cursor.c index d4a68adeda..21f23b7fd4 100644 --- a/src/nvim/cursor.c +++ b/src/nvim/cursor.c @@ -130,7 +130,8 @@ static int coladvance2( if (finetune && curwin->w_p_wrap && curwin->w_width_inner != 0 - && wcol >= (colnr_T)width) { + && wcol >= (colnr_T)width + && width > 0) { csize = linetabsize(line); if (csize > 0) csize--; diff --git a/src/nvim/edit.c b/src/nvim/edit.c index 3c4bf504cf..aeab1cdad4 100644 --- a/src/nvim/edit.c +++ b/src/nvim/edit.c @@ -4127,6 +4127,7 @@ static int ins_compl_get_exp(pos_T *ini) char_u *dict = NULL; int dict_f = 0; bool set_match_pos; + pos_T prev_pos = { 0, 0, 0 }; int l_ctrl_x_mode = ctrl_x_mode; assert(curbuf != NULL); @@ -4365,6 +4366,7 @@ static int ins_compl_get_exp(pos_T *ini) } else if (*e_cpt == '.') { p_ws = true; } + bool looped_around = false; for (;; ) { bool cont_s_ipos = false; @@ -4393,7 +4395,26 @@ static int ins_compl_get_exp(pos_T *ini) } else if (first_match_pos.lnum == last_match_pos.lnum && first_match_pos.col == last_match_pos.col) { found_new_match = FAIL; + } else if ((compl_direction == FORWARD) + && (prev_pos.lnum > pos->lnum + || (prev_pos.lnum == pos->lnum + && prev_pos.col >= pos->col))) { + if (looped_around) { + found_new_match = FAIL; + } else { + looped_around = true; + } + } else if ((compl_direction != FORWARD) + && (prev_pos.lnum < pos->lnum + || (prev_pos.lnum == pos->lnum + && prev_pos.col <= pos->col))) { + if (looped_around) { + found_new_match = FAIL; + } else { + looped_around = true; + } } + prev_pos = *pos; if (found_new_match == FAIL) { if (ins_buf == curbuf) { found_all = true; diff --git a/src/nvim/eval/funcs.c b/src/nvim/eval/funcs.c index bcbd2266d3..821a2c8e8e 100644 --- a/src/nvim/eval/funcs.c +++ b/src/nvim/eval/funcs.c @@ -120,7 +120,8 @@ char_u *get_function_name(expand_T *xp, int idx) if (intidx < 0) { name = get_user_func_name(xp, idx); if (name != NULL) { - if (*name != '<' && STRNCMP("g:", xp->xp_pattern, 2) == 0) { + if (*name != NUL && *name != '<' + && STRNCMP("g:", xp->xp_pattern, 2) == 0) { return cat_prefix_varname('g', name); } return name; diff --git a/src/nvim/memline.c b/src/nvim/memline.c index f1774a20cf..4ccbb31e2c 100644 --- a/src/nvim/memline.c +++ b/src/nvim/memline.c @@ -264,6 +264,7 @@ int ml_open(buf_T *buf) buf->b_ml.ml_line_lnum = 0; // no cached line buf->b_ml.ml_line_offset = 0; buf->b_ml.ml_chunksize = NULL; + buf->b_ml.ml_usedchunks = 0; if (cmdmod.noswapfile) { buf->b_p_swf = false; diff --git a/src/nvim/ops.c b/src/nvim/ops.c index 10a099eb47..e344bb5e77 100644 --- a/src/nvim/ops.c +++ b/src/nvim/ops.c @@ -1725,7 +1725,9 @@ int op_delete(oparg_T *oap) (int)oap->line_count-1, n, deleted_bytes, 0, 0, 0, kExtmarkUndo); } - auto_format(false, true); + if (oap->op_type == OP_DELETE) { + auto_format(false, true); + } } msgmore(curbuf->b_ml.ml_line_count - old_lcount); @@ -2486,6 +2488,7 @@ int op_change(oparg_T *oap) xfree(ins_text); } } + auto_format(false, true); return retval; } diff --git a/src/nvim/spellfile.c b/src/nvim/spellfile.c index 8b95178c84..843ecec1b1 100644 --- a/src/nvim/spellfile.c +++ b/src/nvim/spellfile.c @@ -1371,6 +1371,9 @@ static int read_compound(FILE *fd, slang_T *slang, int len) gap = &slang->sl_comppat; c = get2c(fd); // <comppatcount> + if (c < 0) { + return SP_TRUNCERROR; + } todo -= 2; ga_init(gap, sizeof(char_u *), c); ga_grow(gap, c); diff --git a/src/nvim/tag.c b/src/nvim/tag.c index 61d48eb4bf..c63cdad098 100644 --- a/src/nvim/tag.c +++ b/src/nvim/tag.c @@ -1467,6 +1467,7 @@ find_tags( help_save = curbuf->b_help; orgpat.pat = pat; + orgpat.regmatch.regprog = NULL; vimconv.vc_type = CONV_NONE; /* diff --git a/src/nvim/testdir/test_cmdline.vim b/src/nvim/testdir/test_cmdline.vim index 8e2a145343..5a6824b5c1 100644 --- a/src/nvim/testdir/test_cmdline.vim +++ b/src/nvim/testdir/test_cmdline.vim @@ -599,13 +599,26 @@ endfunc func Test_cmdline_complete_user_func() call feedkeys(":func Test_cmdline_complete_user\<Tab>\<Home>\"\<cr>", 'tx') - call assert_match('"func Test_cmdline_complete_user', @:) + call assert_match('"func Test_cmdline_complete_user_', @:) call feedkeys(":func s:ScriptL\<Tab>\<Home>\"\<cr>", 'tx') call assert_match('"func <SNR>\d\+_ScriptLocalFunction', @:) " g: prefix also works call feedkeys(":echo g:Test_cmdline_complete_user_f\<Tab>\<Home>\"\<cr>", 'tx') call assert_match('"echo g:Test_cmdline_complete_user_func', @:) + + " using g: prefix does not result in just "g:" matches from a lambda + let Fx = { a -> a } + call feedkeys(":echo g:\<Tab>\<Home>\"\<cr>", 'tx') + call assert_match('"echo g:[A-Z]', @:) + + " existence of script-local dict function does not break user function name + " completion + function s:a_dict_func() dict + endfunction + call feedkeys(":call Test_cmdline_complete_user\<Tab>\<Home>\"\<cr>", 'tx') + call assert_match('"call Test_cmdline_complete_user_', @:) + delfunction s:a_dict_func endfunc func Test_cmdline_complete_user_names() diff --git a/src/nvim/testdir/test_excmd.vim b/src/nvim/testdir/test_excmd.vim index ed2bb2c06b..2d01cbba83 100644 --- a/src/nvim/testdir/test_excmd.vim +++ b/src/nvim/testdir/test_excmd.vim @@ -313,6 +313,42 @@ func Test_confirm_write_ro() call delete('Xconfirm_write_ro') endfunc +func Test_confirm_write_partial_file() + CheckNotGui + CheckRunVimInTerminal + + call writefile(['a', 'b', 'c', 'd'], 'Xwrite_partial') + call writefile(['set nobackup ff=unix cmdheight=2', + \ 'edit Xwrite_partial'], 'Xscript') + let buf = RunVimInTerminal('-S Xscript', {'rows': 20}) + + call term_sendkeys(buf, ":confirm 2,3w\n") + call WaitForAssert({-> assert_match('^Write partial file? *$', + \ term_getline(buf, 19))}, 1000) + call WaitForAssert({-> assert_match('^(Y)es, \[N\]o: *$', + \ term_getline(buf, 20))}, 1000) + call term_sendkeys(buf, 'N') + call WaitForAssert({-> assert_match('.* All$', term_getline(buf, 20))}, 1000) + call assert_equal(['a', 'b', 'c', 'd'], readfile('Xwrite_partial')) + call delete('Xwrite_partial') + + call term_sendkeys(buf, ":confirm 2,3w\n") + call WaitForAssert({-> assert_match('^Write partial file? *$', + \ term_getline(buf, 19))}, 1000) + call WaitForAssert({-> assert_match('^(Y)es, \[N\]o: *$', + \ term_getline(buf, 20))}, 1000) + call term_sendkeys(buf, 'Y') + call WaitForAssert({-> assert_match('^"Xwrite_partial" \[New\] 2L, 4B written *$', + \ term_getline(buf, 19))}, 1000) + call WaitForAssert({-> assert_match('^Press ENTER or type command to continue *$', + \ term_getline(buf, 20))}, 1000) + call assert_equal(['b', 'c'], readfile('Xwrite_partial')) + + call StopVimInTerminal(buf) + call delete('Xwrite_partial') + call delete('Xscript') +endfunc + " Test for the :winsize command func Test_winsize_cmd() call assert_fails('winsize 1', 'E465:') diff --git a/src/nvim/testdir/test_ins_complete_no_halt.vim b/src/nvim/testdir/test_ins_complete_no_halt.vim new file mode 100644 index 0000000000..e12925daa9 --- /dev/null +++ b/src/nvim/testdir/test_ins_complete_no_halt.vim @@ -0,0 +1,51 @@ +" Test insert mode completion does not get stuck when looping around. +" In a separate file to avoid the settings to leak to other test cases. + +set complete+=kspell +set completeopt+=menu +set completeopt+=menuone +set completeopt+=noselect +set completeopt+=noinsert +let g:autocompletion = v:true + +func Test_ins_complete_no_halt() + function! OpenCompletion() + if pumvisible() && (g:autocompletion == v:true) + call feedkeys("\<C-e>\<C-n>", "i") + return + endif + if ((v:char >= 'a' && v:char <= 'z') || (v:char >= 'A' && v:char <= 'Z')) && (g:autocompletion == v:true) + call feedkeys("\<C-n>", "i") + redraw + endif + endfunction + + autocmd InsertCharPre * noautocmd call OpenCompletion() + + setlocal spell! spelllang=en_us + + call feedkeys("iauto-complete-halt-test test test test test test test test test test test test test test test test test test test\<C-c>", "tx!") + call assert_equal(["auto-complete-halt-test test test test test test test test test test test test test test test test test test test"], getline(1, "$")) +endfunc + +func Test_auto_complete_backwards_no_halt() + function! OpenCompletion() + if pumvisible() && (g:autocompletion == v:true) + call feedkeys("\<C-e>\<C-p>", "i") + return + endif + if ((v:char >= 'a' && v:char <= 'z') || (v:char >= 'A' && v:char <= 'Z')) && (g:autocompletion == v:true) + call feedkeys("\<C-p>", "i") + redraw + endif + endfunction + + autocmd InsertCharPre * noautocmd call OpenCompletion() + + setlocal spell! spelllang=en_us + + call feedkeys("iauto-complete-halt-test test test test test test test test test test test test test test test test test test test\<C-c>", "tx!") + call assert_equal(["auto-complete-halt-test test test test test test test test test test test test test test test test test test test"], getline(1, "$")) +endfunc + +" vim: shiftwidth=2 sts=2 expandtab diff --git a/src/nvim/testdir/test_number.vim b/src/nvim/testdir/test_number.vim index 92a1bf3c9a..d737ebe9f0 100644 --- a/src/nvim/testdir/test_number.vim +++ b/src/nvim/testdir/test_number.vim @@ -320,4 +320,15 @@ func Test_number_rightleft() bw! endfunc +" This used to cause a divide by zero +func Test_number_no_text_virtual_edit() + vnew + call setline(1, ['line one', 'line two']) + set number virtualedit=all + normal w + 4wincmd | + normal j + bwipe! +endfunc + " vim: shiftwidth=2 sts=2 expandtab diff --git a/src/nvim/testdir/test_textformat.vim b/src/nvim/testdir/test_textformat.vim index 29f0433954..bf0706a0c2 100644 --- a/src/nvim/testdir/test_textformat.vim +++ b/src/nvim/testdir/test_textformat.vim @@ -975,6 +975,13 @@ func Test_fo_a_w() exe "normal f4xx" call assert_equal(['1 2 5 6 7 ', '8 9'], getline(1, 2)) + " using "cw" leaves cursor in right spot + call setline(1, ['Now we g whether that nation, or', + \ 'any nation so conceived and,']) + set fo=tcqa tw=35 + exe "normal 2G0cwx\<Esc>" + call assert_equal(['Now we g whether that nation, or x', 'nation so conceived and,'], getline(1, 2)) + set tw=0 set fo& %bw! diff --git a/src/nvim/testdir/test_writefile.vim b/src/nvim/testdir/test_writefile.vim index 2504fcb14e..aa7882d129 100644 --- a/src/nvim/testdir/test_writefile.vim +++ b/src/nvim/testdir/test_writefile.vim @@ -191,6 +191,14 @@ func Test_saveas() close! enew | only call delete('Xfile') + + " :saveas should detect and set the file type. + syntax on + saveas! Xsaveas.pl + call assert_equal('perl', &filetype) + syntax off + %bw! + call delete('Xsaveas.pl') endfunc func Test_write_errors() diff --git a/src/nvim/viml/parser/expressions.c b/src/nvim/viml/parser/expressions.c index f5bd5479c4..967d656dc5 100644 --- a/src/nvim/viml/parser/expressions.c +++ b/src/nvim/viml/parser/expressions.c @@ -860,7 +860,7 @@ const char *const east_node_type_tab[] = { /// /// @param[in] ch Character to convert. /// -/// @return Converted string, stored in a static buffer (overriden after each +/// @return Converted string, stored in a static buffer (overridden after each /// call). static const char *intchar2str(const int ch) FUNC_ATTR_WARN_UNUSED_RESULT diff --git a/src/nvim/window.c b/src/nvim/window.c index 75ecf90b14..4bbdaefd1f 100644 --- a/src/nvim/window.c +++ b/src/nvim/window.c @@ -64,6 +64,14 @@ # define ROWS_AVAIL (Rows - p_ch - tabline_height()) +/// flags for win_enter_ext() +typedef enum { + WEE_UNDO_SYNC = 0x01, + WEE_CURWIN_INVALID = 0x02, + WEE_TRIGGER_NEW_AUTOCMDS = 0x04, + WEE_TRIGGER_ENTER_AUTOCMDS = 0x08, + WEE_TRIGGER_LEAVE_AUTOCMDS = 0x10, +} wee_flags_T; static char *m_onlyone = N_("Already only one window"); @@ -1397,10 +1405,9 @@ int win_split_ins(int size, int flags, win_T *new_wp, int dir) // Keep same changelist position in new window. wp->w_changelistidx = oldwin->w_changelistidx; - /* - * make the new window the current window - */ - win_enter_ext(wp, false, false, true, true, true); + // make the new window the current window + win_enter_ext(wp, WEE_TRIGGER_NEW_AUTOCMDS | WEE_TRIGGER_ENTER_AUTOCMDS + | WEE_TRIGGER_LEAVE_AUTOCMDS); if (flags & WSP_VERT) { p_wiw = i; } else { @@ -1712,21 +1719,10 @@ static void win_exchange(long Prenum) curwin->w_vsep_width = wp->w_vsep_width; wp->w_vsep_width = temp; - /* If the windows are not in the same frame, exchange the sizes to avoid - * messing up the window layout. Otherwise fix the frame sizes. */ - if (curwin->w_frame->fr_parent != wp->w_frame->fr_parent) { - temp = curwin->w_height; - curwin->w_height = wp->w_height; - wp->w_height = temp; - temp = curwin->w_width; - curwin->w_width = wp->w_width; - wp->w_width = temp; - } else { - frame_fix_height(curwin); - frame_fix_height(wp); - frame_fix_width(curwin); - frame_fix_width(wp); - } + frame_fix_height(curwin); + frame_fix_height(wp); + frame_fix_width(curwin); + frame_fix_width(wp); (void)win_comp_pos(); // recompute window positions @@ -2620,7 +2616,8 @@ int win_close(win_T *win, bool free_buf) } if (close_curwin) { - win_enter_ext(wp, false, true, false, true, true); + win_enter_ext(wp, WEE_CURWIN_INVALID | WEE_TRIGGER_ENTER_AUTOCMDS + | WEE_TRIGGER_LEAVE_AUTOCMDS); if (other_buffer) { // careful: after this wp and win may be invalid! apply_autocmds(EVENT_BUFENTER, NULL, NULL, false, curbuf); @@ -4005,11 +4002,12 @@ static void enter_tabpage(tabpage_T *tp, buf_T *old_curbuf, bool trigger_enter_a tabpage_check_windows(old_curtab); } - /* We would like doing the TabEnter event first, but we don't have a - * valid current window yet, which may break some commands. - * This triggers autocommands, thus may make "tp" invalid. */ - win_enter_ext(tp->tp_curwin, false, true, false, - trigger_enter_autocmds, trigger_leave_autocmds); + // We would like doing the TabEnter event first, but we don't have a + // valid current window yet, which may break some commands. + // This triggers autocommands, thus may make "tp" invalid. + win_enter_ext(tp->tp_curwin, WEE_CURWIN_INVALID + | (trigger_enter_autocmds ? WEE_TRIGGER_ENTER_AUTOCMDS : 0) + | (trigger_leave_autocmds ? WEE_TRIGGER_LEAVE_AUTOCMDS : 0)); prevwin = next_prevwin; last_status(false); // status line may appear or disappear @@ -4462,26 +4460,25 @@ static void win_goto_hor(bool left, long count) /// win_valid(wp). void win_enter(win_T *wp, bool undo_sync) { - win_enter_ext(wp, undo_sync, false, false, true, true); + win_enter_ext(wp, (undo_sync ? WEE_UNDO_SYNC : 0) + | WEE_TRIGGER_ENTER_AUTOCMDS | WEE_TRIGGER_LEAVE_AUTOCMDS); } -/// Make window wp the current window. +/// Make window "wp" the current window. /// -/// @param curwin_invalid curwin has just been closed and -/// isn't valid when true. -static void win_enter_ext(win_T *wp, bool undo_sync, bool curwin_invalid, bool trigger_new_autocmds, - bool trigger_enter_autocmds, bool trigger_leave_autocmds) +/// @param flags if contains WEE_CURWIN_INVALID, it means curwin has just been +/// closed and isn't valid. +static void win_enter_ext(win_T *const wp, const int flags) { bool other_buffer = false; + const bool curwin_invalid = (flags & WEE_CURWIN_INVALID); if (wp == curwin && !curwin_invalid) { // nothing to do return; } - if (!curwin_invalid && trigger_leave_autocmds) { - /* - * Be careful: If autocommands delete the window, return now. - */ + if (!curwin_invalid && (flags & WEE_TRIGGER_LEAVE_AUTOCMDS)) { + // Be careful: If autocommands delete the window, return now. if (wp->w_buffer != curbuf) { apply_autocmds(EVENT_BUFLEAVE, NULL, NULL, false, curbuf); other_buffer = true; @@ -4500,7 +4497,7 @@ static void win_enter_ext(win_T *wp, bool undo_sync, bool curwin_invalid, bool t } // sync undo before leaving the current buffer - if (undo_sync && curbuf != wp->w_buffer) { + if ((flags & WEE_UNDO_SYNC) && curbuf != wp->w_buffer) { u_sync(false); } @@ -4561,10 +4558,10 @@ static void win_enter_ext(win_T *wp, bool undo_sync, bool curwin_invalid, bool t shorten_fnames(true); } - if (trigger_new_autocmds) { + if (flags & WEE_TRIGGER_NEW_AUTOCMDS) { apply_autocmds(EVENT_WINNEW, NULL, NULL, false, curbuf); } - if (trigger_enter_autocmds) { + if (flags & WEE_TRIGGER_ENTER_AUTOCMDS) { apply_autocmds(EVENT_WINENTER, NULL, NULL, false, curbuf); if (other_buffer) { apply_autocmds(EVENT_BUFENTER, NULL, NULL, false, curbuf); @@ -4926,10 +4923,6 @@ static void frame_remove(frame_T *frp) frp->fr_prev->fr_next = frp->fr_next; } else { frp->fr_parent->fr_child = frp->fr_next; - // special case: topframe->fr_child == frp - if (topframe->fr_child == frp) { - topframe->fr_child = frp->fr_next; - } } if (frp->fr_next != NULL) { frp->fr_next->fr_prev = frp->fr_prev; diff --git a/test/functional/api/vim_spec.lua b/test/functional/api/vim_spec.lua index b4b2e63fb0..83b256e935 100644 --- a/test/functional/api/vim_spec.lua +++ b/test/functional/api/vim_spec.lua @@ -533,7 +533,7 @@ describe('API', function() nvim("notify", "hello world", 2, {}) end) - it('can be overriden', function() + it('can be overridden', function() command("lua vim.notify = function(...) return 42 end") eq(42, meths.exec_lua("return vim.notify('Hello world')", {})) nvim("notify", "hello world", 4, {}) diff --git a/test/functional/autoread/focus_spec.lua b/test/functional/autocmd/focus_spec.lua index 3f9a0ad09b..3f9a0ad09b 100644 --- a/test/functional/autoread/focus_spec.lua +++ b/test/functional/autocmd/focus_spec.lua diff --git a/test/functional/cmdline/ctrl_r_spec.lua b/test/functional/cmdline/ctrl_r_spec.lua deleted file mode 100644 index a0f3955282..0000000000 --- a/test/functional/cmdline/ctrl_r_spec.lua +++ /dev/null @@ -1,34 +0,0 @@ -local helpers = require('test.functional.helpers')(after_each) -local clear, insert, funcs, eq, feed = - helpers.clear, helpers.insert, helpers.funcs, helpers.eq, helpers.feed - -describe('cmdline CTRL-R', function() - before_each(clear) - - it('pasting non-special register inserts <CR> *between* lines', function() - insert([[ - line1abc - line2somemoretext - ]]) - -- Yank 2 lines linewise, then paste to cmdline. - feed([[<C-\><C-N>gg0yj:<C-R>0]]) - -- <CR> inserted between lines, NOT after the final line. - eq('line1abc\rline2somemoretext', funcs.getcmdline()) - - -- Yank 2 lines charwise, then paste to cmdline. - feed([[<C-\><C-N>gg05lyvj:<C-R>0]]) - -- <CR> inserted between lines, NOT after the final line. - eq('abc\rline2', funcs.getcmdline()) - - -- Yank 1 line linewise, then paste to cmdline. - feed([[<C-\><C-N>ggyy:<C-R>0]]) - -- No <CR> inserted. - eq('line1abc', funcs.getcmdline()) - end) - - it('pasting special register inserts <CR>, <NL>', function() - feed([[:<C-R>="foo\nbar\rbaz"<CR>]]) - eq('foo\nbar\rbaz', funcs.getcmdline()) - end) -end) - diff --git a/test/functional/normal/K_spec.lua b/test/functional/editor/K_spec.lua index 40f36491e4..40f36491e4 100644 --- a/test/functional/normal/K_spec.lua +++ b/test/functional/editor/K_spec.lua diff --git a/test/functional/viml/completion_spec.lua b/test/functional/editor/completion_spec.lua index befad29922..befad29922 100644 --- a/test/functional/viml/completion_spec.lua +++ b/test/functional/editor/completion_spec.lua diff --git a/test/functional/normal/count_spec.lua b/test/functional/editor/count_spec.lua index 94f741250a..94f741250a 100644 --- a/test/functional/normal/count_spec.lua +++ b/test/functional/editor/count_spec.lua diff --git a/test/functional/normal/fold_spec.lua b/test/functional/editor/fold_spec.lua index 00e83bedc8..00e83bedc8 100644 --- a/test/functional/normal/fold_spec.lua +++ b/test/functional/editor/fold_spec.lua diff --git a/test/functional/normal/jump_spec.lua b/test/functional/editor/jump_spec.lua index 9e7158e2f7..9e7158e2f7 100644 --- a/test/functional/normal/jump_spec.lua +++ b/test/functional/editor/jump_spec.lua diff --git a/test/functional/normal/lang_spec.lua b/test/functional/editor/lang_spec.lua index 24d1262f5f..24d1262f5f 100644 --- a/test/functional/normal/lang_spec.lua +++ b/test/functional/editor/lang_spec.lua diff --git a/test/functional/normal/langmap_spec.lua b/test/functional/editor/langmap_spec.lua index e4349a22e7..e4349a22e7 100644 --- a/test/functional/normal/langmap_spec.lua +++ b/test/functional/editor/langmap_spec.lua diff --git a/test/functional/normal/macro_spec.lua b/test/functional/editor/macro_spec.lua index 102d8fc723..102d8fc723 100644 --- a/test/functional/normal/macro_spec.lua +++ b/test/functional/editor/macro_spec.lua diff --git a/test/functional/insert/insert_spec.lua b/test/functional/editor/meta_key_spec.lua index 330cfbd830..2a9541ba96 100644 --- a/test/functional/insert/insert_spec.lua +++ b/test/functional/editor/meta_key_spec.lua @@ -1,32 +1,40 @@ local helpers = require('test.functional.helpers')(after_each) local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert local command = helpers.command -local eq = helpers.eq local expect = helpers.expect local funcs = helpers.funcs +local eq = helpers.eq -describe('insert-mode', function() +describe('meta-keys #8226 #13042', function() before_each(function() clear() end) - it('CTRL-@', function() - -- Inserts last-inserted text, leaves insert-mode. + it('ALT/META, normal-mode', function() + -- Unmapped ALT-chords behave as ESC+c insert('hello') - feed('i<C-@>x') - expect('hellhello') - - -- C-Space is the same as C-@. - -- CTRL-SPC inserts last-inserted text, leaves insert-mode. - feed('i<C-Space>x') - expect('hellhellhello') + feed('0<A-x><M-x>') + expect('llo') + -- Mapped ALT-chord behaves as mapped. + command('nnoremap <M-l> Ameta-l<Esc>') + command('nnoremap <A-j> Aalt-j<Esc>') + feed('<A-j><M-l>') + expect('lloalt-jmeta-l') + end) - -- CTRL-A inserts last inserted text - feed('i<C-A>x') - expect('hellhellhellhelloxo') + it('ALT/META, visual-mode', function() + -- Unmapped ALT-chords behave as ESC+c + insert('peaches') + feed('viw<A-x>viw<M-x>') + expect('peach') + -- Mapped ALT-chord behaves as mapped. + command('vnoremap <M-l> Ameta-l<Esc>') + command('vnoremap <A-j> Aalt-j<Esc>') + feed('viw<A-j>viw<M-l>') + expect('peachalt-jmeta-l') end) - it('ALT/META #8213', function() + it('ALT/META insert-mode', function() -- Mapped ALT-chord behaves as mapped. command('inoremap <M-l> meta-l') command('inoremap <A-j> alt-j') diff --git a/test/functional/cmdline/history_spec.lua b/test/functional/editor/mode_cmdline_spec.lua index ee2d36f642..0f7d821bb5 100644 --- a/test/functional/cmdline/history_spec.lua +++ b/test/functional/editor/mode_cmdline_spec.lua @@ -1,8 +1,41 @@ +-- Cmdline-mode tests. + local helpers = require('test.functional.helpers')(after_each) -local clear, meths, funcs, eq = - helpers.clear, helpers.meths, helpers.funcs, helpers.eq +local clear, insert, funcs, eq, feed = + helpers.clear, helpers.insert, helpers.funcs, helpers.eq, helpers.feed +local meths = helpers.meths + +describe('cmdline CTRL-R', function() + before_each(clear) + + it('pasting non-special register inserts <CR> *between* lines', function() + insert([[ + line1abc + line2somemoretext + ]]) + -- Yank 2 lines linewise, then paste to cmdline. + feed([[<C-\><C-N>gg0yj:<C-R>0]]) + -- <CR> inserted between lines, NOT after the final line. + eq('line1abc\rline2somemoretext', funcs.getcmdline()) + + -- Yank 2 lines charwise, then paste to cmdline. + feed([[<C-\><C-N>gg05lyvj:<C-R>0]]) + -- <CR> inserted between lines, NOT after the final line. + eq('abc\rline2', funcs.getcmdline()) + + -- Yank 1 line linewise, then paste to cmdline. + feed([[<C-\><C-N>ggyy:<C-R>0]]) + -- No <CR> inserted. + eq('line1abc', funcs.getcmdline()) + end) + + it('pasting special register inserts <CR>, <NL>', function() + feed([[:<C-R>="foo\nbar\rbaz"<CR>]]) + eq('foo\nbar\rbaz', funcs.getcmdline()) + end) +end) -describe('history support code', function() +describe('cmdline history', function() before_each(clear) it('correctly clears start of the history', function() diff --git a/test/functional/editor/mode_insert_spec.lua b/test/functional/editor/mode_insert_spec.lua new file mode 100644 index 0000000000..46ab483036 --- /dev/null +++ b/test/functional/editor/mode_insert_spec.lua @@ -0,0 +1,89 @@ +-- Insert-mode tests. + +local helpers = require('test.functional.helpers')(after_each) +local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert +local expect = helpers.expect +local command = helpers.command +local eq = helpers.eq +local eval = helpers.eval +local meths = helpers.meths + +describe('insert-mode', function() + before_each(function() + clear() + end) + + it('CTRL-@', function() + -- Inserts last-inserted text, leaves insert-mode. + insert('hello') + feed('i<C-@>x') + expect('hellhello') + + -- C-Space is the same as C-@. + -- CTRL-SPC inserts last-inserted text, leaves insert-mode. + feed('i<C-Space>x') + expect('hellhellhello') + + -- CTRL-A inserts last inserted text + feed('i<C-A>x') + expect('hellhellhellhelloxo') + end) + + describe('Ctrl-R', function() + it('works', function() + command("let @@ = 'test'") + feed('i<C-r>"') + expect('test') + end) + + it('works with multi-byte text', function() + command("let @@ = 'påskägg'") + feed('i<C-r>"') + expect('påskägg') + end) + end) + + describe('Ctrl-O', function() + it('enters command mode for one command', function() + feed('ihello world<C-o>') + feed(':let ctrlo = "test"<CR>') + feed('iii') + expect('hello worldiii') + eq(1, eval('ctrlo ==# "test"')) + end) + + it('re-enters insert mode at the end of the line when running startinsert', function() + -- #6962 + feed('ihello world<C-o>') + feed(':startinsert<CR>') + feed('iii') + expect('hello worldiii') + end) + + it('re-enters insert mode at the beginning of the line when running startinsert', function() + insert('hello world') + feed('0<C-o>') + feed(':startinsert<CR>') + feed('aaa') + expect('aaahello world') + end) + + it('re-enters insert mode in the middle of the line when running startinsert', function() + insert('hello world') + feed('bi<C-o>') + feed(':startinsert<CR>') + feed('ooo') + expect('hello oooworld') + end) + + it("doesn't cancel Ctrl-O mode when processing event", function() + feed('iHello World<c-o>') + eq({mode='niI', blocking=false}, meths.get_mode()) -- fast event + eq(2, eval('1+1')) -- causes K_EVENT key + eq({mode='niI', blocking=false}, meths.get_mode()) -- still in ctrl-o mode + feed('dd') + eq({mode='i', blocking=false}, meths.get_mode()) -- left ctrl-o mode + expect('') -- executed the command + end) + end) +end) diff --git a/test/functional/visual/ctrl_o_spec.lua b/test/functional/editor/mode_visual_spec.lua index 65a128053c..e9c117a1e5 100644 --- a/test/functional/visual/ctrl_o_spec.lua +++ b/test/functional/editor/mode_visual_spec.lua @@ -1,3 +1,5 @@ +-- Visual-mode tests. + local helpers = require('test.functional.helpers')(after_each) local clear = helpers.clear local eq = helpers.eq @@ -6,10 +8,10 @@ local expect = helpers.expect local feed = helpers.feed local meths = helpers.meths -describe('select-mode Ctrl-O', function() +describe('visual-mode', function() before_each(clear) - it("doesn't cancel Ctrl-O mode when processing event", function() + it("select-mode Ctrl-O doesn't cancel Ctrl-O mode when processing event #15688", function() feed('iHello World<esc>gh<c-o>') eq({mode='vs', blocking=false}, meths.get_mode()) -- fast event eq(2, eval('1+1')) -- causes K_EVENT key @@ -21,3 +23,4 @@ describe('select-mode Ctrl-O', function() expect('h') -- selection is the whole line and is replaced end) end) + diff --git a/test/functional/normal/put_spec.lua b/test/functional/editor/put_spec.lua index 26967ecbba..26967ecbba 100644 --- a/test/functional/normal/put_spec.lua +++ b/test/functional/editor/put_spec.lua diff --git a/test/functional/normal/search_spec.lua b/test/functional/editor/search_spec.lua index d5df131725..d5df131725 100644 --- a/test/functional/normal/search_spec.lua +++ b/test/functional/editor/search_spec.lua diff --git a/test/functional/normal/tabpage_spec.lua b/test/functional/editor/tabpage_spec.lua index d1d6854b07..d1d6854b07 100644 --- a/test/functional/normal/tabpage_spec.lua +++ b/test/functional/editor/tabpage_spec.lua diff --git a/test/functional/normal/undo_spec.lua b/test/functional/editor/undo_spec.lua index a023ca3d90..a023ca3d90 100644 --- a/test/functional/normal/undo_spec.lua +++ b/test/functional/editor/undo_spec.lua diff --git a/test/functional/eval/backtick_expansion_spec.lua b/test/functional/eval/backtick_expansion_spec.lua deleted file mode 100644 index b1b44cfa8b..0000000000 --- a/test/functional/eval/backtick_expansion_spec.lua +++ /dev/null @@ -1,50 +0,0 @@ -local lfs = require('lfs') -local helpers = require('test.functional.helpers')(after_each) -local clear, command, eval, eq = helpers.clear, helpers.command, helpers.eval, helpers.eq -local write_file = helpers.write_file - -describe("backtick expansion", function() - setup(function() - clear() - lfs.mkdir("test-backticks") - write_file("test-backticks/file1", "test file 1") - write_file("test-backticks/file2", "test file 2") - write_file("test-backticks/file3", "test file 3") - lfs.mkdir("test-backticks/subdir") - write_file("test-backticks/subdir/file4", "test file 4") - -- Long path might cause "Press ENTER" prompt; use :silent to avoid it. - command('silent cd test-backticks') - end) - - teardown(function() - helpers.rmdir('test-backticks') - end) - - it("with default 'shell'", function() - if helpers.iswin() then - command(":silent args `dir /b *2`") - else - command(":silent args `echo ***2`") - end - eq({ "file2", }, eval("argv()")) - if helpers.iswin() then - command(":silent args `dir /s/b *4`") - eq({ "subdir\\file4", }, eval("map(argv(), 'fnamemodify(v:val, \":.\")')")) - else - command(":silent args `echo */*4`") - eq({ "subdir/file4", }, eval("argv()")) - end - end) - - it("with shell=fish", function() - if eval("executable('fish')") == 0 then - pending('missing "fish" command') - return - end - command("set shell=fish") - command(":silent args `echo ***2`") - eq({ "file2", }, eval("argv()")) - command(":silent args `echo */*4`") - eq({ "subdir/file4", }, eval("argv()")) - end) -end) diff --git a/test/functional/eval/function_spec.lua b/test/functional/eval/function_spec.lua deleted file mode 100644 index ce8850fcc2..0000000000 --- a/test/functional/eval/function_spec.lua +++ /dev/null @@ -1,37 +0,0 @@ -local helpers = require('test.functional.helpers')(after_each) - -local clear = helpers.clear -local eq = helpers.eq -local matches = helpers.matches -local exc_exec = helpers.exc_exec -local iswin = helpers.iswin -local eval = helpers.eval - -describe('Up to MAX_FUNC_ARGS arguments are handled by', function() - local max_func_args = 20 -- from eval.h - local range = helpers.funcs.range - - before_each(clear) - - it('printf()', function() - local printf = helpers.funcs.printf - local rep = helpers.funcs['repeat'] - local expected = '2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,' - eq(expected, printf(rep('%d,', max_func_args-1), unpack(range(2, max_func_args)))) - local ret = exc_exec('call printf("", 2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21)') - eq('Vim(call):E740: Too many arguments for function printf', ret) - end) - - it('rpcnotify()', function() - local rpcnotify = helpers.funcs.rpcnotify - local ret = rpcnotify(0, 'foo', unpack(range(3, max_func_args))) - eq(1, ret) - ret = exc_exec('call rpcnotify(0, "foo", 3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21)') - eq('Vim(call):E740: Too many arguments for function rpcnotify', ret) - end) -end) - -it('windowsversion()', function() - clear() - matches(iswin() and '^%d+%.%d+$' or '^$', eval('windowsversion()')) -end) diff --git a/test/functional/eval/interrupt_spec.lua b/test/functional/eval/interrupt_spec.lua deleted file mode 100644 index 05b1f4ff57..0000000000 --- a/test/functional/eval/interrupt_spec.lua +++ /dev/null @@ -1,61 +0,0 @@ -local helpers = require('test.functional.helpers')(after_each) - -local command = helpers.command -local meths = helpers.meths -local clear = helpers.clear -local sleep = helpers.sleep -local poke_eventloop = helpers.poke_eventloop -local feed = helpers.feed -local eq = helpers.eq - -local dur -local min_dur = 8 -local len = 131072 - -describe('List support code', function() - if not pending('does not actually allows interrupting with just got_int', function() end) then return end - -- The following tests are confirmed to work with os_breakcheck() just before - -- `if (got_int) {break;}` in tv_list_copy and list_join_inner() and not to - -- work without. - setup(function() - clear() - dur = 0 - while true do - command(([[ - let rt = reltime() - let bl = range(%u) - let dur = reltimestr(reltime(rt)) - ]]):format(len)) - dur = tonumber(meths.get_var('dur')) - if dur >= min_dur then - -- print(('Using len %u, dur %g'):format(len, dur)) - break - else - len = len * 2 - end - end - end) - it('allows interrupting copy', function() - feed(':let t_rt = reltime()<CR>:let t_bl = copy(bl)<CR>') - sleep(min_dur / 16 * 1000) - feed('<C-c>') - poke_eventloop() - command('let t_dur = reltimestr(reltime(t_rt))') - local t_dur = tonumber(meths.get_var('t_dur')) - if t_dur >= dur / 8 then - eq(nil, ('Took too long to cancel: %g >= %g'):format(t_dur, dur / 8)) - end - end) - it('allows interrupting join', function() - feed(':let t_rt = reltime()<CR>:let t_j = join(bl)<CR>') - sleep(min_dur / 16 * 1000) - feed('<C-c>') - poke_eventloop() - command('let t_dur = reltimestr(reltime(t_rt))') - local t_dur = tonumber(meths.get_var('t_dur')) - print(('t_dur: %g'):format(t_dur)) - if t_dur >= dur / 8 then - eq(nil, ('Took too long to cancel: %g >= %g'):format(t_dur, dur / 8)) - end - end) -end) diff --git a/test/functional/insert/ctrl_o_spec.lua b/test/functional/insert/ctrl_o_spec.lua deleted file mode 100644 index 011954fa9d..0000000000 --- a/test/functional/insert/ctrl_o_spec.lua +++ /dev/null @@ -1,54 +0,0 @@ -local helpers = require('test.functional.helpers')(after_each) -local clear = helpers.clear -local eq = helpers.eq -local eval = helpers.eval -local expect = helpers.expect -local feed = helpers.feed -local insert = helpers.insert -local meths = helpers.meths - -describe('insert-mode Ctrl-O', function() - before_each(clear) - - it('enters command mode for one command', function() - feed('ihello world<C-o>') - feed(':let ctrlo = "test"<CR>') - feed('iii') - expect('hello worldiii') - eq(1, eval('ctrlo ==# "test"')) - end) - - it('re-enters insert mode at the end of the line when running startinsert', function() - -- #6962 - feed('ihello world<C-o>') - feed(':startinsert<CR>') - feed('iii') - expect('hello worldiii') - end) - - it('re-enters insert mode at the beginning of the line when running startinsert', function() - insert('hello world') - feed('0<C-o>') - feed(':startinsert<CR>') - feed('aaa') - expect('aaahello world') - end) - - it('re-enters insert mode in the middle of the line when running startinsert', function() - insert('hello world') - feed('bi<C-o>') - feed(':startinsert<CR>') - feed('ooo') - expect('hello oooworld') - end) - - it("doesn't cancel Ctrl-O mode when processing event", function() - feed('iHello World<c-o>') - eq({mode='niI', blocking=false}, meths.get_mode()) -- fast event - eq(2, eval('1+1')) -- causes K_EVENT key - eq({mode='niI', blocking=false}, meths.get_mode()) -- still in ctrl-o mode - feed('dd') - eq({mode='i', blocking=false}, meths.get_mode()) -- left ctrl-o mode - expect('') -- executed the command - end) -end) diff --git a/test/functional/insert/ctrl_r_spec.lua b/test/functional/insert/ctrl_r_spec.lua deleted file mode 100644 index adc3c4b406..0000000000 --- a/test/functional/insert/ctrl_r_spec.lua +++ /dev/null @@ -1,19 +0,0 @@ -local helpers = require('test.functional.helpers')(after_each) -local clear, feed = helpers.clear, helpers.feed -local expect, command = helpers.expect, helpers.command - -describe('insert-mode Ctrl-R', function() - before_each(clear) - - it('works', function() - command("let @@ = 'test'") - feed('i<C-r>"') - expect('test') - end) - - it('works with multi-byte text', function() - command("let @@ = 'påskägg'") - feed('i<C-r>"') - expect('påskägg') - end) -end) diff --git a/test/functional/normal/meta_key_spec.lua b/test/functional/normal/meta_key_spec.lua deleted file mode 100644 index 9f9fad67d2..0000000000 --- a/test/functional/normal/meta_key_spec.lua +++ /dev/null @@ -1,22 +0,0 @@ -local helpers = require('test.functional.helpers')(after_each) -local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert -local command = helpers.command -local expect = helpers.expect - -describe('meta-keys-in-normal-mode', function() - before_each(function() - clear() - end) - - it('ALT/META', function() - -- Unmapped ALT-chords behave as Esc+c - insert('hello') - feed('0<A-x><M-x>') - expect('llo') - -- Mapped ALT-chord behaves as mapped. - command('nnoremap <M-l> Ameta-l<Esc>') - command('nnoremap <A-j> Aalt-j<Esc>') - feed('<A-j><M-l>') - expect('lloalt-jmeta-l') - end) -end) diff --git a/test/functional/viml/function_spec.lua b/test/functional/viml/function_spec.lua deleted file mode 100644 index b8137038b1..0000000000 --- a/test/functional/viml/function_spec.lua +++ /dev/null @@ -1,216 +0,0 @@ -local helpers = require('test.functional.helpers')(after_each) - -local eq = helpers.eq -local clear = helpers.clear -local dedent = helpers.dedent -local redir_exec = helpers.redir_exec - -before_each(clear) - -local function check_func(fname, body, indent) - if type(body) == 'number' then - body = ('return %i'):format(body) - end - eq(dedent(([[ - - function %s()%s - endfunction]] - ), 3):format( - fname, - body and ('\n1' .. (' '):rep(2 + (indent or 8)) .. body) or ''), - redir_exec('function ' .. fname)) -end - -describe(':endfunction', function() - it('accepts bang', function() - eq('', redir_exec([[ - function F() - endfunction! - ]])) - check_func('F') - eq('', redir_exec([[ - function! F() - return 1 - endfunction! - ]])) - check_func('F', 1) - end) - it('accepts comments', function() - eq('', redir_exec([[ - function F1() - endfunction " Comment - ]])) - check_func('F1') - eq('', redir_exec([[ - function F2() - endfunction " }}} - ]])) - check_func('F2') - eq('', redir_exec([[ - function F3() - endfunction " F3 - ]])) - check_func('F3') - eq('', redir_exec([[ - function F4() - endfunction! " F4 - ]])) - check_func('F4') - eq('', redir_exec([[ - function! F4() - return 2 - endfunction! " F4 - ]])) - check_func('F4', 2) - end) - it('accepts function name', function() - eq('', redir_exec([[ - function F0() - endfunction F0 - ]])) - check_func('F0') - eq('', redir_exec([[ - function F1() - endfunction! F1 - ]])) - check_func('F1') - eq('', redir_exec([[ - function! F2() - endfunction! F2 - ]])) - check_func('F2') - eq('', redir_exec([[ - function! F2() - return 3 - endfunction! F2 - ]])) - check_func('F2', 3) - end) - it('accepts weird characters', function() - eq('', redir_exec([[ - function F1() - endfunction: }}} - ]])) - check_func('F1') - -- From accurev - eq('', redir_exec([[ - function F2() - endfunction :}}} - ]])) - check_func('F2') - -- From cream-vimabbrev - eq('', redir_exec([[ - function F3() - endfunction 1}}} - ]])) - check_func('F3') - -- From pyunit - eq('', redir_exec([[ - function F4() - endfunction # }}} - ]])) - check_func('F4') - -- From vim-lldb - eq('', redir_exec([[ - function F5() - endfunction() - ]])) - check_func('F5') - -- From vim-mail - eq('', redir_exec([[ - function F6() - endfunction; - ]])) - check_func('F6') - end) - it('accepts commented bar', function() - eq('', redir_exec([[ - function F1() - endfunction " F1 | echo 42 - ]])) - check_func('F1') - eq('', redir_exec([[ - function! F1() - return 42 - endfunction! " F1 | echo 42 - ]])) - check_func('F1', 42) - end) - it('accepts uncommented bar', function() - eq('\n42', redir_exec([[ - function F1() - endfunction | echo 42 - ]])) - check_func('F1') - end) - it('allows running multiple commands', function() - eq('\n2', redir_exec([[ - function F1() - echo 2 - endfunction - call F1() - ]])) - check_func('F1', 'echo 2') - eq('\n2\n3\n4', redir_exec([[ - function F2() - echo 2 - endfunction F2 - function F3() - echo 3 - endfunction " F3 - function! F4() - echo 4 - endfunction! - call F2() - call F3() - call F4() - ]])) - check_func('F2', 'echo 2') - check_func('F3', 'echo 3') - check_func('F4', 'echo 4') - end) - it('allows running multiple commands with only one character in between', - function() - eq('\n3', redir_exec(dedent([[ - function! F1() - echo 3 - endfunction! - call F1()]]))) - check_func('F1', 'echo 3', 2) - eq('\n4', redir_exec(dedent([[ - function F5() - echo 4 - endfunction - call F5()]]))) - check_func('F5', 'echo 4', 2) - eq('\n5', redir_exec(dedent([[ - function F6() - echo 5 - endfunction " TEST - call F6()]]))) - check_func('F6', 'echo 5', 2) - eq('\n6', redir_exec(dedent([[ - function F7() - echo 6 - endfunction F7 - call F7()]]))) - check_func('F7', 'echo 6', 2) - eq('\n2\n3\n4', redir_exec(dedent([[ - function F2() - echo 2 - endfunction F2 - function F3() - echo 3 - endfunction " F3 - function! F4() - echo 4 - endfunction! - call F2() - call F3() - call F4()]]))) - check_func('F2', 'echo 2', 2) - check_func('F3', 'echo 3', 2) - check_func('F4', 'echo 4', 2) - end) -end) --- vim: foldmarker=▶,▲ diff --git a/test/functional/eval/api_functions_spec.lua b/test/functional/vimscript/api_functions_spec.lua index d07e74d40e..d07e74d40e 100644 --- a/test/functional/eval/api_functions_spec.lua +++ b/test/functional/vimscript/api_functions_spec.lua diff --git a/test/functional/eval/buf_functions_spec.lua b/test/functional/vimscript/buf_functions_spec.lua index e957e5f5af..e957e5f5af 100644 --- a/test/functional/eval/buf_functions_spec.lua +++ b/test/functional/vimscript/buf_functions_spec.lua diff --git a/test/functional/eval/changedtick_spec.lua b/test/functional/vimscript/changedtick_spec.lua index 99406d9d7a..99406d9d7a 100644 --- a/test/functional/eval/changedtick_spec.lua +++ b/test/functional/vimscript/changedtick_spec.lua diff --git a/test/functional/eval/container_functions_spec.lua b/test/functional/vimscript/container_functions_spec.lua index 04a3248c49..04a3248c49 100644 --- a/test/functional/eval/container_functions_spec.lua +++ b/test/functional/vimscript/container_functions_spec.lua diff --git a/test/functional/eval/ctx_functions_spec.lua b/test/functional/vimscript/ctx_functions_spec.lua index f23adbc556..f23adbc556 100644 --- a/test/functional/eval/ctx_functions_spec.lua +++ b/test/functional/vimscript/ctx_functions_spec.lua diff --git a/test/functional/eval/environ_spec.lua b/test/functional/vimscript/environ_spec.lua index 9e19568249..9e19568249 100644 --- a/test/functional/eval/environ_spec.lua +++ b/test/functional/vimscript/environ_spec.lua diff --git a/test/functional/viml/errorlist_spec.lua b/test/functional/vimscript/errorlist_spec.lua index 077d816903..077d816903 100644 --- a/test/functional/viml/errorlist_spec.lua +++ b/test/functional/vimscript/errorlist_spec.lua diff --git a/test/functional/vimscript/eval_spec.lua b/test/functional/vimscript/eval_spec.lua new file mode 100644 index 0000000000..e1459ab5b8 --- /dev/null +++ b/test/functional/vimscript/eval_spec.lua @@ -0,0 +1,146 @@ +-- Tests for core Vimscript "eval" behavior. +-- +-- See also: +-- let_spec.lua +-- null_spec.lua +-- operators_spec.lua +-- +-- Tests for the Vimscript |functions| library should live in: +-- test/functional/vimscript/<funcname>_spec.lua +-- test/functional/vimscript/functions_spec.lua + +local helpers = require('test.functional.helpers')(after_each) + +local lfs = require('lfs') +local clear = helpers.clear +local eq = helpers.eq +local exc_exec = helpers.exc_exec +local eval = helpers.eval +local command = helpers.command +local write_file = helpers.write_file +local meths = helpers.meths +local sleep = helpers.sleep +local poke_eventloop = helpers.poke_eventloop +local feed = helpers.feed + +describe('Up to MAX_FUNC_ARGS arguments are handled by', function() + local max_func_args = 20 -- from eval.h + local range = helpers.funcs.range + + before_each(clear) + + it('printf()', function() + local printf = helpers.funcs.printf + local rep = helpers.funcs['repeat'] + local expected = '2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,' + eq(expected, printf(rep('%d,', max_func_args-1), unpack(range(2, max_func_args)))) + local ret = exc_exec('call printf("", 2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21)') + eq('Vim(call):E740: Too many arguments for function printf', ret) + end) + + it('rpcnotify()', function() + local rpcnotify = helpers.funcs.rpcnotify + local ret = rpcnotify(0, 'foo', unpack(range(3, max_func_args))) + eq(1, ret) + ret = exc_exec('call rpcnotify(0, "foo", 3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21)') + eq('Vim(call):E740: Too many arguments for function rpcnotify', ret) + end) +end) + +describe("backtick expansion", function() + setup(function() + clear() + lfs.mkdir("test-backticks") + write_file("test-backticks/file1", "test file 1") + write_file("test-backticks/file2", "test file 2") + write_file("test-backticks/file3", "test file 3") + lfs.mkdir("test-backticks/subdir") + write_file("test-backticks/subdir/file4", "test file 4") + -- Long path might cause "Press ENTER" prompt; use :silent to avoid it. + command('silent cd test-backticks') + end) + + teardown(function() + helpers.rmdir('test-backticks') + end) + + it("with default 'shell'", function() + if helpers.iswin() then + command(":silent args `dir /b *2`") + else + command(":silent args `echo ***2`") + end + eq({ "file2", }, eval("argv()")) + if helpers.iswin() then + command(":silent args `dir /s/b *4`") + eq({ "subdir\\file4", }, eval("map(argv(), 'fnamemodify(v:val, \":.\")')")) + else + command(":silent args `echo */*4`") + eq({ "subdir/file4", }, eval("argv()")) + end + end) + + it("with shell=fish", function() + if eval("executable('fish')") == 0 then + pending('missing "fish" command') + return + end + command("set shell=fish") + command(":silent args `echo ***2`") + eq({ "file2", }, eval("argv()")) + command(":silent args `echo */*4`") + eq({ "subdir/file4", }, eval("argv()")) + end) +end) + +describe('List support code', function() + local dur + local min_dur = 8 + local len = 131072 + + if not pending('does not actually allows interrupting with just got_int', function() end) then return end + -- The following tests are confirmed to work with os_breakcheck() just before + -- `if (got_int) {break;}` in tv_list_copy and list_join_inner() and not to + -- work without. + setup(function() + clear() + dur = 0 + while true do + command(([[ + let rt = reltime() + let bl = range(%u) + let dur = reltimestr(reltime(rt)) + ]]):format(len)) + dur = tonumber(meths.get_var('dur')) + if dur >= min_dur then + -- print(('Using len %u, dur %g'):format(len, dur)) + break + else + len = len * 2 + end + end + end) + it('allows interrupting copy', function() + feed(':let t_rt = reltime()<CR>:let t_bl = copy(bl)<CR>') + sleep(min_dur / 16 * 1000) + feed('<C-c>') + poke_eventloop() + command('let t_dur = reltimestr(reltime(t_rt))') + local t_dur = tonumber(meths.get_var('t_dur')) + if t_dur >= dur / 8 then + eq(nil, ('Took too long to cancel: %g >= %g'):format(t_dur, dur / 8)) + end + end) + it('allows interrupting join', function() + feed(':let t_rt = reltime()<CR>:let t_j = join(bl)<CR>') + sleep(min_dur / 16 * 1000) + feed('<C-c>') + poke_eventloop() + command('let t_dur = reltimestr(reltime(t_rt))') + local t_dur = tonumber(meths.get_var('t_dur')) + print(('t_dur: %g'):format(t_dur)) + if t_dur >= dur / 8 then + eq(nil, ('Took too long to cancel: %g >= %g'):format(t_dur, dur / 8)) + end + end) +end) diff --git a/test/functional/eval/executable_spec.lua b/test/functional/vimscript/executable_spec.lua index 28aefb72e5..28aefb72e5 100644 --- a/test/functional/eval/executable_spec.lua +++ b/test/functional/vimscript/executable_spec.lua diff --git a/test/functional/eval/execute_spec.lua b/test/functional/vimscript/execute_spec.lua index fccf52935b..fccf52935b 100644 --- a/test/functional/eval/execute_spec.lua +++ b/test/functional/vimscript/execute_spec.lua diff --git a/test/functional/eval/exepath_spec.lua b/test/functional/vimscript/exepath_spec.lua index 08d2c59af8..08d2c59af8 100644 --- a/test/functional/eval/exepath_spec.lua +++ b/test/functional/vimscript/exepath_spec.lua diff --git a/test/functional/eval/fnamemodify_spec.lua b/test/functional/vimscript/fnamemodify_spec.lua index d54a6db417..d54a6db417 100644 --- a/test/functional/eval/fnamemodify_spec.lua +++ b/test/functional/vimscript/fnamemodify_spec.lua diff --git a/test/functional/vimscript/functions_spec.lua b/test/functional/vimscript/functions_spec.lua new file mode 100644 index 0000000000..0ad7fd8010 --- /dev/null +++ b/test/functional/vimscript/functions_spec.lua @@ -0,0 +1,20 @@ +-- Tests for misc Vimscript |functions|. +-- +-- If a function is non-trivial, consider moving its spec to: +-- test/functional/vimscript/<funcname>_spec.lua +-- +-- Core "eval" tests live in eval_spec.lua. + +local helpers = require('test.functional.helpers')(after_each) + +local clear = helpers.clear +local eval = helpers.eval +local iswin = helpers.iswin +local matches = helpers.matches + +before_each(clear) + +it('windowsversion()', function() + clear() + matches(iswin() and '^%d+%.%d+$' or '^$', eval('windowsversion()')) +end) diff --git a/test/functional/eval/getline_spec.lua b/test/functional/vimscript/getline_spec.lua index 3c56bde094..3c56bde094 100644 --- a/test/functional/eval/getline_spec.lua +++ b/test/functional/vimscript/getline_spec.lua diff --git a/test/functional/eval/glob_spec.lua b/test/functional/vimscript/glob_spec.lua index b8807ecfcc..b8807ecfcc 100644 --- a/test/functional/eval/glob_spec.lua +++ b/test/functional/vimscript/glob_spec.lua diff --git a/test/functional/eval/has_spec.lua b/test/functional/vimscript/has_spec.lua index a3af2d1a20..a3af2d1a20 100644 --- a/test/functional/eval/has_spec.lua +++ b/test/functional/vimscript/has_spec.lua diff --git a/test/functional/eval/hostname_spec.lua b/test/functional/vimscript/hostname_spec.lua index 6112cf64e3..6112cf64e3 100644 --- a/test/functional/eval/hostname_spec.lua +++ b/test/functional/vimscript/hostname_spec.lua diff --git a/test/functional/eval/input_spec.lua b/test/functional/vimscript/input_spec.lua index 14c02f9eb2..14c02f9eb2 100644 --- a/test/functional/eval/input_spec.lua +++ b/test/functional/vimscript/input_spec.lua diff --git a/test/functional/eval/json_functions_spec.lua b/test/functional/vimscript/json_functions_spec.lua index 9b5e207c07..9b5e207c07 100644 --- a/test/functional/eval/json_functions_spec.lua +++ b/test/functional/vimscript/json_functions_spec.lua diff --git a/test/functional/viml/lang_spec.lua b/test/functional/vimscript/lang_spec.lua index 6d603b8822..d5254986ab 100644 --- a/test/functional/viml/lang_spec.lua +++ b/test/functional/vimscript/lang_spec.lua @@ -2,7 +2,7 @@ local helpers = require('test.functional.helpers')(after_each) local clear, eval, eq = helpers.clear, helpers.eval, helpers.eq local exc_exec, source = helpers.exc_exec, helpers.source -describe('viml', function() +describe('vimscript', function() before_each(clear) it('parses `<SID>` with turkish locale', function() diff --git a/test/functional/eval/let_spec.lua b/test/functional/vimscript/let_spec.lua index 5bc703b567..5bc703b567 100644 --- a/test/functional/eval/let_spec.lua +++ b/test/functional/vimscript/let_spec.lua diff --git a/test/functional/eval/map_functions_spec.lua b/test/functional/vimscript/map_functions_spec.lua index 275c72d212..275c72d212 100644 --- a/test/functional/eval/map_functions_spec.lua +++ b/test/functional/vimscript/map_functions_spec.lua diff --git a/test/functional/eval/match_functions_spec.lua b/test/functional/vimscript/match_functions_spec.lua index 9f168c913a..9f168c913a 100644 --- a/test/functional/eval/match_functions_spec.lua +++ b/test/functional/vimscript/match_functions_spec.lua diff --git a/test/functional/eval/minmax_functions_spec.lua b/test/functional/vimscript/minmax_functions_spec.lua index c6eb754f91..c6eb754f91 100644 --- a/test/functional/eval/minmax_functions_spec.lua +++ b/test/functional/vimscript/minmax_functions_spec.lua diff --git a/test/functional/eval/modeline_spec.lua b/test/functional/vimscript/modeline_spec.lua index b2346079a1..b2346079a1 100644 --- a/test/functional/eval/modeline_spec.lua +++ b/test/functional/vimscript/modeline_spec.lua diff --git a/test/functional/eval/msgpack_functions_spec.lua b/test/functional/vimscript/msgpack_functions_spec.lua index 837b629858..837b629858 100644 --- a/test/functional/eval/msgpack_functions_spec.lua +++ b/test/functional/vimscript/msgpack_functions_spec.lua diff --git a/test/functional/eval/null_spec.lua b/test/functional/vimscript/null_spec.lua index bc88e6c8b3..bc88e6c8b3 100644 --- a/test/functional/eval/null_spec.lua +++ b/test/functional/vimscript/null_spec.lua diff --git a/test/functional/eval/operators_spec.lua b/test/functional/vimscript/operators_spec.lua index 4d07bc1b05..4d07bc1b05 100644 --- a/test/functional/eval/operators_spec.lua +++ b/test/functional/vimscript/operators_spec.lua diff --git a/test/functional/eval/printf_spec.lua b/test/functional/vimscript/printf_spec.lua index 27e24c4118..27e24c4118 100644 --- a/test/functional/eval/printf_spec.lua +++ b/test/functional/vimscript/printf_spec.lua diff --git a/test/functional/eval/reltime_spec.lua b/test/functional/vimscript/reltime_spec.lua index d87943e485..d87943e485 100644 --- a/test/functional/eval/reltime_spec.lua +++ b/test/functional/vimscript/reltime_spec.lua diff --git a/test/functional/eval/server_spec.lua b/test/functional/vimscript/server_spec.lua index 238d1aeb0f..238d1aeb0f 100644 --- a/test/functional/eval/server_spec.lua +++ b/test/functional/vimscript/server_spec.lua diff --git a/test/functional/eval/setpos_spec.lua b/test/functional/vimscript/setpos_spec.lua index 935f387bcc..935f387bcc 100644 --- a/test/functional/eval/setpos_spec.lua +++ b/test/functional/vimscript/setpos_spec.lua diff --git a/test/functional/eval/sort_spec.lua b/test/functional/vimscript/sort_spec.lua index e1cc2c2924..e1cc2c2924 100644 --- a/test/functional/eval/sort_spec.lua +++ b/test/functional/vimscript/sort_spec.lua diff --git a/test/functional/eval/special_vars_spec.lua b/test/functional/vimscript/special_vars_spec.lua index 97a12d490d..97a12d490d 100644 --- a/test/functional/eval/special_vars_spec.lua +++ b/test/functional/vimscript/special_vars_spec.lua diff --git a/test/functional/eval/string_spec.lua b/test/functional/vimscript/string_spec.lua index adc1af9b8e..adc1af9b8e 100644 --- a/test/functional/eval/string_spec.lua +++ b/test/functional/vimscript/string_spec.lua diff --git a/test/functional/eval/system_spec.lua b/test/functional/vimscript/system_spec.lua index 24a1f05390..24a1f05390 100644 --- a/test/functional/eval/system_spec.lua +++ b/test/functional/vimscript/system_spec.lua diff --git a/test/functional/eval/timer_spec.lua b/test/functional/vimscript/timer_spec.lua index 9ee0735e40..9ee0735e40 100644 --- a/test/functional/eval/timer_spec.lua +++ b/test/functional/vimscript/timer_spec.lua diff --git a/test/functional/eval/uniq_spec.lua b/test/functional/vimscript/uniq_spec.lua index 5cdba0a0f6..5cdba0a0f6 100644 --- a/test/functional/eval/uniq_spec.lua +++ b/test/functional/vimscript/uniq_spec.lua diff --git a/test/functional/eval/vvar_event_spec.lua b/test/functional/vimscript/vvar_event_spec.lua index eec8aa917a..eec8aa917a 100644 --- a/test/functional/eval/vvar_event_spec.lua +++ b/test/functional/vimscript/vvar_event_spec.lua diff --git a/test/functional/eval/wait_spec.lua b/test/functional/vimscript/wait_spec.lua index ee95e02a7f..ee95e02a7f 100644 --- a/test/functional/eval/wait_spec.lua +++ b/test/functional/vimscript/wait_spec.lua diff --git a/test/functional/eval/writefile_spec.lua b/test/functional/vimscript/writefile_spec.lua index 14be8c377c..14be8c377c 100644 --- a/test/functional/eval/writefile_spec.lua +++ b/test/functional/vimscript/writefile_spec.lua diff --git a/test/functional/visual/meta_key_spec.lua b/test/functional/visual/meta_key_spec.lua deleted file mode 100644 index 11f7203da0..0000000000 --- a/test/functional/visual/meta_key_spec.lua +++ /dev/null @@ -1,22 +0,0 @@ -local helpers = require('test.functional.helpers')(after_each) -local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert -local command = helpers.command -local expect = helpers.expect - -describe('meta-keys-in-visual-mode', function() - before_each(function() - clear() - end) - - it('ALT/META', function() - -- Unmapped ALT-chords behave as Esc+c - insert('peaches') - feed('viw<A-x>viw<M-x>') - expect('peach') - -- Mapped ALT-chord behaves as mapped. - command('vnoremap <M-l> Ameta-l<Esc>') - command('vnoremap <A-j> Aalt-j<Esc>') - feed('viw<A-j>viw<M-l>') - expect('peachalt-jmeta-l') - end) -end) |