To: vim_dev@googlegroups.com Subject: Patch 8.0.1242 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.0.1242 Problem: Function argument with only dash is seen as number zero. (Wang Shidong) Solution: See a dash as a string. (Christian Brabandt) Files: src/testdir/test_ins_complete.vim, src/Makefile, src/eval.c *** ../vim-8.0.1241/src/testdir/test_ins_complete.vim 2017-10-27 00:54:59.146125099 +0200 --- src/testdir/test_ins_complete.vim 2017-11-02 15:31:38.742384431 +0100 *************** *** 90,92 **** --- 90,111 ---- call delete('Xtestdata') set cpt& cot& def& tags& tagbsearch& hidden& endfunc + + func Test_omni_dash() + func Omni(findstart, base) + if a:findstart + return 5 + else + echom a:base + return ['-help', '-v'] + endif + endfunc + set omnifunc=Omni + new + exe "normal Gofind -\\" + call assert_equal("\n-\nmatch 1 of 2", execute(':2mess')) + + bwipe! + delfunc Omni + set omnifunc= + endfunc *** ../vim-8.0.1241/src/Makefile 2017-10-29 15:26:39.212867448 +0100 --- src/Makefile 2017-11-02 15:28:01.475680518 +0100 *************** *** 2189,2194 **** --- 2189,2195 ---- test_hlsearch \ test_increment \ test_increment_dbcs \ + test_ins_complete \ test_job_fails \ test_join \ test_json \ *** ../vim-8.0.1241/src/eval.c 2017-10-30 21:48:36.482732724 +0100 --- src/eval.c 2017-11-02 15:33:14.077815209 +0100 *************** *** 1056,1063 **** if (str_arg_only) len = 0; else ! /* Recognize a number argument, the others must be strings. */ vim_str2nr(argv[i], NULL, &len, STR2NR_ALL, &n, NULL, 0); if (len != 0 && len == (int)STRLEN(argv[i])) { argvars[i].v_type = VAR_NUMBER; --- 1056,1068 ---- if (str_arg_only) len = 0; else ! { ! /* Recognize a number argument, the others must be strings. A dash ! * is a string too. */ vim_str2nr(argv[i], NULL, &len, STR2NR_ALL, &n, NULL, 0); + if (len == 1 && *argv[i] == '-') + len = 0; + } if (len != 0 && len == (int)STRLEN(argv[i])) { argvars[i].v_type = VAR_NUMBER; *** ../vim-8.0.1241/src/version.c 2017-10-31 22:19:54.732086180 +0100 --- src/version.c 2017-11-02 15:34:27.661375669 +0100 *************** *** 763,764 **** --- 763,766 ---- { /* Add new patch number below this line */ + /**/ + 1242, /**/ -- BRIDGEKEEPER: What is your favorite editor? GAWAIN: Emacs ... No, Viiiiiiiiiiimmmmmmm! "Monty Python and the Holy editor wars" PYTHON (MONTY) SOFTWARE LTD /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///