Patch 8.2.1224
Patch 8.2.1224 Problem:Vim9: arguments from partial are not used. Solution: Put the partial arguments on the stack. (closes #6460) Files: src/vim9execute.c, src/testdir/test_vim9_func.vim *** ../vim-8.2.1223/src/vim9execute.c 2020-07-13 20:41:04.472449703 +0200 --- src/vim9execute.c 2020-07-15 22:18:51.916798072 +0200 *** *** 575,588 } static int ! call_partial(typval_T *tv, int argcount, ectx_T *ectx) { char_u*name = NULL; int called_emsg_before = called_emsg; if (tv->v_type == VAR_PARTIAL) { ! partial_T *pt = tv->vval.v_partial; if (pt->pt_func != NULL) { --- 575,606 } static int ! call_partial(typval_T *tv, int argcount_arg, ectx_T *ectx) { + int argcount = argcount_arg; char_u*name = NULL; int called_emsg_before = called_emsg; if (tv->v_type == VAR_PARTIAL) { ! partial_T *pt = tv->vval.v_partial; ! int i; ! ! if (pt->pt_argc > 0) ! { ! // Make space for arguments from the partial, shift the "argcount" ! // arguments up. ! if (ga_grow(&ectx->ec_stack, pt->pt_argc) == FAIL) ! return FAIL; ! for (i = 1; i <= argcount; ++i) ! *STACK_TV_BOT(-i + pt->pt_argc) = *STACK_TV_BOT(-i); ! ectx->ec_stack.ga_len += pt->pt_argc; ! argcount += pt->pt_argc; ! ! // copy the arguments from the partial onto the stack ! for (i = 0; i < pt->pt_argc; ++i) ! copy_tv(&pt->pt_argv[i], STACK_TV_BOT(-argcount + i)); ! } if (pt->pt_func != NULL) { *** ../vim-8.2.1223/src/testdir/test_vim9_func.vim 2020-07-15 19:48:14.216759531 +0200 --- src/testdir/test_vim9_func.vim 2020-07-15 22:35:07.305872829 +0200 *** *** 1055,1059 --- 1055,1077 delete('XclosureDir', 'rf') enddef + def Test_partial_call() + let Xsetlist = function('setloclist', [0]) + Xsetlist([], ' ', {'title': 'test'}) + assert_equal({'title': 'test'}, getloclist(0, {'title': 1})) + + Xsetlist = function('setloclist', [0, [], ' ']) + Xsetlist({'title': 'test'}) + assert_equal({'title': 'test'}, getloclist(0, {'title': 1})) + + Xsetlist = function('setqflist') + Xsetlist([], ' ', {'title': 'test'}) + assert_equal({'title': 'test'}, getqflist({'title': 1})) + + Xsetlist = function('setqflist', [[], ' ']) + Xsetlist({'title': 'test'}) + assert_equal({'title': 'test'}, getqflist({'title': 1})) + enddef + " vim: ts=8 sw=2 sts=2 expandtab tw=80 fdm=marker *** ../vim-8.2.1223/src/version.c 2020-07-15 19:48:14.216759531 +0200 --- src/version.c 2020-07-15 22:19:39.296635763 +0200 *** *** 756,757 --- 756,759 { /* Add new patch number below this line */ + /**/ + 1224, /**/ -- The History of every major Galactic Civilization tends to pass through three distinct and recognizable phases, those of Survival, Inquiry and Sophistication, otherwise known as the How, Why and Where phases. For instance, the first phase is characterized by the question 'How can we eat?' the second by the question 'Why do we eat?' and the third by the question 'Where shall we have lunch?' -- Douglas Adams, "The Hitchhiker's Guide to the Galaxy" /// Bram Moolenaar -- b...@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/// -- -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_dev/202007152044.06FKiMMX3422330%40masaka.moolenaar.net.
Patch 8.2.1223
Patch 8.2.1223 Problem:Vim9: invalid type error for function default value. Solution: Use right argument index. (closes #6458) Files: src/vim9compile.c, src/testdir/test_vim9_func.vim *** ../vim-8.2.1222/src/vim9compile.c 2020-07-15 14:15:47.414627529 +0200 --- src/vim9compile.c 2020-07-15 19:44:41.673273675 +0200 *** *** 6865,6871 val_type = ((type_T **)stack->ga_data)[stack->ga_len - 1]; if (ufunc->uf_arg_types[arg_idx] == &t_unknown) ufunc->uf_arg_types[arg_idx] = val_type; ! else if (check_type(ufunc->uf_arg_types[i], val_type, FALSE) == FAIL) { arg_type_mismatch(ufunc->uf_arg_types[arg_idx], val_type, --- 6865,6871 val_type = ((type_T **)stack->ga_data)[stack->ga_len - 1]; if (ufunc->uf_arg_types[arg_idx] == &t_unknown) ufunc->uf_arg_types[arg_idx] = val_type; ! else if (check_type(ufunc->uf_arg_types[arg_idx], val_type, FALSE) == FAIL) { arg_type_mismatch(ufunc->uf_arg_types[arg_idx], val_type, *** ../vim-8.2.1222/src/testdir/test_vim9_func.vim 2020-07-15 14:15:47.418627519 +0200 --- src/testdir/test_vim9_func.vim 2020-07-15 19:43:13.005483540 +0200 *** *** 104,114 --- 104,122 return name enddef + def MyDefaultSecond(name: string, second: bool = true): string + return second ? name : 'none' + enddef + def Test_call_default_args() assert_equal('string', MyDefaultArgs()) assert_equal('one', MyDefaultArgs('one')) assert_fails('call MyDefaultArgs("one", "two")', 'E118:') + assert_equal('test', MyDefaultSecond('test')) + assert_equal('test', MyDefaultSecond('test', true)) + assert_equal('none', MyDefaultSecond('test', false)) + CheckScriptFailure(['def Func(arg: number = asdf)', 'enddef', 'defcompile'], 'E1001:') CheckScriptFailure(['def Func(arg: number = "text")', 'enddef', 'defcompile'], 'E1013: argument 1: type mismatch, expected number but got string') enddef *** ../vim-8.2.1222/src/version.c 2020-07-15 18:29:15.072357704 +0200 --- src/version.c 2020-07-15 19:38:52.814081200 +0200 *** *** 756,757 --- 756,759 { /* Add new patch number below this line */ + /**/ + 1223, /**/ -- `The Guide says there is an art to flying,' said Ford, `or at least a knack. The knack lies in learning how to throw yourself at the ground and miss.' He smiled weakly. -- Douglas Adams, "The Hitchhiker's Guide to the Galaxy" /// Bram Moolenaar -- b...@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/// -- -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_dev/202007151748.06FHmooj3387639%40masaka.moolenaar.net.
Re: Vim9 design choice: comments
James McCoy wrote: > On Wed, Jul 15, 2020 at 02:25:40PM +0200, Bram Moolenaar wrote: > > To make this work with a double quoted string, we don't have much choice > > but to disallow double quoted comments. > > Just where vim9script is being used or everywhere? In case this wasn't clear: legacy Vim script will remain 100% backwards compatible. > > Vim has always supported double quoted comments, disallowing them would > > be a big divergence. But as the above shows, it does make it consistent > > and easy to use. It's just not at all backwards compatible. > > vim9script itself isn't backwards compatible, so if you're only > disallowing double quoted comments in that context, I don't see why it > matters. It would matter for people switching between legacy Vim script and Vim9 script. But perhaps it's actually good to quickly see that all the comments are different, so you know what kind of script you are dealing with? The "vim9script" command would only be at the very top of the file. -- I'm not familiar with this proof, but I'm aware of a significant following of toddlers who believe that peanut butter is the solution to all of life's problems...-- Tim Hammerquist /// Bram Moolenaar -- b...@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/// -- -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_dev/202007151635.06FGZG8k3372340%40masaka.moolenaar.net.
Patch 8.2.1222
Patch 8.2.1222 Problem:When using valgrind a Vim command started by a test uses the same log file name which gets overwritten. Solution: Fix regexp to rename the log file. Files: src/testdir/shared.vim *** ../vim-8.2.1221/src/testdir/shared.vim 2020-07-06 21:03:02.589331536 +0200 --- src/testdir/shared.vim 2020-07-15 17:30:07.854619960 +0200 *** *** 268,274 " If using valgrind, make sure every run uses a different log file. if cmd =~ 'valgrind.*--log-file=' ! let cmd = substitute(cmd, '--log-file=\(^\s*\)', '--log-file=\1.' . g:valgrind_cnt, '') let g:valgrind_cnt += 1 endif --- 268,274 " If using valgrind, make sure every run uses a different log file. if cmd =~ 'valgrind.*--log-file=' ! let cmd = substitute(cmd, '--log-file=\(\S*\)', '--log-file=\1.' . g:valgrind_cnt, '') let g:valgrind_cnt += 1 endif *** ../vim-8.2.1221/src/version.c 2020-07-15 18:27:03.168733637 +0200 --- src/version.c 2020-07-15 18:28:16.008525909 +0200 *** *** 756,757 --- 756,759 { /* Add new patch number below this line */ + /**/ + 1222, /**/ -- One difference between a man and a machine is that a machine is quiet when well oiled. /// Bram Moolenaar -- b...@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/// -- -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_dev/202007151629.06FGTgxW3371249%40masaka.moolenaar.net.
Patch 8.2.1221
Patch 8.2.1221 Problem:Memory leak when updating popup window. Solution: Clear search highlighting. Files: src/popupwin.c *** ../vim-8.2.1220/src/popupwin.c 2020-07-12 20:44:33.909196163 +0200 --- src/popupwin.c 2020-07-15 16:27:21.519502074 +0200 *** *** 3855,3860 --- 3855,3865 // Back to the normal zindex. screen_zindex = 0; } + + #if defined(FEAT_SEARCH_EXTRA) + // In case win_update() called start_search_hl(). + end_search_hl(); + #endif } /* *** ../vim-8.2.1220/src/version.c 2020-07-15 17:37:59.053523797 +0200 --- src/version.c 2020-07-15 18:26:41.236796246 +0200 *** *** 756,757 --- 756,759 { /* Add new patch number below this line */ + /**/ + 1221, /**/ -- I am also told that there is a logical proof out there somewhere that demonstrates that there is no task which duct tape cannot handle. -- Paul Brannan /// Bram Moolenaar -- b...@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/// -- -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_dev/202007151627.06FGRqYs3370742%40masaka.moolenaar.net.
Re: Vim9 design choice: comments
Bram Moolenaar wrote: > I'm trying to make the Vim9 script syntax consistent and easy to use. > But I'm now running into something that would be a drastic change. > > I already added support for comments starting with #. These are nice, > we know them from shell scripts, Python and a few other syntaxes. > > Double quoted comments can currently still be used, but not everywhere. > E.g. when an expression might continue in the next line: > function("arg one", > "arg two") > > This also shows the inconsistency: > myList->add(123)" works > g:myList->add(123) " works > [1, 2, 3]->Process()" works > #{a: 1, b: 2}->Process()" works > {'a': 1, 'b': 2}->Process() " works > "foobar"->Process() " does NOT work > ("foobar")->Process() " works > 'foobar'->Process() " does NOT work > ('foobar')->Process() " works > > I just made the last-but-one work, since we added the rule that a range > must start with a colon, and using a mark in a range would thus be :'t. > > To make this work with a double quoted string, we don't have much choice > but to disallow double quoted comments. Since there really is no way to > tell the difference, both a string and a comment may contain anything. > > Vim has always supported double quoted comments, disallowing them would > be a big divergence. But as the above shows, it does make it consistent > and easy to use. It's just not at all backwards compatible. > > Opinions? I've always found it strange that in vim script, double quotes are used for strings as well as comments. It seems cleaner/clearer to not use double quotes for comments anymore. Vim9 script is not 100% compatible anyway, so it seems OK. Vim9 script aims maybe to look somewhat familiar to those who know vim script, but not entirely. Since it's a new language, it's a good opportunity to simplify oddities. I wonder whether such simplification also helps to parse faster (speed being the main goal of vim9). Ah, I just see that # (used for comments when there is a space after #) is also used for things that are not comments as in #{a: 1, b: 2}->Process(). So comments in vim9 still look a bit odd. Regards Dominique -- -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_dev/CAON-T_hQP1x4L3QViSXmTtp-n-MGrM3QVvSaHGi-0juD2WjjNQ%40mail.gmail.com.
Patch 8.2.1220
Patch 8.2.1220 Problem:memory access error when dragging a popup window over a buffer with folding. Solution: Avoid going over the end of the cache. (closes #6438) Files: src/mouse.c, src/testdir/test_popupwin.vim, src/testdir/dumps/Test_popupwin_term_01.dump, src/testdir/dumps/Test_popupwin_term_02.dump, src/testdir/dumps/Test_popupwin_term_03.dump, src/testdir/dumps/Test_popupwin_term_04.dump *** ../vim-8.2.1219/src/mouse.c 2020-07-12 13:47:38.808013098 +0200 --- src/mouse.c 2020-07-15 17:27:30.370950842 +0200 *** *** 2839,2848 /* * Compute the buffer line position from the screen position "rowp" / "colp" in * window "win". ! * "plines_cache" can be NULL (no cache) or an array with "win->w_height" ! * entries that caches the plines_win() result from a previous call. Entry is ! * zero if not computed yet. There must be no text or setting changes since ! * the entry is put in the cache. * Returns TRUE if the position is below the last line. */ int --- 2839,2848 /* * Compute the buffer line position from the screen position "rowp" / "colp" in * window "win". ! * "plines_cache" can be NULL (no cache) or an array with "Rows" entries that ! * caches the plines_win() result from a previous call. Entry is zero if not ! * computed yet. There must be no text or setting changes since the entry is ! * put in the cache. * Returns TRUE if the position is below the last line. */ int *** *** 2871,2877 { int cache_idx = lnum - win->w_topline; ! if (plines_cache != NULL && plines_cache[cache_idx] > 0) count = plines_cache[cache_idx]; else { --- 2871,2880 { int cache_idx = lnum - win->w_topline; ! // Only "Rows" lines are cached, with folding we'll run out of entries ! // and use the slow way. ! if (plines_cache != NULL && cache_idx < Rows ! && plines_cache[cache_idx] > 0) count = plines_cache[cache_idx]; else { *** *** 2892,2898 else #endif count = plines_win(win, lnum, TRUE); ! if (plines_cache != NULL) plines_cache[cache_idx] = count; } if (count > row) --- 2895,2901 else #endif count = plines_win(win, lnum, TRUE); ! if (plines_cache != NULL && cache_idx < Rows) plines_cache[cache_idx] = count; } if (count > row) *** ../vim-8.2.1219/src/testdir/test_popupwin.vim 2020-07-12 19:52:32.707024154 +0200 --- src/testdir/test_popupwin.vim 2020-07-15 17:30:23.750585271 +0200 *** *** 584,592 " create a popup that covers the terminal window let lines =<< trim END set shell=/bin/sh noruler let $PS1 = 'vim> ' ! terminal $wincmd w let winid = popup_create(['', ''], #{ \ drag: 1, --- 584,599 " create a popup that covers the terminal window let lines =<< trim END + set foldmethod=marker + call setline(1, range(100)) + for nr in range(7) + call setline(nr * 12 + 1, "fold {{{") + call setline(nr * 12 + 11 , "end }}}") + endfor + %foldclose set shell=/bin/sh noruler let $PS1 = 'vim> ' ! terminal ++rows=4 $wincmd w let winid = popup_create(['', ''], #{ \ drag: 1, *** *** 594,612 \ border: [], \ line: 3, \ }) ! func Dragit() call feedkeys("\", "xt") endfunc map :call test_setmouse(3, &columns / 2) map :call test_setmouse(3, &columns / 2 - 20) END call writefile(lines, 'XtestPopupTerm') ! let buf = RunVimInTerminal('-S XtestPopupTerm', #{rows: 10}) call VerifyScreenDump(buf, 'Test_popupwin_term_01', {}) ! call term_sendkeys(buf, ":call Dragit()\") call VerifyScreenDump(buf, 'Test_popupwin_term_02', {}) " clean up call StopVimInTerminal(buf) call delete('XtestPopupTerm') --- 601,633 \ border: [], \ line: 3, \ }) ! func DragitLeft() call feedkeys("\", "xt") endfunc + func DragitDown() + call feedkeys("\", "xt") + endfunc + func DragitDownLeft() + call feedkeys("\", "xt") + endfunc map :call test_setmouse(3, &columns / 2) map :call test_setmouse(3, &columns / 2 - 20) + map :call test_setmouse(12, &columns / 2) + map :call test_setmouse(12, &columns / 2 - 20) END call writefile(lines, 'XtestPopupTerm') ! let buf = RunVimInTerminal('-S XtestPopupTerm', #{rows: 16}) call VerifyScreenDump(buf, 'Test_popupwin_term_01', {})
Re: Vim9 design choice: comments
On 2020-07-15, James McCoy wrote: > On Wed, Jul 15, 2020 at 02:25:40PM +0200, Bram Moolenaar wrote: > > To make this work with a double quoted string, we don't have much choice > > but to disallow double quoted comments. > > Just where vim9script is being used or everywhere? That's my question, too. I don't think I really care what Vimscript9 does, but I use a lot of plugins whose authors are not even around anymore. Having to update all of those would be a huge inconvenience. Plus, I would have to keep two sets of plugins around to support the various versions of Vim I use on different systems. Regards, Gary -- -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_dev/20200715150015.GA27030%40phoenix.
Re: Vim9 design choice: comments
On Wed, Jul 15, 2020 at 02:25:40PM +0200, Bram Moolenaar wrote: > To make this work with a double quoted string, we don't have much choice > but to disallow double quoted comments. Just where vim9script is being used or everywhere? > Vim has always supported double quoted comments, disallowing them would > be a big divergence. But as the above shows, it does make it consistent > and easy to use. It's just not at all backwards compatible. vim9script itself isn't backwards compatible, so if you're only disallowing double quoted comments in that context, I don't see why it matters. Cheers, -- James GPG Key: 4096R/91BF BF4D 6956 BD5D F7B7 2D23 DFE6 91AE 331B A3DB -- -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_dev/20200715140334.eh7pru3eid5lrbxa%40localhost.
Question regarding "b:changedtick"
Greetings: I noticed that with "vim --clean" and "vim -u NONE" the "b:changedtick" variable starts out at 2. Why? -- Jason Franklin -- -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_dev/4c0d37c2-f742-8b29-e006-fb554d7faa8b%40quoininc.com.
Patch 8.2.1219
Patch 8.2.1219 Problem:Symlink not followed if dirname ends in //. Solution: Resolve symlink earlier. (Tomáš Janoušek, closes #6454) Files: src/memline.c, src/testdir/test_swap.vim *** ../vim-8.2.1218/src/memline.c 2020-06-12 22:59:07.266097201 +0200 --- src/memline.c 2020-07-15 15:19:21.359366567 +0200 *** *** 3287,3296 #endif /* ! * Replace line lnum, with buffering, in current buffer. * * If "copy" is TRUE, make a copy of the line, otherwise the line has been * copied to allocated memory already. * * Check: The caller of this function should probably also call * changed_lines(), unless update_screen(NOT_VALID) is used. --- 3287,3298 #endif /* ! * Replace line "lnum", with buffering, in current buffer. * * If "copy" is TRUE, make a copy of the line, otherwise the line has been * copied to allocated memory already. + * If "copy" is FALSE the "line" may be freed to add text properties! + * Do not use it after calling ml_replace(). * * Check: The caller of this function should probably also call * changed_lines(), unless update_screen(NOT_VALID) is used. *** *** 4366,4371 --- 4368,4378 char_u*fname_res = fname; #ifdef HAVE_READLINK char_ufname_buf[MAXPATHL]; + + // Expand symlink in the file name, so that we put the swap file with the + // actual file instead of with the symlink. + if (resolve_symlink(fname, fname_buf) == OK) + fname_res = fname_buf; #endif #if defined(UNIX) || defined(MSWIN) // Need _very_ long file names *** *** 4375,4381 if (after_pathsep(dir_name, s) && len > 1 && s[-1] == s[-2]) {// Ends with '//', Use Full path r = NULL; ! if ((s = make_percent_swname(dir_name, fname)) != NULL) { r = modname(s, (char_u *)".swp", FALSE); vim_free(s); --- 4382,4388 if (after_pathsep(dir_name, s) && len > 1 && s[-1] == s[-2]) {// Ends with '//', Use Full path r = NULL; ! if ((s = make_percent_swname(dir_name, fname_res)) != NULL) { r = modname(s, (char_u *)".swp", FALSE); vim_free(s); *** *** 4384,4396 } #endif - #ifdef HAVE_READLINK - // Expand symlink in the file name, so that we put the swap file with the - // actual file instead of with the symlink. - if (resolve_symlink(fname, fname_buf) == OK) - fname_res = fname_buf; - #endif - r = buf_modname( (buf->b_p_sn || buf->b_shortname), fname_res, --- 4391,4396 *** ../vim-8.2.1218/src/testdir/test_swap.vim 2020-04-08 21:50:18.876619651 +0200 --- src/testdir/test_swap.vim 2020-07-15 15:17:53.767686613 +0200 *** *** 377,380 --- 377,410 call delete('Xfile1') endfunc + func Test_swap_symlink() + if !has("unix") + return + endif + + call writefile(['text'], 'Xtestfile') + silent !ln -s -f Xtestfile Xtestlink + + set dir=. + + " Test that swap file uses the name of the file when editing through a + " symbolic link (so that editing the file twice is detected) + edit Xtestlink + call assert_match('Xtestfile\.swp$', s:swapname()) + bwipe! + + call mkdir('Xswapdir') + exe 'set dir=' . getcwd() . '/Xswapdir//' + + " Check that this also works when 'directory' ends with '//' + edit Xtestlink + call assert_match('Xtestfile\.swp$', s:swapname()) + bwipe! + + set dir& + call delete('Xtestfile') + call delete('Xtestlink') + call delete('Xswapdir', 'rf') + endfunc + " vim: shiftwidth=2 sts=2 expandtab *** ../vim-8.2.1218/src/version.c 2020-07-15 14:15:47.418627519 +0200 --- src/version.c 2020-07-15 15:20:59.063020623 +0200 *** *** 756,757 --- 756,759 { /* Add new patch number below this line */ + /**/ + 1219, /**/ -- Now it is such a bizarrely improbable coincidence that anything as mind-bogglingly useful as the Babel fish could have evolved purely by chance that some thinkers have chosen to see it as a final and clinching proof of the NON-existence of God. The argument goes something like this: 'I refuse to prove that I exist,' says God, 'for proof denies faith, and without faith I am nothing.' 'But,' says Man, 'the Babel fish is a dead giveaway, isn't it? It could not have evolved by chance. It proves you exist, and so therefore, by your own arguments, you don't. QED.' 'Oh dear,' says God, 'I hadn't thought of that,' and promptly vanishes in a puff of logic. 'Oh, that was easy,' says Man, and for an encore goes on to prove that black is white and gets himself killed on the next pedestrian crossing. -- Douglas Adams, "The Hitchhiker's Guide to the Galaxy" /// Bram Moolenaar -- b...@moolenaar.net -- http://www.Moolenaar.net \\\ ///sponsor Vim, vote for features -- http://www.
Vim9 design choice: comments
I'm trying to make the Vim9 script syntax consistent and easy to use. But I'm now running into something that would be a drastic change. I already added support for comments starting with #. These are nice, we know them from shell scripts, Python and a few other syntaxes. Double quoted comments can currently still be used, but not everywhere. E.g. when an expression might continue in the next line: function("arg one", "arg two") This also shows the inconsistency: myList->add(123)" works g:myList->add(123) " works [1, 2, 3]->Process()" works #{a: 1, b: 2}->Process()" works {'a': 1, 'b': 2}->Process() " works "foobar"->Process() " does NOT work ("foobar")->Process() " works 'foobar'->Process() " does NOT work ('foobar')->Process() " works I just made the last-but-one work, since we added the rule that a range must start with a colon, and using a mark in a range would thus be :'t. To make this work with a double quoted string, we don't have much choice but to disallow double quoted comments. Since there really is no way to tell the difference, both a string and a comment may contain anything. Vim has always supported double quoted comments, disallowing them would be a big divergence. But as the above shows, it does make it consistent and easy to use. It's just not at all backwards compatible. Opinions? -- How To Keep A Healthy Level Of Insanity: 18. When leaving the zoo, start running towards the parking lot, yelling "run for your lives, they're loose!!" /// Bram Moolenaar -- b...@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/// -- -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_dev/202007151225.06FCPeBd3317933%40masaka.moolenaar.net.
Patch 8.2.1218
Patch 8.2.1218 Problem:Vim9: cannot use 'text'->func(). Solution: Recognize string at start of command. Files: src/vim9compile.c, src/ex_docmd.c, src/testdir/test_vim9_func.vim *** ../vim-8.2.1217/src/vim9compile.c 2020-07-13 18:55:44.937073001 +0200 --- src/vim9compile.c 2020-07-15 12:48:22.134903895 +0200 *** *** 7048,7060 /* * COMMAND after range */ cmd = ea.cmd; ! ea.cmd = skip_range(ea.cmd, NULL); ! if (ea.cmd > cmd && !starts_with_colon) { ! emsg(_(e_colon_required)); ! goto erret; } p = find_ex_command(&ea, NULL, starts_with_colon ? NULL : (void *(*)(char_u *, size_t, cctx_T *))lookup_local, --- 7048,7064 /* * COMMAND after range +* 'text'->func() should not be confused with 'a mark */ cmd = ea.cmd; ! if (*cmd != '\'') { ! ea.cmd = skip_range(ea.cmd, NULL); ! if (ea.cmd > cmd && !starts_with_colon) ! { ! emsg(_(e_colon_required)); ! goto erret; ! } } p = find_ex_command(&ea, NULL, starts_with_colon ? NULL : (void *(*)(char_u *, size_t, cctx_T *))lookup_local, *** ../vim-8.2.1217/src/ex_docmd.c 2020-07-12 17:07:01.024810908 +0200 --- src/ex_docmd.c 2020-07-15 13:50:48.938344906 +0200 *** *** 1700,1705 --- 1700,1707 char_u*cmd; #ifdef FEAT_EVAL int starts_with_colon; + int starts_with_quote; + int vim9script = in_vim9script(); #endif CLEAR_FIELD(ea); *** *** 1760,1771 * We need the command to know what kind of range it uses. */ cmd = ea.cmd; ! ea.cmd = skip_range(ea.cmd, NULL); if (*ea.cmd == '*' && vim_strchr(p_cpo, CPO_STAR) == NULL) ea.cmd = skipwhite(ea.cmd + 1); #ifdef FEAT_EVAL ! if (in_vim9script() && !starts_with_colon) { if (ea.cmd > cmd) { --- 1762,1777 * We need the command to know what kind of range it uses. */ cmd = ea.cmd; ! #ifdef FEAT_EVAL ! starts_with_quote = vim9script && *ea.cmd == '\''; ! if (!starts_with_quote) ! #endif ! ea.cmd = skip_range(ea.cmd, NULL); if (*ea.cmd == '*' && vim_strchr(p_cpo, CPO_STAR) == NULL) ea.cmd = skipwhite(ea.cmd + 1); #ifdef FEAT_EVAL ! if (vim9script && !starts_with_colon) { if (ea.cmd > cmd) { *** *** 1859,1866 } ea.cmd = cmd; ! if (parse_cmd_address(&ea, &errormsg, FALSE) == FAIL) ! goto doend; /* * 5. Parse the command. --- 1865,1875 } ea.cmd = cmd; ! #ifdef FEAT_EVAL ! if (!starts_with_quote) ! #endif ! if (parse_cmd_address(&ea, &errormsg, FALSE) == FAIL) ! goto doend; /* * 5. Parse the command. *** *** 1880,1886 if (*ea.cmd == NUL || *ea.cmd == '"' #ifdef FEAT_EVAL || (*ea.cmd == '#' && ea.cmd[1] != '{' ! && !starts_with_colon && in_vim9script()) #endif || (ea.nextcmd = check_nextcmd(ea.cmd)) != NULL) { --- 1889,1895 if (*ea.cmd == NUL || *ea.cmd == '"' #ifdef FEAT_EVAL || (*ea.cmd == '#' && ea.cmd[1] != '{' ! && !starts_with_colon && vim9script) #endif || (ea.nextcmd = check_nextcmd(ea.cmd)) != NULL) { *** *** 3223,3248 * "lvar = value", "lvar(arg)", "[1, 2 3]->Func()" */ p = eap->cmd; ! if (lookup != NULL && (*p == '(' || *p == '{' ! || ((p = to_name_const_end(eap->cmd)) > eap->cmd && *p != NUL) ! || *p == '[')) { int oplen; int heredoc; ! // "funcname(" is always a function call. ! // "varname[]" is an expression. ! // "g:varname" is an expression. ! // "varname->expr" is an expression. ! // "varname.expr" is an expression. ! // "(..." is an expression. ! // "{..." is an dict expression. ! if (*p == '(' ! || *p == '{' ! || (*p == '[' && p > eap->cmd) ! || p[1] == ':' ! || (*p == '-' && p[1] == '>') ! || (*p == '.' && ASCII_ISALPHA(p[1]))) { eap->cmdidx = CMD_eval; return eap->cmd; --- 3232,3265 * "lvar = value", "lvar(arg)", "[1, 2 3]->Func()" */ p = eap->cmd; ! if (lookup != NULL && (vim_strchr((char_u *)"{('[", *p) != NULL ! || ((p = to_name_const_end(eap->cmd)) > eap->cmd ! && *p != NUL))) { int oplen; int heredoc; ! if ( ! // "(..." is an expression. ! // "funcname(" is always a function call. ! *p == '(' ! || (p
Re: Test Failure in test_terminal3.vim
Elimar Riesebieter wrote: > tried to build 8.2.1216 on amd64 within a tmux session using shadow > dirs and got: > > From test_terminal3.vim: > Found errors in Test_terminal_getwinpos(): > Run 1: > function > RunTheTest[39]..Test_terminal_getwinpos[16]..WaitForAssert[2]..7_WaitForCommon[11]..58 > line 1: Pattern '\\[\\d\\+, \\d\\+\\]' does not match '[-1, -1]\[ occurs 34 > times]0,0-1 All' > function RunTheTest[39]..Test_terminal_getwinpos line 32: Expected > range 1 - 1142, but got 0 > function RunTheTest[39]..Test_terminal_getwinpos line 33: Expected > range 1 - 419, but got 0 I tried using tmux, but didn't have this problem. Anything else that might matter? -- How To Keep A Healthy Level Of Insanity: 14. Put mosquito netting around your work area. Play a tape of jungle sounds all day. /// Bram Moolenaar -- b...@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/// -- -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_dev/202007151152.06FBqcLF3310449%40masaka.moolenaar.net.
Patch 8.2.1217
Patch 8.2.1217 Problem:Startup test depends on random source file. Solution: Write a test file to find quickfix errors in. Files: src/testdir/test_startup.vim *** ../vim-8.2.1216/src/testdir/test_startup.vim2020-07-15 01:37:32.729753421 +0200 --- src/testdir/test_startup.vim2020-07-15 11:17:41.52645 +0200 *** *** 285,291 func Test_q_arg() CheckFeature quickfix ! let source_file = has('win32') ? '..\memfile.c' : '../memfile.c' let after =<< trim [CODE] call writefile([&errorfile, string(getpos("."))], "Xtestout") copen --- 285,299 func Test_q_arg() CheckFeature quickfix ! let lines =<< trim END ! /* some file with an error */ ! main() { ! functionCall(arg; arg, arg); ! return 666 ! } ! END ! call writefile(lines, 'Xbadfile.c') ! let after =<< trim [CODE] call writefile([&errorfile, string(getpos("."))], "Xtestout") copen *** *** 295,318 " Test with default argument '-q'. call assert_equal('errors.err', &errorfile) ! call writefile(["../memfile.c:208:5: error: expected ';' before '}' token"], 'errors.err') if RunVim([], after, '-q') let lines = readfile('Xtestout') call assert_equal(['errors.err', ! \ '[0, 208, 1, 0]', ! \ source_file . "|208 col 5| error: expected ';' before '}' token"], \ lines) endif call delete('Xtestout') call delete('errors.err') " Test with explicit argument '-q Xerrors' (with space). ! call writefile(["../memfile.c:208:5: error: expected ';' before '}' token"], 'Xerrors') if RunVim([], after, '-q Xerrors') let lines = readfile('Xtestout') call assert_equal(['Xerrors', ! \ '[0, 208, 1, 0]', ! \ source_file . "|208 col 5| error: expected ';' before '}' token"], \ lines) endif call delete('Xtestout') --- 303,326 " Test with default argument '-q'. call assert_equal('errors.err', &errorfile) ! call writefile(["Xbadfile.c:4:12: error: expected ';' before '}' token"], 'errors.err') if RunVim([], after, '-q') let lines = readfile('Xtestout') call assert_equal(['errors.err', ! \ '[0, 4, 12, 0]', ! \ "Xbadfile.c|4 col 12| error: expected ';' before '}' token"], \ lines) endif call delete('Xtestout') call delete('errors.err') " Test with explicit argument '-q Xerrors' (with space). ! call writefile(["Xbadfile.c:4:12: error: expected ';' before '}' token"], 'Xerrors') if RunVim([], after, '-q Xerrors') let lines = readfile('Xtestout') call assert_equal(['Xerrors', ! \ '[0, 4, 12, 0]', ! \ "Xbadfile.c|4 col 12| error: expected ';' before '}' token"], \ lines) endif call delete('Xtestout') *** *** 321,328 if RunVim([], after, '-qXerrors') let lines = readfile('Xtestout') call assert_equal(['Xerrors', ! \ '[0, 208, 1, 0]', ! \ source_file . "|208 col 5| error: expected ';' before '}' token"], \ lines) endif --- 329,336 if RunVim([], after, '-qXerrors') let lines = readfile('Xtestout') call assert_equal(['Xerrors', ! \ '[0, 4, 12, 0]', ! \ "Xbadfile.c|4 col 12| error: expected ';' before '}' token"], \ lines) endif *** *** 330,335 --- 338,344 let out = system(GetVimCommand() .. ' -q xyz.err') call assert_equal(3, v:shell_error) + call delete('Xbadfile.c') call delete('Xtestout') call delete('Xerrors') endfunc *** ../vim-8.2.1216/src/version.c 2020-07-15 01:37:32.729753421 +0200 --- src/version.c 2020-07-15 11:18:32.466304386 +0200 *** *** 756,757 --- 756,759 { /* Add new patch number below this line */ + /**/ + 1217, /**/ -- How To Keep A Healthy Level Of Insanity: 13. Go to a poetry recital and ask why the poems don't rhyme. /// Bram Moolenaar -- b...@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/// -- -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups