To: vim_dev@googlegroups.com Subject: Patch 8.2.3048 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.3048 Problem: Strange error for white space after ++ command. Solution: Check for white space explicitly. (closes #8440) Files: src/vim9script.c, src/errors.h, src/vim9compile.c, src/testdir/test_vim9_assign.vim *** ../vim-8.2.3047/src/vim9script.c 2021-06-25 19:29:26.563354256 +0200 --- src/vim9script.c 2021-06-25 21:13:52.049372338 +0200 *************** *** 169,174 **** --- 169,181 ---- char_u *nextcmd = eap->nextcmd; size_t len = STRLEN(eap->cmd) + 8; + if (VIM_ISWHITE(cmd[2])) + { + semsg(_(e_no_white_space_allowed_after_str_str), + eap->cmdidx == CMD_increment ? "++" : "--", eap->cmd); + return; + } + // This works like "nr += 1" or "nr -= 1". // Add a '|' to avoid looking in the next line. eap->cmd = alloc(len); *** ../vim-8.2.3047/src/errors.h 2021-06-21 21:08:04.928547486 +0200 --- src/errors.h 2021-06-25 21:19:13.224610578 +0200 *************** *** 446,448 **** --- 446,450 ---- INIT(= N_("E1200: Decryption failed!")); EXTERN char e_libsodium_decryption_failed_premature[] INIT(= N_("E1201: Decryption failed: pre-mature end of file!")); + EXTERN char e_no_white_space_allowed_after_str_str[] + INIT(= N_("E1202: No white space allowed after '%s': %s")); *** ../vim-8.2.3047/src/vim9compile.c 2021-06-23 20:20:49.654780609 +0200 --- src/vim9compile.c 2021-06-25 21:26:50.883557010 +0200 *************** *** 6639,6644 **** --- 6639,6650 ---- } if (eap->cmdidx == CMD_increment || eap->cmdidx == CMD_decrement) { + if (VIM_ISWHITE(eap->cmd[2])) + { + semsg(_(e_no_white_space_allowed_after_str_str), + eap->cmdidx == CMD_increment ? "++" : "--", eap->cmd); + return NULL; + } op = (char_u *)(eap->cmdidx == CMD_increment ? "+=" : "-="); oplen = 2; incdec = TRUE; *** ../vim-8.2.3047/src/testdir/test_vim9_assign.vim 2021-06-25 19:29:26.563354256 +0200 --- src/testdir/test_vim9_assign.vim 2021-06-25 21:23:04.696074508 +0200 *************** *** 1906,1911 **** --- 1906,1917 ---- unlet g:count END CheckDefAndScriptSuccess(lines) + + lines =<< trim END + var nr = 7 + ++ nr + END + CheckDefAndScriptFailure(lines, "E1202: No white space allowed after '++': ++ nr") enddef *** ../vim-8.2.3047/src/version.c 2021-06-25 19:29:26.563354256 +0200 --- src/version.c 2021-06-25 21:27:17.327496826 +0200 *************** *** 757,758 **** --- 757,760 ---- { /* Add new patch number below this line */ + /**/ + 3048, /**/ -- hundred-and-one symptoms of being an internet addict: 31. You code your homework in HTML and give your instructor the URL. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// \\\ \\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///