summaryrefslogtreecommitdiff
path: root/data/vim/patches/8.1.0296
diff options
context:
space:
mode:
Diffstat (limited to 'data/vim/patches/8.1.0296')
-rw-r--r--data/vim/patches/8.1.0296306
1 files changed, 306 insertions, 0 deletions
diff --git a/data/vim/patches/8.1.0296 b/data/vim/patches/8.1.0296
new file mode 100644
index 000000000..26acf8115
--- /dev/null
+++ b/data/vim/patches/8.1.0296
@@ -0,0 +1,306 @@
+To: vim_dev@googlegroups.com
+Subject: Patch 8.1.0296
+Fcc: outbox
+From: Bram Moolenaar <Bram@moolenaar.net>
+Mime-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+------------
+
+Patch 8.1.0296
+Problem: Command parsing for 'incsearch' is a bit ugly.
+Solution: Return when there is no pattern. Put common checks together.
+Files: src/ex_getln.c
+
+
+*** ../vim-8.1.0295/src/ex_getln.c 2018-08-18 21:04:57.743864534 +0200
+--- src/ex_getln.c 2018-08-18 21:20:59.041314761 +0200
+***************
+*** 276,415 ****
+ do_incsearch_highlighting(int firstc, incsearch_state_T *is_state,
+ int *skiplen, int *patlen)
+ {
+ *skiplen = 0;
+ *patlen = ccline.cmdlen;
+
+! if (p_is && !cmd_silent)
+ {
+! // by default search all lines
+! search_first_line = 0;
+! search_last_line = MAXLNUM;
+!
+! if (firstc == '/' || firstc == '?')
+! return TRUE;
+! if (firstc == ':')
+ {
+! char_u *cmd;
+! cmdmod_T save_cmdmod = cmdmod;
+! char_u *p;
+! int delim;
+! char_u *end;
+! char_u *dummy;
+! exarg_T ea;
+!
+! vim_memset(&ea, 0, sizeof(ea));
+! ea.line1 = 1;
+! ea.line2 = 1;
+! ea.cmd = ccline.cmdbuff;
+! ea.addr_type = ADDR_LINES;
+!
+! parse_command_modifiers(&ea, &dummy, TRUE);
+! cmdmod = save_cmdmod;
+!
+! cmd = skip_range(ea.cmd, NULL);
+! if (*cmd == 's' || *cmd == 'g' || *cmd == 'v' || *cmd == 'l')
+! {
+! // Skip over "substitute" to find the pattern separator.
+! for (p = cmd; ASCII_ISALPHA(*p); ++p)
+! ;
+! if (*skipwhite(p) != NUL)
+! {
+! if (STRNCMP(cmd, "substitute", p - cmd) == 0
+! || STRNCMP(cmd, "smagic", p - cmd) == 0
+! || STRNCMP(cmd, "snomagic", MAX(p - cmd, 3)) == 0
+! || STRNCMP(cmd, "sort", MAX(p - cmd, 3)) == 0
+! || STRNCMP(cmd, "global", p - cmd) == 0
+! || STRNCMP(cmd, "vglobal", p - cmd) == 0)
+! {
+! if (*cmd == 's' && cmd[1] == 'm')
+! p_magic = TRUE;
+! else if (*cmd == 's' && cmd[1] == 'n')
+! p_magic = FALSE;
+!
+! // Check for "global!/".
+! if (*cmd == 'g' && *p == '!')
+! {
+! p++;
+! if (*skipwhite(p) == NUL)
+! return FALSE;
+! }
+!
+! // For ":sort" skip over flags.
+! if (cmd[0] == 's' && cmd[1] == 'o')
+! {
+! while (ASCII_ISALPHA(*(p = skipwhite(p))))
+! ++p;
+! if (*p == NUL)
+! return FALSE;
+! }
+!
+! p = skipwhite(p);
+! delim = *p++;
+! end = skip_regexp(p, delim, p_magic, NULL);
+! }
+! else if (STRNCMP(cmd, "vimgrep", MAX(p - cmd, 3)) == 0
+! || STRNCMP(cmd, "vimgrepadd", MAX(p - cmd, 8)) == 0
+! || STRNCMP(cmd, "lvimgrep", MAX(p - cmd, 2)) == 0
+! || STRNCMP(cmd, "lvimgrepadd", MAX(p - cmd, 9)) == 0)
+! {
+! // Check for "!/".
+! if (*p == '!')
+! {
+! p++;
+! if (*skipwhite(p) == NUL)
+! return FALSE;
+! }
+! p = skipwhite(p);
+! delim = (vim_isIDc(*p)) ? ' ' : *p++;
+! end = skip_regexp(p, delim, p_magic, NULL);
+! }
+! else
+! {
+! end = p;
+! delim = -1;
+! }
+!
+! if (end > p || *end == delim)
+! {
+! pos_T save_cursor = curwin->w_cursor;
+!
+! // found a non-empty pattern or //
+! *skiplen = (int)(p - ccline.cmdbuff);
+! *patlen = (int)(end - p);
+!
+! // parse the address range
+! curwin->w_cursor = is_state->search_start;
+! parse_cmd_address(&ea, &dummy);
+! if (ea.addr_count > 0)
+! {
+! // Allow for reverse match.
+! if (ea.line2 < ea.line1)
+! {
+! search_first_line = ea.line2;
+! search_last_line = ea.line1;
+! }
+! else
+! {
+! search_first_line = ea.line1;
+! search_last_line = ea.line2;
+! }
+! }
+! else if (cmd[0] == 's' && cmd[1] != 'o')
+! {
+! // :s defaults to the current line
+! search_first_line = curwin->w_cursor.lnum;
+! search_last_line = curwin->w_cursor.lnum;
+! }
+!
+! curwin->w_cursor = save_cursor;
+! return TRUE;
+! }
+! }
+! }
+ }
+ }
+
+! return FALSE;
+ }
+
+ static void
+--- 276,400 ----
+ do_incsearch_highlighting(int firstc, incsearch_state_T *is_state,
+ int *skiplen, int *patlen)
+ {
++ char_u *cmd;
++ cmdmod_T save_cmdmod = cmdmod;
++ char_u *p;
++ int delim_optional = FALSE;
++ int delim;
++ char_u *end;
++ char_u *dummy;
++ exarg_T ea;
++ pos_T save_cursor;
++
+ *skiplen = 0;
+ *patlen = ccline.cmdlen;
+
+! if (!p_is || cmd_silent)
+! return FALSE;
+!
+! // by default search all lines
+! search_first_line = 0;
+! search_last_line = MAXLNUM;
+!
+! if (firstc == '/' || firstc == '?')
+! return TRUE;
+! if (firstc != ':')
+! return FALSE;
+!
+! vim_memset(&ea, 0, sizeof(ea));
+! ea.line1 = 1;
+! ea.line2 = 1;
+! ea.cmd = ccline.cmdbuff;
+! ea.addr_type = ADDR_LINES;
+!
+! parse_command_modifiers(&ea, &dummy, TRUE);
+! cmdmod = save_cmdmod;
+!
+! 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
+! || STRNCMP(cmd, "snomagic", MAX(p - cmd, 3)) == 0
+! || STRNCMP(cmd, "vglobal", p - cmd) == 0)
+! {
+! if (*cmd == 's' && cmd[1] == 'm')
+! p_magic = TRUE;
+! else if (*cmd == 's' && cmd[1] == 'n')
+! p_magic = FALSE;
+! }
+! else if (STRNCMP(cmd, "sort", MAX(p - cmd, 3)) == 0)
+ {
+! // skip over flags
+! 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
+! || STRNCMP(cmd, "lvimgrep", MAX(p - cmd, 2)) == 0
+! || STRNCMP(cmd, "lvimgrepadd", MAX(p - cmd, 9)) == 0
+! || STRNCMP(cmd, "global", p - cmd) == 0)
+! {
+! // skip over "!"
+! if (*p == '!')
+ {
+! 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++;
++ end = skip_regexp(p, delim, p_magic, NULL);
++
++ if (end == p && *end != delim)
++ return FALSE;
++ // found a non-empty pattern or //
++
++ *skiplen = (int)(p - ccline.cmdbuff);
++ *patlen = (int)(end - p);
++
++ // parse the address range
++ save_cursor = curwin->w_cursor;
++ curwin->w_cursor = is_state->search_start;
++ parse_cmd_address(&ea, &dummy);
++ if (ea.addr_count > 0)
++ {
++ // Allow for reverse match.
++ if (ea.line2 < ea.line1)
++ {
++ search_first_line = ea.line2;
++ search_last_line = ea.line1;
++ }
++ else
++ {
++ search_first_line = ea.line1;
++ search_last_line = ea.line2;
++ }
++ }
++ else if (cmd[0] == 's' && cmd[1] != 'o')
++ {
++ // :s defaults to the current line
++ search_first_line = curwin->w_cursor.lnum;
++ search_last_line = curwin->w_cursor.lnum;
+ }
+
+! curwin->w_cursor = save_cursor;
+! return TRUE;
+ }
+
+ static void
+*** ../vim-8.1.0295/src/version.c 2018-08-18 21:04:57.743864534 +0200
+--- src/version.c 2018-08-18 21:22:23.748034012 +0200
+***************
+*** 796,797 ****
+--- 796,799 ----
+ { /* Add new patch number below this line */
++ /**/
++ 296,
+ /**/
+
+--
+The Characters and incidents portrayed and the names used are fictitious and
+any similarity to the names, characters, or history of any person is entirely
+accidental and unintentional.
+ Signed RICHARD M. NIXON
+ "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES 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 ///