diff --git a/src/Makefile b/src/Makefile index 36a43548af..295a85cb45 100644 --- a/src/Makefile +++ b/src/Makefile @@ -2109,25 +2109,23 @@ test1 \ test_autoformat_join \ test_changelist \ test_close_count \ - test_comparators \ test_erasebackword \ test_eval \ test_fixeol \ - test_getcwd \ test_insertcount \ test_listchars \ test_search_mbyte \ test_wordcount \ test3 test4 test5 test6 test7 test8 test9 \ test11 test12 test14 test15 test17 test18 test19 \ - test20 test21 test22 test23 test24 test25 test26 test27 test28 test29 \ + test20 test21 test22 test25 test27 test28 test29 \ test30 test31 test32 test33 test34 test36 test37 test38 test39 \ test40 test41 test42 test43 test44 test45 test48 test49 \ test50 test51 test52 test53 test54 test55 test56 test57 test59 \ - test60 test64 test66 test67 test68 test69 \ - test70 test72 test73 test74 test75 test77 test78 test79 \ + test60 test64 test66 test68 test69 \ + test70 test72 test73 test74 test77 test78 test79 \ test80 test83 test84 test85 test86 test87 test88 \ - test91 test94 test95 test97 test98 test99 \ + test91 test94 test95 test98 test99 \ test100 test101 test103 test104 test107 test108: cd testdir; rm -f $@.out; $(MAKE) -f Makefile $@.out VIMPROG=../$(VIMTARGET) $(GUI_TESTARG) SCRIPTSOURCE=../$(SCRIPTSOURCE) @@ -2151,6 +2149,7 @@ test_arglist \ test_clientserver \ test_cmdline \ test_command_count \ + test_comparators \ test_crypt \ test_cscope \ test_cursor_func \ @@ -2159,9 +2158,12 @@ test_arglist \ test_digraph \ test_display \ test_edit \ + test_escaped_glob \ test_ex_undo \ test_ex_z \ + test_exec_while_if \ test_execute_func \ + test_exists_autocmd \ test_expand \ test_expand_dllpath \ test_expr \ @@ -2180,6 +2182,7 @@ test_arglist \ test_fold \ test_functions \ test_ga \ + test_getcwd \ test_gf \ test_glob2regpat \ test_global \ @@ -2208,6 +2211,7 @@ test_arglist \ test_lua \ test_makeencoding \ test_man \ + test_maparg \ test_mapping \ test_marks \ test_match \ @@ -2226,6 +2230,7 @@ test_arglist \ test_partial \ test_paste \ test_perl \ + test_plus_arg_edit \ test_popup \ test_profile \ test_put \ @@ -2236,6 +2241,7 @@ test_arglist \ test_quickfix \ test_quotestar \ test_recover \ + test_regex_char_classes \ test_regexp_latin \ test_regexp_utf8 \ test_reltime \ @@ -3304,7 +3310,7 @@ objects/channel.o: channel.c Makefile: @echo The name of the makefile MUST be "Makefile" (with capital M)!!!! -CCCTERM = $(CCC) -Ilibvterm/include -DINLINE="" +CCCTERM = $(CCC) -Ilibvterm/include -DINLINE="" -DVSNPRINTF=vim_vsnprintf objects/term_encoding.o: libvterm/src/encoding.c $(TERM_DEPS) $(CCCTERM) -o $@ libvterm/src/encoding.c diff --git a/src/evalfunc.c b/src/evalfunc.c index 138e7db4d2..57923e6b64 100644 --- a/src/evalfunc.c +++ b/src/evalfunc.c @@ -8062,14 +8062,15 @@ f_printf(typval_T *argvars, typval_T *rettv) /* Get the required length, allocate the buffer and do it for real. */ did_emsg = FALSE; fmt = (char *)get_tv_string_buf(&argvars[0], buf); - len = vim_vsnprintf(NULL, 0, fmt, ap, argvars + 1); + len = vim_vsnprintf_typval(NULL, 0, fmt, ap, argvars + 1); if (!did_emsg) { s = alloc(len + 1); if (s != NULL) { rettv->vval.v_string = s; - (void)vim_vsnprintf((char *)s, len + 1, fmt, ap, argvars + 1); + (void)vim_vsnprintf_typval((char *)s, len + 1, fmt, + ap, argvars + 1); } } did_emsg |= saved_did_emsg; diff --git a/src/ex_cmds.c b/src/ex_cmds.c index 39f658a6e4..a69a05268d 100644 --- a/src/ex_cmds.c +++ b/src/ex_cmds.c @@ -3968,8 +3968,8 @@ do_ecmd( * We could instead free the synblock * and re-attach to buffer, perhaps. */ - if (curwin->w_buffer != NULL - && curwin->w_s == &(curwin->w_buffer->b_s)) + if (curwin->w_buffer == NULL + || curwin->w_s == &(curwin->w_buffer->b_s)) curwin->w_s = &(buf->b_s); #endif curwin->w_buffer = buf; diff --git a/src/ex_getln.c b/src/ex_getln.c index c5b616adc1..b770c64283 100644 --- a/src/ex_getln.c +++ b/src/ex_getln.c @@ -7056,7 +7056,13 @@ open_cmdwin(void) else ccline.cmdbuff = vim_strsave(ml_get_curline()); if (ccline.cmdbuff == NULL) + { + ccline.cmdbuff = vim_strsave((char_u *)""); + ccline.cmdlen = 0; + ccline.cmdbufflen = 1; + ccline.cmdpos = 0; cmdwin_result = Ctrl_C; + } else { ccline.cmdlen = (int)STRLEN(ccline.cmdbuff); diff --git a/src/libvterm/src/vterm.c b/src/libvterm/src/vterm.c index 8dca1b2563..2931e5202d 100644 --- a/src/libvterm/src/vterm.c +++ b/src/libvterm/src/vterm.c @@ -130,16 +130,42 @@ static int outbuffer_is_full(VTerm *vt) return vt->outbuffer_cur >= vt->outbuffer_len - 1; } +#if _XOPEN_SOURCE >= 500 || _ISOC99_SOURCE || _BSD_SOURCE +# undef VSNPRINTF +# define VSNPRINTF vsnprintf +#else +# ifdef VSNPRINTF +/* Use a provided vsnprintf() function. */ +int VSNPRINTF(char *str, size_t str_m, const char *fmt, va_list ap); +# endif +#endif + + INTERNAL void vterm_push_output_vsprintf(VTerm *vt, const char *format, va_list args) { int written; +#ifndef VSNPRINTF + /* When vsnprintf() is not available (C90) fall back to vsprintf(). */ char buffer[1024]; /* 1Kbyte is enough for everybody, right? */ +#endif if(outbuffer_is_full(vt)) { DEBUG_LOG("vterm_push_output(): buffer overflow; truncating output\n"); return; } +#ifdef VSNPRINTF + written = VSNPRINTF(vt->outbuffer + vt->outbuffer_cur, + vt->outbuffer_len - vt->outbuffer_cur, + format, args); + + if(written == (int)(vt->outbuffer_len - vt->outbuffer_cur)) { + /* output was truncated */ + vt->outbuffer_cur = vt->outbuffer_len - 1; + } + else + vt->outbuffer_cur += written; +#else written = vsprintf(buffer, format, args); if(written >= (int)(vt->outbuffer_len - vt->outbuffer_cur)) { @@ -151,6 +177,7 @@ INTERNAL void vterm_push_output_vsprintf(VTerm *vt, const char *format, va_list strncpy(vt->outbuffer + vt->outbuffer_cur, buffer, written + 1); vt->outbuffer_cur += written; } +#endif } INTERNAL void vterm_push_output_sprintf(VTerm *vt, const char *format, ...) diff --git a/src/message.c b/src/message.c index 5ccf4b78e2..96c22279f1 100644 --- a/src/message.c +++ b/src/message.c @@ -382,7 +382,7 @@ smsg(char_u *s, ...) va_list arglist; va_start(arglist, s); - vim_vsnprintf((char *)IObuff, IOSIZE, (char *)s, arglist, NULL); + vim_vsnprintf((char *)IObuff, IOSIZE, (char *)s, arglist); va_end(arglist); return msg(IObuff); } @@ -396,7 +396,7 @@ smsg_attr(int attr, char_u *s, ...) va_list arglist; va_start(arglist, s); - vim_vsnprintf((char *)IObuff, IOSIZE, (char *)s, arglist, NULL); + vim_vsnprintf((char *)IObuff, IOSIZE, (char *)s, arglist); va_end(arglist); return msg_attr(IObuff, attr); } @@ -4236,7 +4236,7 @@ infinity_str(int positive, /* * When va_list is not supported we only define vim_snprintf(). * - * vim_vsnprintf() can be invoked with either "va_list" or a list of + * vim_vsnprintf_typval() can be invoked with either "va_list" or a list of * "typval_T". When the latter is not used it must be NULL. */ @@ -4258,7 +4258,7 @@ vim_snprintf_add(char *str, size_t str_m, char *fmt, ...) else space = str_m - len; va_start(ap, fmt); - str_l = vim_vsnprintf(str + len, space, fmt, ap, NULL); + str_l = vim_vsnprintf(str + len, space, fmt, ap); va_end(ap); return str_l; } @@ -4270,13 +4270,23 @@ vim_snprintf(char *str, size_t str_m, char *fmt, ...) int str_l; va_start(ap, fmt); - str_l = vim_vsnprintf(str, str_m, fmt, ap, NULL); + str_l = vim_vsnprintf(str, str_m, fmt, ap); va_end(ap); return str_l; } int vim_vsnprintf( + char *str, + size_t str_m, + char *fmt, + va_list ap) +{ + return vim_vsnprintf_typval(str, str_m, fmt, ap, NULL); +} + + int +vim_vsnprintf_typval( char *str, size_t str_m, char *fmt, diff --git a/src/netbeans.c b/src/netbeans.c index 25a6ea0d7f..35bb1325ce 100644 --- a/src/netbeans.c +++ b/src/netbeans.c @@ -2301,7 +2301,7 @@ coloncmd(char *cmd, ...) va_list ap; va_start(ap, cmd); - vim_vsnprintf(buf, sizeof(buf), cmd, ap, NULL); + vim_vsnprintf(buf, sizeof(buf), cmd, ap); va_end(ap); nbdebug((" COLONCMD %s\n", buf)); diff --git a/src/proto.h b/src/proto.h index 22bb7bcd88..b9b08cb3f8 100644 --- a/src/proto.h +++ b/src/proto.h @@ -127,7 +127,8 @@ _RTLENTRYF # endif vim_snprintf(char *, size_t, char *, ...); -int vim_vsnprintf(char *str, size_t str_m, char *fmt, va_list ap, typval_T *tvs); +int vim_vsnprintf(char *str, size_t str_m, char *fmt, va_list ap); +int vim_vsnprintf_typval(char *str, size_t str_m, char *fmt, va_list ap, typval_T *tvs); # include "message.pro" # include "misc1.pro" diff --git a/src/testdir/Make_all.mak b/src/testdir/Make_all.mak index 9a3cafd372..217a295472 100644 --- a/src/testdir/Make_all.mak +++ b/src/testdir/Make_all.mak @@ -24,9 +24,6 @@ SCRIPTS_ALL = \ test19.out \ test20.out \ test22.out \ - test23.out \ - test24.out \ - test26.out \ test28.out \ test29.out \ test31.out \ @@ -51,12 +48,10 @@ SCRIPTS_ALL = \ test60.out \ test64.out \ test66.out \ - test67.out \ test68.out \ test69.out \ test70.out \ test73.out \ - test75.out \ test77.out \ test79.out \ test80.out \ @@ -75,11 +70,9 @@ SCRIPTS_ALL = \ test_autoformat_join.out \ test_changelist.out \ test_close_count.out \ - test_comparators.out \ test_erasebackword.out \ test_eval.out \ test_fixeol.out \ - test_getcwd.out \ test_insertcount.out \ test_listchars.out \ test_search_mbyte.out \ @@ -99,8 +92,7 @@ SCRIPTS_MORE1 = \ SCRIPTS_MORE2 = \ test12.out \ test25.out \ - test49.out \ - test97.out + test49.out # Tests that run on most systems, but not MingW and Cygwin. diff --git a/src/testdir/Make_ming.mak b/src/testdir/Make_ming.mak index dbf94f0559..31dfe702b7 100644 --- a/src/testdir/Make_ming.mak +++ b/src/testdir/Make_ming.mak @@ -69,7 +69,7 @@ fixff: -$(VIMPROG) -u dos.vim $(NO_INITS) "+argdo set ff=dos|upd" +q *.in *.ok -$(VIMPROG) -u dos.vim $(NO_INITS) "+argdo set ff=unix|upd" +q \ dotest.in test60.ok test_listchars.ok \ - test_getcwd.ok test_wordcount.ok + test_wordcount.ok clean: -@if exist *.out $(DEL) *.out diff --git a/src/testdir/Make_vms.mms b/src/testdir/Make_vms.mms index 5f124afc27..a85e98df9b 100644 --- a/src/testdir/Make_vms.mms +++ b/src/testdir/Make_vms.mms @@ -80,7 +80,6 @@ SCRIPT = test1.out test3.out test4.out test5.out \ test7.out test8.out test9.out \ test14.out test15.out \ test19.out test20.out test22.out \ - test23.out test24.out test26.out \ test28.out test29.out test30.out test31.out test32.out \ test33.out test34.out test36.out test37.out \ test38.out test39.out test40.out test41.out test42.out \ @@ -88,8 +87,8 @@ SCRIPT = test1.out test3.out test4.out test5.out \ test48.out test49.out test51.out test53.out test54.out \ test55.out test56.out test57.out test60.out \ test64.out \ - test66.out test67.out test68.out test69.out \ - test72.out test75.out \ + test66.out test68.out test69.out \ + test72.out \ test77a.out test78.out test79.out test80.out \ test84.out test88.out \ test91.out test94.out \ @@ -101,11 +100,9 @@ SCRIPT = test1.out test3.out test4.out test5.out \ test_breakindent.out \ test_changelist.out \ test_close_count.out \ - test_comparators.out \ test_erasebackword.out \ test_eval.out \ test_fixeol.out \ - test_getcwd.out \ test_insertcount.out \ test_listchars.out \ test_listlbr.out \ @@ -131,7 +128,7 @@ SCRIPT = test1.out test3.out test4.out test5.out \ # test83: ? # test85: no Lua interface # test89: bug - findfile() does not work on VMS (just in the current directory) -# test97, test102: Just ODS-5 supports space and special chars in the filename. +# test102: Just ODS-5 supports space and special chars in the filename. # On ODS-2 tests fail. .IFDEF WANT_GUI @@ -156,7 +153,7 @@ SCRIPT_MZSCH = test70.out .ENDIF .IFDEF HAVE_ODS5 -SCRIPT_ODS5 = test97.out test102.out +SCRIPT_ODS5 = test102.out .ENDIF .IFDEF HAVE_GZIP diff --git a/src/testdir/main.aap b/src/testdir/main.aap index 821aa2d94a..93159ba20d 100644 --- a/src/testdir/main.aap +++ b/src/testdir/main.aap @@ -8,7 +8,7 @@ Scripts = test1.out test2.out test3.out test4.out test5.out test6.out test7.out test8.out test9.out test11.out test12.out test13.out test14.out test15.out test17.out test18.out test19.out test20.out test21.out test22.out - test23.out test24.out test25.out test26.out test27.out + test25.out test27.out test28.out test29.out test30.out test31.out test32.out test33.out test34.out test36.out test37.out test38.out test39.out test40.out test41.out test42.out diff --git a/src/testdir/test23.in b/src/testdir/test23.in deleted file mode 100644 index 0e0e605531..0000000000 --- a/src/testdir/test23.in +++ /dev/null @@ -1,15 +0,0 @@ -Tests for complicated + argument to :edit command - -STARTTEST -:$-1w! Xfile1 -:$w! Xfile2 -:edit +1|s/|/PIPE/|w Xfile1| e Xfile2|1 | s/\//SLASH/|w -:w! test.out -:e Xfile1 -:w >> test.out -:qa! -ENDTEST - -The result should be in Xfile1: "fooPIPEbar", in Xfile2: "fooSLASHbar" -foo|bar -foo/bar diff --git a/src/testdir/test23.ok b/src/testdir/test23.ok deleted file mode 100644 index f1930abad6..0000000000 --- a/src/testdir/test23.ok +++ /dev/null @@ -1,2 +0,0 @@ -fooSLASHbar -fooPIPEbar diff --git a/src/testdir/test24.in b/src/testdir/test24.in deleted file mode 100644 index 7dfc1afdc6..0000000000 Binary files a/src/testdir/test24.in and /dev/null differ diff --git a/src/testdir/test24.ok b/src/testdir/test24.ok deleted file mode 100644 index cd61210968..0000000000 --- a/src/testdir/test24.ok +++ /dev/null @@ -1,32 +0,0 @@ -start -test text test text -test text test text -test text test text -test text test text -test text test text -test text test text -test text test text x61 -test text test text x60-x64 -test text test text x78 5 -test text test text o143 -test text test text o140-o144 -test text test text o41 7 -test text test text \%x42 -test text test text \%o103 -test text test text [\x00] -test text test text [\x00-\x10] -test text test text [\x-z] -test text test text [\u-z] -xx xx a -xx aaaaa xx a -xx aaaaa xx a -xx Aaa xx -xx Aaaa xx -xx Aaa xx -xx foobar xA xx -xx an A xx -XX 9; -YY 77; - xyz - bcd - BB diff --git a/src/testdir/test26.in b/src/testdir/test26.in deleted file mode 100644 index e7cd757661..0000000000 --- a/src/testdir/test26.in +++ /dev/null @@ -1,44 +0,0 @@ -Test for :execute, :while and :if - -STARTTEST -:so small.vim -mt:let i = 0 -:while i < 12 -: let i = i + 1 -: if has("ebcdic") -: execute "normal o" . i . "\047" -: else -: execute "normal o" . i . "\033" -: endif -: if i % 2 -: normal Ax -: if i == 9 -: break -: endif -: if i == 5 -: continue -: else -: let j = 9 -: while j > 0 -: if has("ebcdic") -: execute "normal" j . "a" . j . "\x27" -: else -: execute "normal" j . "a" . j . "\x1b" -: endif -: let j = j - 1 -: endwhile -: endif -: endif -: if i == 9 -: if has("ebcdic") -: execute "normal Az\047" -: else -: execute "normal Az\033" -: endif -: endif -:endwhile -:unlet i j -:'t,$w! test.out -:qa! -ENDTEST - diff --git a/src/testdir/test26.ok b/src/testdir/test26.ok deleted file mode 100644 index bc44761187..0000000000 --- a/src/testdir/test26.ok +++ /dev/null @@ -1,10 +0,0 @@ - -1x999999999888888887777777666666555554444333221 -2 -3x999999999888888887777777666666555554444333221 -4 -5x -6 -7x999999999888888887777777666666555554444333221 -8 -9x diff --git a/src/testdir/test67.in b/src/testdir/test67.in deleted file mode 100644 index e40cbabd6f..0000000000 --- a/src/testdir/test67.in +++ /dev/null @@ -1,33 +0,0 @@ -Test that groups and patterns are tested correctly when calling exists() for -autocommands. - -STARTTEST -:so small.vim -:let results=[] -:augroup auexists -:augroup END -:call add(results, "##BufEnter: " . exists("##BufEnter")) -:call add(results, "#BufEnter: " . exists("#BufEnter")) -:au BufEnter * let g:entered=1 -:call add(results, "#BufEnter: " . exists("#BufEnter")) -:call add(results, "#auexists#BufEnter: " . exists("#auexists#BufEnter")) -:augroup auexists -:au BufEnter * let g:entered=1 -:augroup END -:call add(results, "#auexists#BufEnter: " . exists("#auexists#BufEnter")) -:call add(results, "#BufEnter#*.test: " . exists("#BufEnter#*.test")) -:au BufEnter *.test let g:entered=1 -:call add(results, "#BufEnter#*.test: " . exists("#BufEnter#*.test")) -:edit testfile.test -:call add(results, "#BufEnter#: " . exists("#BufEnter#")) -:au BufEnter let g:entered=1 -:call add(results, "#BufEnter#: " . exists("#BufEnter#")) -:edit testfile2.test -:call add(results, "#BufEnter#: " . exists("#BufEnter#")) -:e! test.out -:call append(0, results) -:$d -:w -:qa! -ENDTEST - diff --git a/src/testdir/test67.ok b/src/testdir/test67.ok deleted file mode 100644 index 51188e5afd..0000000000 --- a/src/testdir/test67.ok +++ /dev/null @@ -1,10 +0,0 @@ -##BufEnter: 1 -#BufEnter: 0 -#BufEnter: 1 -#auexists#BufEnter: 0 -#auexists#BufEnter: 1 -#BufEnter#*.test: 0 -#BufEnter#*.test: 1 -#BufEnter#: 0 -#BufEnter#: 1 -#BufEnter#: 0 diff --git a/src/testdir/test75.in b/src/testdir/test75.in deleted file mode 100644 index 8fabccdf52..0000000000 --- a/src/testdir/test75.in +++ /dev/null @@ -1,41 +0,0 @@ -Tests for maparg(). -Also test utf8 map with a 0x80 byte. - -STARTTEST -:so small.vim -:so mbyte.vim -:set cpo-=< -:set encoding=utf8 -:" Test maparg() with a string result -:map foo isfoo -:vnoremap