diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/api/vim.c | 4 | ||||
-rw-r--r-- | src/nvim/ex_cmds2.c | 1 | ||||
-rw-r--r-- | src/nvim/memory.c | 4 | ||||
-rw-r--r-- | src/nvim/screen.c | 2 | ||||
-rw-r--r-- | src/nvim/testdir/Makefile | 114 | ||||
-rw-r--r-- | src/nvim/testdir/test_normal.vim | 80 |
6 files changed, 101 insertions, 104 deletions
diff --git a/src/nvim/api/vim.c b/src/nvim/api/vim.c index 1ffae8ef43..e78b8c776d 100644 --- a/src/nvim/api/vim.c +++ b/src/nvim/api/vim.c @@ -1083,7 +1083,7 @@ void nvim_set_client_info(uint64_t channel_id, String name, /// - "buffer" buffer with connected |terminal| instance (optional) /// - "client" information about the client on the other end of the /// RPC channel, if it has added it using -/// |nvim_set_client_info|. (optional) +/// |nvim_set_client_info()|. (optional) /// Dictionary nvim_get_chan_info(Integer chan, Error *err) FUNC_API_SINCE(4) @@ -1097,7 +1097,7 @@ Dictionary nvim_get_chan_info(Integer chan, Error *err) /// Get information about all open channels. /// /// @returns Array of Dictionaries, each describing a channel with -/// the format specified at |nvim_get_chan_info|. +/// the format specified at |nvim_get_chan_info()|. Array nvim_list_chans(void) FUNC_API_SINCE(4) { diff --git a/src/nvim/ex_cmds2.c b/src/nvim/ex_cmds2.c index c384d253b9..ab24b63110 100644 --- a/src/nvim/ex_cmds2.c +++ b/src/nvim/ex_cmds2.c @@ -2728,6 +2728,7 @@ void ex_packadd(exarg_T *eap) /// ":options" void ex_options(exarg_T *eap) { + vim_setenv("OPTWIN_CMD", cmdmod.tab ? "tab" : ""); cmd_source((char_u *)SYS_OPTWIN_FILE, NULL); } diff --git a/src/nvim/memory.c b/src/nvim/memory.c index d3d0968a5c..8789075c44 100644 --- a/src/nvim/memory.c +++ b/src/nvim/memory.c @@ -619,7 +619,6 @@ void free_all_mem(void) /* Obviously named calls. */ free_all_autocmds(); - free_all_options(); free_all_marks(); alist_clear(&global_alist); free_homedir(); @@ -657,6 +656,9 @@ void free_all_mem(void) /* Destroy all windows. Must come before freeing buffers. */ win_free_all(); + // Free all option values. Must come after closing windows. + free_all_options(); + free_cmdline_buf(); /* Clear registers. */ diff --git a/src/nvim/screen.c b/src/nvim/screen.c index 36901e92ee..6b75902f87 100644 --- a/src/nvim/screen.c +++ b/src/nvim/screen.c @@ -149,7 +149,7 @@ void redraw_later(int type) void redraw_win_later(win_T *wp, int type) { - if (wp->w_redr_type < type) { + if (!exiting && wp->w_redr_type < type) { wp->w_redr_type = type; if (type >= NOT_VALID) wp->w_lines_valid = 0; diff --git a/src/nvim/testdir/Makefile b/src/nvim/testdir/Makefile index 31082f3a37..10cbd91e36 100644 --- a/src/nvim/testdir/Makefile +++ b/src/nvim/testdir/Makefile @@ -32,101 +32,24 @@ endif SCRIPTS ?= $(SCRIPTS_DEFAULT) # Tests using runtest.vim. -# Keep test_alot*.res as the last one, sort the others. -NEW_TESTS ?= \ - test_arabic.res \ - test_autocmd.res \ - test_blockedit.res \ - test_bufwintabinfo.res \ - test_changedtick.res \ - test_charsearch.res \ - test_cindent.res \ - test_clientserver.res \ - test_close_count.res \ - test_cmdline.res \ - test_command_count.res \ - test_cscope.res \ - test_curswant.res \ - test_digraph.res \ - test_edit.res \ - test_erasebackword.res \ - test_exists.res \ - test_diffmode.res \ - test_farsi.res \ - test_file_size.res \ - test_filter_map.res \ - test_find_complete.res \ - test_fixeol.res \ - test_findfile.res \ - test_fnameescape.res \ - test_fold.res \ - test_ga.res \ - test_getvar.res \ - test_glob2regpat.res \ - test_gf.res \ - test_gn.res \ - test_hardcopy.res \ - test_help_tagjump.res \ - test_hide.res \ - test_highlight.res \ - test_history.res \ - test_hlsearch.res \ - test_increment.res \ - test_increment_dbcs.res \ - test_ins_complete.res \ - test_lambda.res \ - test_langmap.res \ - test_let.res \ - test_lineending.res \ - test_listdict.res \ - test_listchars.res \ - test_makeencoding.res \ - test_marks.res \ - test_match.res \ - test_matchadd_conceal.res \ - test_mksession.res \ - test_nested_function.res \ - test_normal.res \ - test_number.res \ - test_options.res \ - test_preview.res \ - test_profile.res \ - test_put.res \ - test_python2.res \ - test_python3.res \ - test_quickfix.res \ - test_quotestar.res \ - test_recover.res \ - test_registers.res \ - test_retab.res \ - test_scrollbind.res \ - test_search.res \ - test_signs.res \ - test_smartindent.res \ - test_spell.res \ - test_stat.res \ - test_startup.res \ - test_substitute.res \ - test_swap.res \ - test_syntax.res \ - test_system.res \ - test_tab.res \ - test_tabpage.res \ - test_textobjects.res \ - test_timers.res \ - test_undo.res \ - test_usercommands.res \ - test_user_func.res \ - test_vimscript.res \ - test_visual.res \ - test_winbuf_close.res \ - test_window_id.res \ - test_windows_home.res \ - test_wordcount.res \ - test_writefile.res \ - test_alot_latin.res \ - test_alot_utf8.res \ - test_alot.res +NEW_TESTS_ALOT := test_alot_utf8 test_alot +NEW_TESTS_IN_ALOT := $(shell sed '/^source/ s/^source //;s/\.vim$$//' test_alot*.vim) +# Ignored tests. +# test_alot_latin1: Nvim does not allow setting encoding. +# test_arglist: ported to Lua, but kept for easier merging. +# test_autochdir: ported to Lua, but kept for easier merging. +# test_eval_func: used as include in old-style test (test_eval.in). +# test_listlbr: Nvim does not allow setting encoding. +# test_largefile: uses too much resources to run on CI. +NEW_TESTS_IGNORE := $(NEW_TESTS_IN_ALOT) $(NEW_TESTS_ALOT) \ + test_alot_latin \ + test_arglist \ + test_autochdir \ + test_eval_func \ + test_listlbr \ + test_largefile \ + +NEW_TESTS = $(addsuffix .res,$(sort $(filter-out $(NEW_TESTS_IGNORE),$(basename $(notdir $(wildcard test_*.vim))))) $(NEW_TESTS_ALOT)) SCRIPTS_GUI := test16.out @@ -220,6 +143,7 @@ test1.out: .gdbinit test1.in @/bin/sh runnvim.sh --oldesttest $(ROOT) $(NVIM_PRG) $* $(RUN_VIM) $*.in @rm -rf X* test.ok viminfo +# Explicit dependencies. test49.out: test49.vim nolog: diff --git a/src/nvim/testdir/test_normal.vim b/src/nvim/testdir/test_normal.vim index 3ff1e98caf..d07b3fdbce 100644 --- a/src/nvim/testdir/test_normal.vim +++ b/src/nvim/testdir/test_normal.vim @@ -1830,11 +1830,6 @@ fun! Test_normal33_g_cmd2() call assert_equal(15, col('.')) call assert_equal('l', getreg(0)) - " Test for g Ctrl-G - set ff=unix - let a=execute(":norm! g\<c-g>") - call assert_match('Col 15 of 43; Line 2 of 2; Word 2 of 2; Byte 16 of 45', a) - " Test for gI norm! gIfoo call assert_equal(['', 'fooabcdefghijk lmno0123456789AMNOPQRSTUVWXYZ'], getline(1,'$')) @@ -1853,6 +1848,81 @@ fun! Test_normal33_g_cmd2() bw! endfunc +func! Test_g_ctrl_g() + new + + let a = execute(":norm! g\<c-g>") + call assert_equal("\n--No lines in buffer--", a) + + call setline(1, ['first line', 'second line']) + + " Test g CTRL-g with dos, mac and unix file type. + norm! gojll + set ff=dos + let a = execute(":norm! g\<c-g>") + call assert_equal("\nCol 3 of 11; Line 2 of 2; Word 3 of 4; Byte 15 of 25", a) + + set ff=mac + let a = execute(":norm! g\<c-g>") + call assert_equal("\nCol 3 of 11; Line 2 of 2; Word 3 of 4; Byte 14 of 23", a) + + set ff=unix + let a = execute(":norm! g\<c-g>") + call assert_equal("\nCol 3 of 11; Line 2 of 2; Word 3 of 4; Byte 14 of 23", a) + + " Test g CTRL-g in visual mode (v) + let a = execute(":norm! gojllvlg\<c-g>") + call assert_equal("\nSelected 1 of 2 Lines; 1 of 4 Words; 2 of 23 Bytes", a) + + " Test g CTRL-g in visual mode (CTRL-V) with end col > start col + let a = execute(":norm! \<Esc>gojll\<C-V>kllg\<c-g>") + call assert_equal("\nSelected 3 Cols; 2 of 2 Lines; 2 of 4 Words; 6 of 23 Bytes", a) + + " Test g_CTRL-g in visual mode (CTRL-V) with end col < start col + let a = execute(":norm! \<Esc>goll\<C-V>jhhg\<c-g>") + call assert_equal("\nSelected 3 Cols; 2 of 2 Lines; 2 of 4 Words; 6 of 23 Bytes", a) + + " Test g CTRL-g in visual mode (CTRL-V) with end_vcol being MAXCOL + let a = execute(":norm! \<Esc>gojll\<C-V>k$g\<c-g>") + call assert_equal("\nSelected 2 of 2 Lines; 4 of 4 Words; 17 of 23 Bytes", a) + + " There should be one byte less with noeol + set bin noeol + let a = execute(":norm! \<Esc>gog\<c-g>") + call assert_equal("\nCol 1 of 10; Line 1 of 2; Word 1 of 4; Char 1 of 23; Byte 1 of 22", a) + set bin & eol& + + if has('multi_byte') + call setline(1, ['Français', '日本語']) + + let a = execute(":norm! \<Esc>gojlg\<c-g>") + call assert_equal("\nCol 4-3 of 9-6; Line 2 of 2; Word 2 of 2; Char 11 of 13; Byte 16 of 20", a) + + let a = execute(":norm! \<Esc>gojvlg\<c-g>") + call assert_equal("\nSelected 1 of 2 Lines; 1 of 2 Words; 2 of 13 Chars; 6 of 20 Bytes", a) + + let a = execute(":norm! \<Esc>goll\<c-v>jlg\<c-g>") + call assert_equal("\nSelected 4 Cols; 2 of 2 Lines; 2 of 2 Words; 6 of 13 Chars; 11 of 20 Bytes", a) + + set fenc=utf8 bomb + let a = execute(":norm! \<Esc>gojlg\<c-g>") + call assert_equal("\nCol 4-3 of 9-6; Line 2 of 2; Word 2 of 2; Char 11 of 13; Byte 16 of 20(+3 for BOM)", a) + + set fenc=utf16 bomb + let a = execute(":norm! g\<c-g>") + call assert_equal("\nCol 4-3 of 9-6; Line 2 of 2; Word 2 of 2; Char 11 of 13; Byte 16 of 20(+2 for BOM)", a) + + set fenc=utf32 bomb + let a = execute(":norm! g\<c-g>") + call assert_equal("\nCol 4-3 of 9-6; Line 2 of 2; Word 2 of 2; Char 11 of 13; Byte 16 of 20(+4 for BOM)", a) + + set fenc& bomb& + endif + + set ff& + bwipe! +endfunc + fun! Test_normal34_g_cmd3() if !has("multi_byte") return |