To: vim_dev@googlegroups.com Subject: Patch 8.2.1359 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.1359 Problem: Vim9: cannot assign to / register in Vim9 script. Solution: Adjust check for assignment in Vim9 script. (closes #6567) Files: src/ex_docmd.c, src/testdir/test_vim9_script.vim *** ../vim-8.2.1358/src/ex_docmd.c 2020-08-01 21:11:35.028952048 +0200 --- src/ex_docmd.c 2020-08-02 20:31:23.154792759 +0200 *************** *** 3274,3283 **** if (lookup != NULL) { // Skip over first char for "&opt = val", "$ENV = val" and "@r = val". ! char_u *pskip = (*eap->cmd == '&' || *eap->cmd == '$' ! || *eap->cmd == '@') ? eap->cmd + 1 : eap->cmd; ! if (vim_strchr((char_u *)"{('[\"", *p) != NULL || ((p = to_name_const_end(pskip)) > eap->cmd && *p != NUL)) { int oplen; --- 3274,3283 ---- if (lookup != NULL) { // Skip over first char for "&opt = val", "$ENV = val" and "@r = val". ! char_u *pskip = (*eap->cmd == '&' || *eap->cmd == '$') ! ? eap->cmd + 1 : eap->cmd; ! if (vim_strchr((char_u *)"{('[\"@", *p) != NULL || ((p = to_name_const_end(pskip)) > eap->cmd && *p != NUL)) { int oplen; *************** *** 3336,3341 **** --- 3336,3343 ---- // Recognize an assignment if we recognize the variable name: // "g:var = expr" // "var = expr" where "var" is a local var name. + if (*eap->cmd == '@') + p = eap->cmd + 2; oplen = assignment_len(skipwhite(p), &heredoc); if (oplen > 0) { *** ../vim-8.2.1358/src/testdir/test_vim9_script.vim 2020-08-02 20:03:22.022965576 +0200 --- src/testdir/test_vim9_script.vim 2020-08-02 20:39:55.573460337 +0200 *************** *** 423,428 **** --- 423,445 ---- let ll = Func() assert_equal([1, 2], ll) + + @/ = 'text' + assert_equal('text', @/) + @0 = 'zero' + assert_equal('zero', @0) + @1 = 'one' + assert_equal('one', @1) + @9 = 'nine' + assert_equal('nine', @9) + @- = 'minus' + assert_equal('minus', @-) + if has('clipboard_working') + @* = 'star' + assert_equal('star', @*) + @+ = 'plus' + assert_equal('plus', @+) + endif END CheckScriptSuccess(lines) enddef *** ../vim-8.2.1358/src/version.c 2020-08-02 20:03:22.022965576 +0200 --- src/version.c 2020-08-02 20:32:37.782607264 +0200 *************** *** 756,757 **** --- 756,759 ---- { /* Add new patch number below this line */ + /**/ + 1359, /**/ -- hundred-and-one symptoms of being an internet addict: 114. You are counting items, you go "0,1,2,3,4,5,6,7,8,9,A,B,C,D...". /// 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 ///