diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/ex_docmd.c | 8 | ||||
-rw-r--r-- | src/nvim/path.c | 7 | ||||
-rw-r--r-- | src/nvim/testdir/Makefile | 19 | ||||
-rw-r--r-- | src/nvim/testdir/runtest.vim | 8 | ||||
-rw-r--r-- | src/nvim/testdir/shared.vim | 8 | ||||
-rw-r--r-- | src/nvim/testdir/test42.in | bin | 2354 -> 2438 bytes | |||
-rw-r--r-- | src/nvim/testdir/test52.in | 64 | ||||
-rw-r--r-- | src/nvim/testdir/test52.ok | 18 | ||||
-rw-r--r-- | src/nvim/testdir/test_functions.vim | 2 | ||||
-rw-r--r-- | src/nvim/testdir/test_increment_dbcs.vim | 4 | ||||
-rw-r--r-- | src/nvim/testdir/test_mksession.vim | 5 | ||||
-rw-r--r-- | src/nvim/testdir/test_undo.vim | 5 | ||||
-rw-r--r-- | src/nvim/testdir/test_window_cmd.vim | 19 |
13 files changed, 66 insertions, 101 deletions
diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c index 18043bf710..247f4c09ef 100644 --- a/src/nvim/ex_docmd.c +++ b/src/nvim/ex_docmd.c @@ -8432,13 +8432,15 @@ static void ex_pedit(exarg_T *eap) { win_T *curwin_save = curwin; + // Open the preview window or popup and make it the current window. g_do_tagpreview = p_pvh; prepare_tagpreview(true); - keep_help_flag = bt_help(curwin_save->w_buffer); + + // Edit the file. do_exedit(eap, NULL); - keep_help_flag = FALSE; + if (curwin != curwin_save && win_valid(curwin_save)) { - /* Return cursor to where we were */ + // Return cursor to where we were validate_cursor(); redraw_later(VALID); win_enter(curwin_save, true); diff --git a/src/nvim/path.c b/src/nvim/path.c index 75a26d88c1..a58d57d566 100644 --- a/src/nvim/path.c +++ b/src/nvim/path.c @@ -852,8 +852,13 @@ static char_u *get_path_cutoff(char_u *fname, garray_T *gap) int j = 0; while ((fname[j] == path_part[i][j] - ) && fname[j] != NUL && path_part[i][j] != NUL) +#ifdef WIN32 + || (vim_ispathsep(fname[j]) && vim_ispathsep(path_part[i][j])) +#endif + ) // NOLINT(whitespace/parens) + && fname[j] != NUL && path_part[i][j] != NUL) { j++; + } if (j > maxlen) { maxlen = j; cutoff = &fname[j]; diff --git a/src/nvim/testdir/Makefile b/src/nvim/testdir/Makefile index 8b43d91e25..b72f55730f 100644 --- a/src/nvim/testdir/Makefile +++ b/src/nvim/testdir/Makefile @@ -16,7 +16,6 @@ export TMPDIR := $(abspath ../../../Xtest-tmpdir) SCRIPTS_DEFAULT = \ test42.out \ test48.out \ - test52.out \ test64.out \ ifneq ($(OS),Windows_NT) @@ -25,6 +24,12 @@ ifneq ($(OS),Windows_NT) endif +ifeq ($(OS),Windows_NT) + FIXFF = fixff +else + FIXFF = +endif + SCRIPTS ?= $(SCRIPTS_DEFAULT) # Tests using runtest.vim. @@ -74,7 +79,7 @@ ifdef TESTNUM SCRIPTS := test$(TESTNUM).out endif -nongui: nolog $(SCRIPTS) newtests report +nongui: nolog $(FIXFF) $(SCRIPTS) newtests report .gdbinit: @echo "[OLDTEST-PREP] Setting up .gdbinit" @@ -95,6 +100,16 @@ test1.out: $(NVIM_PRG) $(SCRIPTS): $(NVIM_PRG) test1.out +NO_PLUGINS = --noplugin --headless +NO_INITS = -U NONE $(NO_PLUGINS) + +# TODO: find a way to avoid changing the distributed files. +fixff: + -$(NVIM_PRG) -u unix.vim $(NO_INITS) "+argdo set ff=dos|upd" +q \ + *.in *.ok + -$(NVIM_PRG) -u unix.vim $(NO_INITS) "+argdo set ff=dos|upd" +q \ + dotest.in + RM_ON_RUN := test.out X* viminfo RM_ON_START := test.ok RUN_VIM := $(TOOL) $(NVIM_PRG) -u unix.vim -U NONE -i viminfo --headless --noplugin -s dotest.in diff --git a/src/nvim/testdir/runtest.vim b/src/nvim/testdir/runtest.vim index 4eddad8ad5..8b949d434e 100644 --- a/src/nvim/testdir/runtest.vim +++ b/src/nvim/testdir/runtest.vim @@ -31,12 +31,14 @@ " Check that the screen size is at least 24 x 80 characters. if &lines < 24 || &columns < 80 - let error = 'Screen size too small! Tests require at least 24 lines with 80 characters' + let error = 'Screen size too small! Tests require at least 24 lines with 80 characters, got ' .. &lines .. ' lines with ' .. &columns .. ' characters' echoerr error split test.log $put =error write split messages + call append(line('$'), '') + call append(line('$'), 'From ' . expand('%') . ':') call append(line('$'), error) write qa! @@ -77,7 +79,7 @@ set nomore lang mess C " Always use forward slashes. -" set shellslash +set shellslash " Prepare for calling test_garbagecollect_now(). let v:testing = 1 @@ -161,7 +163,7 @@ func RunTheTest(test) endtry endif - " Clear any autocommands + " Clear any autocommands and put back the catch-all for SwapExists. au! au SwapExists * call HandleSwapExists() diff --git a/src/nvim/testdir/shared.vim b/src/nvim/testdir/shared.vim index ab0a4fd706..bcd6d021a0 100644 --- a/src/nvim/testdir/shared.vim +++ b/src/nvim/testdir/shared.vim @@ -202,9 +202,13 @@ endfunc func GetVimProg() if empty($NVIM_TEST_ARG0) " Assume the script was sourced instead of running "make". - return '../../../build/bin/nvim' + return v:progpath + endif + if has('win32') + return substitute($NVIM_TEST_ARG0, '/', '\\', 'g') + else + return $NVIM_TEST_ARG0 endif - return $NVIM_TEST_ARG0 endfunc " Get the command to run Vim, with -u NONE and --headless arguments. diff --git a/src/nvim/testdir/test42.in b/src/nvim/testdir/test42.in Binary files differindex 0ea0198d12..baa6e67d26 100644 --- a/src/nvim/testdir/test42.in +++ b/src/nvim/testdir/test42.in diff --git a/src/nvim/testdir/test52.in b/src/nvim/testdir/test52.in deleted file mode 100644 index fa75129193..0000000000 --- a/src/nvim/testdir/test52.in +++ /dev/null @@ -1,64 +0,0 @@ -Tests for reading and writing files with conversion for Win32. - -STARTTEST -:" make this a dummy test for non-Win32 systems -:if !has("win32") | e! test.ok | wq! test.out | endif -:" -:" write tests: -:" combine three values for 'encoding' with three values for 'fileencoding' -:" also write files for read tests -/^1 -:set encoding=utf-8 -:.w! ++enc=utf-8 test.out -:.w ++enc=cp1251 >>test.out -:.w ++enc=cp866 >>test.out -:.w! ++enc=utf-8 Xutf8 -/^2 -:set encoding=cp1251 -:.w ++enc=utf-8 >>test.out -:.w ++enc=cp1251 >>test.out -:.w ++enc=cp866 >>test.out -:.w! ++enc=cp1251 Xcp1251 -/^3 -:set encoding=cp866 -:.w ++enc=utf-8 >>test.out -:.w ++enc=cp1251 >>test.out -:.w ++enc=cp866 >>test.out -:.w! ++enc=cp866 Xcp866 -:" -:" read three 'fileencoding's with utf-8 'encoding' -:set encoding=utf-8 fencs=utf-8,cp1251 -:e Xutf8 -:.w ++enc=utf-8 >>test.out -:e Xcp1251 -:.w ++enc=utf-8 >>test.out -:set fencs=utf-8,cp866 -:e Xcp866 -:.w ++enc=utf-8 >>test.out -:" -:" read three 'fileencoding's with cp1251 'encoding' -:set encoding=utf-8 fencs=utf-8,cp1251 -:e Xutf8 -:.w ++enc=cp1251 >>test.out -:e Xcp1251 -:.w ++enc=cp1251 >>test.out -:set fencs=utf-8,cp866 -:e Xcp866 -:.w ++enc=cp1251 >>test.out -:" -:" read three 'fileencoding's with cp866 'encoding' -:set encoding=cp866 fencs=utf-8,cp1251 -:e Xutf8 -:.w ++enc=cp866 >>test.out -:e Xcp1251 -:.w ++enc=cp866 >>test.out -:set fencs=utf-8,cp866 -:e Xcp866 -:.w ++enc=cp866 >>test.out -:" -:qa! -ENDTEST - -1 utf-8 text: Для Vim version 6.2. Последнее изменение: 1970 Jan 01 -2 cp1251 text: Vim version 6.2. : 1970 Jan 01 -3 cp866 text: Vim version 6.2. : 1970 Jan 01 diff --git a/src/nvim/testdir/test52.ok b/src/nvim/testdir/test52.ok deleted file mode 100644 index 90b516508d..0000000000 --- a/src/nvim/testdir/test52.ok +++ /dev/null @@ -1,18 +0,0 @@ -1 utf-8 text: Для Vim version 6.2. Последнее изменение: 1970 Jan 01 -1 utf-8 text: Vim version 6.2. : 1970 Jan 01 -1 utf-8 text: Vim version 6.2. : 1970 Jan 01 -2 cp1251 text: Для Vim version 6.2. Последнее изменение: 1970 Jan 01 -2 cp1251 text: Vim version 6.2. : 1970 Jan 01 -2 cp1251 text: Vim version 6.2. : 1970 Jan 01 -3 cp866 text: Для Vim version 6.2. Последнее изменение: 1970 Jan 01 -3 cp866 text: Vim version 6.2. : 1970 Jan 01 -3 cp866 text: Vim version 6.2. : 1970 Jan 01 -1 utf-8 text: Для Vim version 6.2. Последнее изменение: 1970 Jan 01 -2 cp1251 text: Для Vim version 6.2. Последнее изменение: 1970 Jan 01 -3 cp866 text: Для Vim version 6.2. Последнее изменение: 1970 Jan 01 -1 utf-8 text: Vim version 6.2. : 1970 Jan 01 -2 cp1251 text: Vim version 6.2. : 1970 Jan 01 -3 cp866 text: Vim version 6.2. : 1970 Jan 01 -1 utf-8 text: Vim version 6.2. : 1970 Jan 01 -2 cp1251 text: Vim version 6.2. : 1970 Jan 01 -3 cp866 text: Vim version 6.2. : 1970 Jan 01 diff --git a/src/nvim/testdir/test_functions.vim b/src/nvim/testdir/test_functions.vim index fab1d7790d..b03abb5b34 100644 --- a/src/nvim/testdir/test_functions.vim +++ b/src/nvim/testdir/test_functions.vim @@ -1170,6 +1170,8 @@ func Test_libcall_libcallnr() else let libc = '/usr/lib/libc.so' endif + elseif system('uname -s') =~ 'OpenBSD' + let libc = 'libc.so' else " On Unix, libc.so can be in various places. " Interestingly, using an empty string for the 1st argument of libcall diff --git a/src/nvim/testdir/test_increment_dbcs.vim b/src/nvim/testdir/test_increment_dbcs.vim index 474a16feeb..e5d5ccffb3 100644 --- a/src/nvim/testdir/test_increment_dbcs.vim +++ b/src/nvim/testdir/test_increment_dbcs.vim @@ -1,5 +1,7 @@ " Tests for using Ctrl-A/Ctrl-X using DBCS. -if !has('multi_byte') +" neovim needs an iconv to handle cp932. Please do not remove the following +" conditions. +if !has('iconv') finish endif scriptencoding cp932 diff --git a/src/nvim/testdir/test_mksession.vim b/src/nvim/testdir/test_mksession.vim index d77dac69c7..4e6d96ee48 100644 --- a/src/nvim/testdir/test_mksession.vim +++ b/src/nvim/testdir/test_mksession.vim @@ -206,11 +206,10 @@ func Test_mkview_loadview_with_viewdir() " The directory Xviewdir/ should have been created and the view " should be stored in that directory. - let pathsep = has('win32') ? '\' : '/' - call assert_equal('Xviewdir' . pathsep . + call assert_equal('Xviewdir/' . \ substitute( \ substitute( - \ expand('%:p'), pathsep, '=+', 'g'), ':', '=-', 'g') . '=1.vim', + \ expand('%:p'), '/', '=+', 'g'), ':', '=-', 'g') . '=1.vim', \ glob('Xviewdir/*')) call assert_equal(1, &number) call assert_match('\*:mkview\*$', getline('.')) diff --git a/src/nvim/testdir/test_undo.vim b/src/nvim/testdir/test_undo.vim index 0cb5dc4033..86674889ef 100644 --- a/src/nvim/testdir/test_undo.vim +++ b/src/nvim/testdir/test_undo.vim @@ -376,10 +376,9 @@ funct Test_undofile() " Replace windows drive such as C:... into C%... let cwd = substitute(cwd, '^\([a-zA-Z]\):', '\1%', 'g') endif - let pathsep = has('win32') ? '\' : '/' - let cwd = substitute(cwd . pathsep . 'Xundofoo', pathsep, '%', 'g') + let cwd = substitute(cwd . '/Xundofoo', '/', '%', 'g') if has('persistent_undo') - call assert_equal('Xundodir' . pathsep . cwd, undofile('Xundofoo')) + call assert_equal('Xundodir/' . cwd, undofile('Xundofoo')) else call assert_equal('', undofile('Xundofoo')) endif diff --git a/src/nvim/testdir/test_window_cmd.vim b/src/nvim/testdir/test_window_cmd.vim index 2a07a04401..c87c0a0af4 100644 --- a/src/nvim/testdir/test_window_cmd.vim +++ b/src/nvim/testdir/test_window_cmd.vim @@ -42,6 +42,8 @@ function Test_window_cmd_wincmd_gf() function s:swap_exists() let v:swapchoice = s:swap_choice endfunc + " Remove the catch-all that runtest.vim adds + au! SwapExists augroup test_window_cmd_wincmd_gf autocmd! exec "autocmd SwapExists " . fname . " call s:swap_exists()" @@ -144,6 +146,21 @@ func Test_window_preview() call assert_fails('wincmd P', 'E441:') endfunc +func Test_window_preview_from_help() + filetype on + call writefile(['/* some C code */'], 'Xpreview.c') + help + pedit Xpreview.c + wincmd P + call assert_equal(1, &previewwindow) + call assert_equal('c', &filetype) + wincmd z + + filetype off + close + call delete('Xpreview.c') +endfunc + func Test_window_exchange() e Xa @@ -519,6 +536,7 @@ func Test_winrestcmd() endfunc function! Fun_RenewFile() + " Need to wait a bit for the timestamp to be older. sleep 2 silent execute '!echo "1" > tmp.txt' sp @@ -536,7 +554,6 @@ func Test_window_prevwin() call writefile(['2'], 'tmp.txt') new tmp.txt q - " Need to wait a bit for the timestamp to be older. call Fun_RenewFile() call assert_equal(2, winnr()) wincmd p |