To: vim_dev@googlegroups.com Subject: Patch 8.1.2338 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.1.2338 Problem: Using Visual mark sith :s gives E20 if not set. Solution: Ignore errors when handling 'incsearch'. (closes #3837) Files: src/ex_getln.c, src/testdir/test_search.vim, src/testdir/dumps/Test_incsearch_substitute_14.dump *** ../vim-8.1.2337/src/ex_getln.c 2019-11-21 22:14:14.353810993 +0100 --- src/ex_getln.c 2019-11-23 21:45:12.598786636 +0100 *************** *** 197,202 **** --- 197,203 ---- exarg_T ea; pos_T save_cursor; int use_last_pat; + int retval = FALSE; *skiplen = 0; *patlen = ccline.cmdlen; *************** *** 213,218 **** --- 214,220 ---- if (firstc != ':') return FALSE; + ++emsg_off; vim_memset(&ea, 0, sizeof(ea)); ea.line1 = 1; ea.line2 = 1; *************** *** 224,236 **** cmd = skip_range(ea.cmd, NULL); if (vim_strchr((char_u *)"sgvl", *cmd) == NULL) ! return FALSE; // Skip over "substitute" to find the pattern separator. for (p = cmd; ASCII_ISALPHA(*p); ++p) ; if (*skipwhite(p) == NUL) ! return FALSE; if (STRNCMP(cmd, "substitute", p - cmd) == 0 || STRNCMP(cmd, "smagic", p - cmd) == 0 --- 226,238 ---- cmd = skip_range(ea.cmd, NULL); if (vim_strchr((char_u *)"sgvl", *cmd) == NULL) ! goto theend; // Skip over "substitute" to find the pattern separator. for (p = cmd; ASCII_ISALPHA(*p); ++p) ; if (*skipwhite(p) == NUL) ! goto theend; if (STRNCMP(cmd, "substitute", p - cmd) == 0 || STRNCMP(cmd, "smagic", p - cmd) == 0 *************** *** 248,254 **** while (ASCII_ISALPHA(*(p = skipwhite(p)))) ++p; if (*p == NUL) ! return FALSE; } else if (STRNCMP(cmd, "vimgrep", MAX(p - cmd, 3)) == 0 || STRNCMP(cmd, "vimgrepadd", MAX(p - cmd, 8)) == 0 --- 250,256 ---- while (ASCII_ISALPHA(*(p = skipwhite(p)))) ++p; if (*p == NUL) ! goto theend; } else if (STRNCMP(cmd, "vimgrep", MAX(p - cmd, 3)) == 0 || STRNCMP(cmd, "vimgrepadd", MAX(p - cmd, 8)) == 0 *************** *** 261,273 **** { p++; if (*skipwhite(p) == NUL) ! return FALSE; } if (*cmd != 'g') delim_optional = TRUE; } else ! return FALSE; p = skipwhite(p); delim = (delim_optional && vim_isIDc(*p)) ? ' ' : *p++; --- 263,275 ---- { p++; if (*skipwhite(p) == NUL) ! goto theend; } if (*cmd != 'g') delim_optional = TRUE; } else ! goto theend; p = skipwhite(p); delim = (delim_optional && vim_isIDc(*p)) ? ' ' : *p++; *************** *** 276,282 **** use_last_pat = end == p && *end == delim; if (end == p && !use_last_pat) ! return FALSE; // Don't do 'hlsearch' highlighting if the pattern matches everything. if (!use_last_pat) --- 278,284 ---- use_last_pat = end == p && *end == delim; if (end == p && !use_last_pat) ! goto theend; // Don't do 'hlsearch' highlighting if the pattern matches everything. if (!use_last_pat) *************** *** 288,294 **** empty = empty_pattern(p); *end = c; if (empty) ! return FALSE; } // found a non-empty pattern or // --- 290,296 ---- empty = empty_pattern(p); *end = c; if (empty) ! goto theend; } // found a non-empty pattern or // *************** *** 321,327 **** } curwin->w_cursor = save_cursor; ! return TRUE; } static void --- 323,332 ---- } curwin->w_cursor = save_cursor; ! retval = TRUE; ! theend: ! --emsg_off; ! return retval; } static void *** ../vim-8.1.2337/src/testdir/test_search.vim 2019-09-06 21:34:25.362847408 +0200 --- src/testdir/test_search.vim 2019-11-23 21:36:57.119453425 +0100 *************** *** 983,988 **** --- 983,1001 ---- call VerifyScreenDump(buf, 'Test_incsearch_substitute_12', {}) call term_sendkeys(buf, "\") call VerifyScreenDump(buf, 'Test_incsearch_substitute_13', {}) + call term_sendkeys(buf, ":%bwipe!\") + call term_sendkeys(buf, ":only!\") + + " get :'<,'>s command in history + call term_sendkeys(buf, ":set cmdheight=2\") + call term_sendkeys(buf, "aasdfasdf\") + call term_sendkeys(buf, "V:s/a/b/g\") + " Using '<,'> does not give E20 + call term_sendkeys(buf, ":new\") + call term_sendkeys(buf, "aasdfasdf\") + call term_sendkeys(buf, ":\\") + call VerifyScreenDump(buf, 'Test_incsearch_substitute_14', {}) + call term_sendkeys(buf, "") call StopVimInTerminal(buf) call delete('Xis_subst_script') *** ../vim-8.1.2337/src/testdir/dumps/Test_incsearch_substitute_14.dump 2019-11-23 21:55:02.335645947 +0100 --- src/testdir/dumps/Test_incsearch_substitute_14.dump 2019-11-23 21:45:24.310765508 +0100 *************** *** 0 **** --- 1,9 ---- + |a+1&#ffffff0|s+0&&|d|f|a+0&#ffff4012|s+0&#ffffff0|d|f| @61 + |~+0#4040ff13&| @68 + |~| @68 + |[+3#0000000&|N|o| |N|a|m|e|]| |[|+|]| @38|1|,|1| @11|A|l@1 + |b+0&&|s|d|f|b|s|d|f| @61 + |~+0#4040ff13&| @68 + |[+1#0000000&|N|o| |N|a|m|e|]| |[|+|]| @38|1|,|1| @11|A|l@1 + |:+0&&|'|<|,|'|>|s|/|a|/|b|/|g> @56 + @70 *** ../vim-8.1.2337/src/version.c 2019-11-22 22:21:56.702841558 +0100 --- src/version.c 2019-11-23 21:41:20.843162519 +0100 *************** *** 739,740 **** --- 739,742 ---- { /* Add new patch number below this line */ + /**/ + 2338, /**/ -- hundred-and-one symptoms of being an internet addict: 113. You are asked about a bus schedule, you wonder if it is 16 or 32 bits. /// 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 ///