|
Karsten Hopp |
7819ea |
To: vim_dev@googlegroups.com
|
|
Karsten Hopp |
7819ea |
Subject: Patch 7.4.184
|
|
Karsten Hopp |
7819ea |
Fcc: outbox
|
|
Karsten Hopp |
7819ea |
From: Bram Moolenaar <Bram@moolenaar.net>
|
|
Karsten Hopp |
7819ea |
Mime-Version: 1.0
|
|
Karsten Hopp |
7819ea |
Content-Type: text/plain; charset=UTF-8
|
|
Karsten Hopp |
7819ea |
Content-Transfer-Encoding: 8bit
|
|
Karsten Hopp |
7819ea |
------------
|
|
Karsten Hopp |
7819ea |
|
|
Karsten Hopp |
7819ea |
Patch 7.4.184
|
|
Karsten Hopp |
7819ea |
Problem: match() does not work properly with a {count} argument.
|
|
Karsten Hopp |
7819ea |
Solution: Compute the length once and update it. Quit the loop when at the
|
|
Karsten Hopp |
7819ea |
end. (Hirohito Higashi)
|
|
Karsten Hopp |
7819ea |
Files: src/eval.c, src/testdir/test53.in, src/testdir/test53.ok
|
|
Karsten Hopp |
7819ea |
|
|
Karsten Hopp |
7819ea |
|
|
Karsten Hopp |
7819ea |
*** ../vim-7.4.183/src/eval.c 2014-02-05 22:13:02.366556787 +0100
|
|
Karsten Hopp |
7819ea |
--- src/eval.c 2014-02-22 22:13:26.644906020 +0100
|
|
Karsten Hopp |
7819ea |
***************
|
|
Karsten Hopp |
7819ea |
*** 8014,8020 ****
|
|
Karsten Hopp |
7819ea |
{"log10", 1, 1, f_log10},
|
|
Karsten Hopp |
7819ea |
#endif
|
|
Karsten Hopp |
7819ea |
#ifdef FEAT_LUA
|
|
Karsten Hopp |
7819ea |
! {"luaeval", 1, 2, f_luaeval},
|
|
Karsten Hopp |
7819ea |
#endif
|
|
Karsten Hopp |
7819ea |
{"map", 2, 2, f_map},
|
|
Karsten Hopp |
7819ea |
{"maparg", 1, 4, f_maparg},
|
|
Karsten Hopp |
7819ea |
--- 8014,8020 ----
|
|
Karsten Hopp |
7819ea |
{"log10", 1, 1, f_log10},
|
|
Karsten Hopp |
7819ea |
#endif
|
|
Karsten Hopp |
7819ea |
#ifdef FEAT_LUA
|
|
Karsten Hopp |
7819ea |
! {"luaeval", 1, 2, f_luaeval},
|
|
Karsten Hopp |
7819ea |
#endif
|
|
Karsten Hopp |
7819ea |
{"map", 2, 2, f_map},
|
|
Karsten Hopp |
7819ea |
{"maparg", 1, 4, f_maparg},
|
|
Karsten Hopp |
7819ea |
***************
|
|
Karsten Hopp |
7819ea |
*** 13905,13910 ****
|
|
Karsten Hopp |
7819ea |
--- 13905,13911 ----
|
|
Karsten Hopp |
7819ea |
int type;
|
|
Karsten Hopp |
7819ea |
{
|
|
Karsten Hopp |
7819ea |
char_u *str = NULL;
|
|
Karsten Hopp |
7819ea |
+ long len = 0;
|
|
Karsten Hopp |
7819ea |
char_u *expr = NULL;
|
|
Karsten Hopp |
7819ea |
char_u *pat;
|
|
Karsten Hopp |
7819ea |
regmatch_T regmatch;
|
|
Karsten Hopp |
7819ea |
***************
|
|
Karsten Hopp |
7819ea |
*** 13944,13950 ****
|
|
Karsten Hopp |
7819ea |
--- 13945,13954 ----
|
|
Karsten Hopp |
7819ea |
li = l->lv_first;
|
|
Karsten Hopp |
7819ea |
}
|
|
Karsten Hopp |
7819ea |
else
|
|
Karsten Hopp |
7819ea |
+ {
|
|
Karsten Hopp |
7819ea |
expr = str = get_tv_string(&argvars[0]);
|
|
Karsten Hopp |
7819ea |
+ len = (long)STRLEN(str);
|
|
Karsten Hopp |
7819ea |
+ }
|
|
Karsten Hopp |
7819ea |
|
|
Karsten Hopp |
7819ea |
pat = get_tv_string_buf_chk(&argvars[1], patbuf);
|
|
Karsten Hopp |
7819ea |
if (pat == NULL)
|
|
Karsten Hopp |
7819ea |
***************
|
|
Karsten Hopp |
7819ea |
*** 13968,13974 ****
|
|
Karsten Hopp |
7819ea |
{
|
|
Karsten Hopp |
7819ea |
if (start < 0)
|
|
Karsten Hopp |
7819ea |
start = 0;
|
|
Karsten Hopp |
7819ea |
! if (start > (long)STRLEN(str))
|
|
Karsten Hopp |
7819ea |
goto theend;
|
|
Karsten Hopp |
7819ea |
/* When "count" argument is there ignore matches before "start",
|
|
Karsten Hopp |
7819ea |
* otherwise skip part of the string. Differs when pattern is "^"
|
|
Karsten Hopp |
7819ea |
--- 13972,13978 ----
|
|
Karsten Hopp |
7819ea |
{
|
|
Karsten Hopp |
7819ea |
if (start < 0)
|
|
Karsten Hopp |
7819ea |
start = 0;
|
|
Karsten Hopp |
7819ea |
! if (start > len)
|
|
Karsten Hopp |
7819ea |
goto theend;
|
|
Karsten Hopp |
7819ea |
/* When "count" argument is there ignore matches before "start",
|
|
Karsten Hopp |
7819ea |
* otherwise skip part of the string. Differs when pattern is "^"
|
|
Karsten Hopp |
7819ea |
***************
|
|
Karsten Hopp |
7819ea |
*** 13976,13982 ****
|
|
Karsten Hopp |
7819ea |
--- 13980,13989 ----
|
|
Karsten Hopp |
7819ea |
if (argvars[3].v_type != VAR_UNKNOWN)
|
|
Karsten Hopp |
7819ea |
startcol = start;
|
|
Karsten Hopp |
7819ea |
else
|
|
Karsten Hopp |
7819ea |
+ {
|
|
Karsten Hopp |
7819ea |
str += start;
|
|
Karsten Hopp |
7819ea |
+ len -= start;
|
|
Karsten Hopp |
7819ea |
+ }
|
|
Karsten Hopp |
7819ea |
}
|
|
Karsten Hopp |
7819ea |
|
|
Karsten Hopp |
7819ea |
if (argvars[3].v_type != VAR_UNKNOWN)
|
|
Karsten Hopp |
7819ea |
***************
|
|
Karsten Hopp |
7819ea |
*** 14026,14031 ****
|
|
Karsten Hopp |
7819ea |
--- 14033,14044 ----
|
|
Karsten Hopp |
7819ea |
#else
|
|
Karsten Hopp |
7819ea |
startcol = (colnr_T)(regmatch.startp[0] + 1 - str);
|
|
Karsten Hopp |
7819ea |
#endif
|
|
Karsten Hopp |
7819ea |
+ if (startcol > (colnr_T)len
|
|
Karsten Hopp |
7819ea |
+ || str + startcol <= regmatch.startp[0])
|
|
Karsten Hopp |
7819ea |
+ {
|
|
Karsten Hopp |
7819ea |
+ match = FALSE;
|
|
Karsten Hopp |
7819ea |
+ break;
|
|
Karsten Hopp |
7819ea |
+ }
|
|
Karsten Hopp |
7819ea |
}
|
|
Karsten Hopp |
7819ea |
}
|
|
Karsten Hopp |
7819ea |
|
|
Karsten Hopp |
7819ea |
*** ../vim-7.4.183/src/testdir/test53.in 2013-10-02 21:54:57.000000000 +0200
|
|
Karsten Hopp |
7819ea |
--- src/testdir/test53.in 2014-02-22 22:08:24.260906501 +0100
|
|
Karsten Hopp |
7819ea |
***************
|
|
Karsten Hopp |
7819ea |
*** 4,9 ****
|
|
Karsten Hopp |
7819ea |
--- 4,11 ----
|
|
Karsten Hopp |
7819ea |
|
|
Karsten Hopp |
7819ea |
Also test match() and matchstr()
|
|
Karsten Hopp |
7819ea |
|
|
Karsten Hopp |
7819ea |
+ Also test the gn command and repeating it.
|
|
Karsten Hopp |
7819ea |
+
|
|
Karsten Hopp |
7819ea |
STARTTEST
|
|
Karsten Hopp |
7819ea |
:so small.vim
|
|
Karsten Hopp |
7819ea |
/^start:/
|
|
Karsten Hopp |
7819ea |
***************
|
|
Karsten Hopp |
7819ea |
*** 28,33 ****
|
|
Karsten Hopp |
7819ea |
--- 30,57 ----
|
|
Karsten Hopp |
7819ea |
:put =matchstr(\"abcd\", \".\", 0, -1) " a
|
|
Karsten Hopp |
7819ea |
:put =match(\"abcd\", \".\", 0, 5) " -1
|
|
Karsten Hopp |
7819ea |
:put =match(\"abcd\", \".\", 0, -1) " 0
|
|
Karsten Hopp |
7819ea |
+ :put =match('abc', '.', 0, 1) " 0
|
|
Karsten Hopp |
7819ea |
+ :put =match('abc', '.', 0, 2) " 1
|
|
Karsten Hopp |
7819ea |
+ :put =match('abc', '.', 0, 3) " 2
|
|
Karsten Hopp |
7819ea |
+ :put =match('abc', '.', 0, 4) " -1
|
|
Karsten Hopp |
7819ea |
+ :put =match('abc', '.', 1, 1) " 1
|
|
Karsten Hopp |
7819ea |
+ :put =match('abc', '.', 2, 1) " 2
|
|
Karsten Hopp |
7819ea |
+ :put =match('abc', '.', 3, 1) " -1
|
|
Karsten Hopp |
7819ea |
+ :put =match('abc', '$', 0, 1) " 3
|
|
Karsten Hopp |
7819ea |
+ :put =match('abc', '$', 0, 2) " -1
|
|
Karsten Hopp |
7819ea |
+ :put =match('abc', '$', 1, 1) " 3
|
|
Karsten Hopp |
7819ea |
+ :put =match('abc', '$', 2, 1) " 3
|
|
Karsten Hopp |
7819ea |
+ :put =match('abc', '$', 3, 1) " 3
|
|
Karsten Hopp |
7819ea |
+ :put =match('abc', '$', 4, 1) " -1
|
|
Karsten Hopp |
7819ea |
+ :put =match('abc', '\zs', 0, 1) " 0
|
|
Karsten Hopp |
7819ea |
+ :put =match('abc', '\zs', 0, 2) " 1
|
|
Karsten Hopp |
7819ea |
+ :put =match('abc', '\zs', 0, 3) " 2
|
|
Karsten Hopp |
7819ea |
+ :put =match('abc', '\zs', 0, 4) " 3
|
|
Karsten Hopp |
7819ea |
+ :put =match('abc', '\zs', 0, 5) " -1
|
|
Karsten Hopp |
7819ea |
+ :put =match('abc', '\zs', 1, 1) " 1
|
|
Karsten Hopp |
7819ea |
+ :put =match('abc', '\zs', 2, 1) " 2
|
|
Karsten Hopp |
7819ea |
+ :put =match('abc', '\zs', 3, 1) " 3
|
|
Karsten Hopp |
7819ea |
+ :put =match('abc', '\zs', 4, 1) " -1
|
|
Karsten Hopp |
7819ea |
/^foobar
|
|
Karsten Hopp |
7819ea |
gncsearchmatch?/one\_s*two\_s
|
|
Karsten Hopp |
7819ea |
:1
|
|
Karsten Hopp |
7819ea |
***************
|
|
Karsten Hopp |
7819ea |
*** 49,54 ****
|
|
Karsten Hopp |
7819ea |
--- 73,84 ----
|
|
Karsten Hopp |
7819ea |
:" Make sure there is no other match y uppercase.
|
|
Karsten Hopp |
7819ea |
/?x59
|
|
Karsten Hopp |
7819ea |
gggnd
|
|
Karsten Hopp |
7819ea |
+ :" test repeating dgn
|
|
Karsten Hopp |
7819ea |
+ /^Johnny
|
|
Karsten Hopp |
7819ea |
+ ggdgn.
|
|
Karsten Hopp |
7819ea |
+ :" test repeating gUgn
|
|
Karsten Hopp |
7819ea |
+ /^Depp
|
|
Karsten Hopp |
7819ea |
+ gggUgn.
|
|
Karsten Hopp |
7819ea |
:/^start:/,/^end:/wq! test.out
|
|
Karsten Hopp |
7819ea |
ENDTEST
|
|
Karsten Hopp |
7819ea |
|
|
Karsten Hopp |
7819ea |
***************
|
|
Karsten Hopp |
7819ea |
*** 81,84 ****
|
|
Karsten Hopp |
7819ea |
--- 111,123 ----
|
|
Karsten Hopp |
7819ea |
Y
|
|
Karsten Hopp |
7819ea |
text
|
|
Karsten Hopp |
7819ea |
Y
|
|
Karsten Hopp |
7819ea |
+ --1
|
|
Karsten Hopp |
7819ea |
+ Johnny
|
|
Karsten Hopp |
7819ea |
+ --2
|
|
Karsten Hopp |
7819ea |
+ Johnny
|
|
Karsten Hopp |
7819ea |
+ --3
|
|
Karsten Hopp |
7819ea |
+ Depp
|
|
Karsten Hopp |
7819ea |
+ --4
|
|
Karsten Hopp |
7819ea |
+ Depp
|
|
Karsten Hopp |
7819ea |
+ --5
|
|
Karsten Hopp |
7819ea |
end:
|
|
Karsten Hopp |
7819ea |
*** ../vim-7.4.183/src/testdir/test53.ok 2013-10-02 21:54:57.000000000 +0200
|
|
Karsten Hopp |
7819ea |
--- src/testdir/test53.ok 2014-02-22 22:08:24.264906501 +0100
|
|
Karsten Hopp |
7819ea |
***************
|
|
Karsten Hopp |
7819ea |
*** 18,23 ****
|
|
Karsten Hopp |
7819ea |
--- 18,45 ----
|
|
Karsten Hopp |
7819ea |
a
|
|
Karsten Hopp |
7819ea |
-1
|
|
Karsten Hopp |
7819ea |
0
|
|
Karsten Hopp |
7819ea |
+ 0
|
|
Karsten Hopp |
7819ea |
+ 1
|
|
Karsten Hopp |
7819ea |
+ 2
|
|
Karsten Hopp |
7819ea |
+ -1
|
|
Karsten Hopp |
7819ea |
+ 1
|
|
Karsten Hopp |
7819ea |
+ 2
|
|
Karsten Hopp |
7819ea |
+ -1
|
|
Karsten Hopp |
7819ea |
+ 3
|
|
Karsten Hopp |
7819ea |
+ -1
|
|
Karsten Hopp |
7819ea |
+ 3
|
|
Karsten Hopp |
7819ea |
+ 3
|
|
Karsten Hopp |
7819ea |
+ 3
|
|
Karsten Hopp |
7819ea |
+ -1
|
|
Karsten Hopp |
7819ea |
+ 0
|
|
Karsten Hopp |
7819ea |
+ 1
|
|
Karsten Hopp |
7819ea |
+ 2
|
|
Karsten Hopp |
7819ea |
+ 3
|
|
Karsten Hopp |
7819ea |
+ -1
|
|
Karsten Hopp |
7819ea |
+ 1
|
|
Karsten Hopp |
7819ea |
+ 2
|
|
Karsten Hopp |
7819ea |
+ 3
|
|
Karsten Hopp |
7819ea |
+ -1
|
|
Karsten Hopp |
7819ea |
SEARCH:
|
|
Karsten Hopp |
7819ea |
searchmatch
|
|
Karsten Hopp |
7819ea |
abcdx | | abcdx
|
|
Karsten Hopp |
7819ea |
***************
|
|
Karsten Hopp |
7819ea |
*** 30,33 ****
|
|
Karsten Hopp |
7819ea |
--- 52,64 ----
|
|
Karsten Hopp |
7819ea |
|
|
Karsten Hopp |
7819ea |
text
|
|
Karsten Hopp |
7819ea |
Y
|
|
Karsten Hopp |
7819ea |
+ --1
|
|
Karsten Hopp |
7819ea |
+
|
|
Karsten Hopp |
7819ea |
+ --2
|
|
Karsten Hopp |
7819ea |
+
|
|
Karsten Hopp |
7819ea |
+ --3
|
|
Karsten Hopp |
7819ea |
+ DEPP
|
|
Karsten Hopp |
7819ea |
+ --4
|
|
Karsten Hopp |
7819ea |
+ DEPP
|
|
Karsten Hopp |
7819ea |
+ --5
|
|
Karsten Hopp |
7819ea |
end:
|
|
Karsten Hopp |
7819ea |
*** ../vim-7.4.183/src/version.c 2014-02-15 19:47:46.685882910 +0100
|
|
Karsten Hopp |
7819ea |
--- src/version.c 2014-02-22 22:10:49.604906270 +0100
|
|
Karsten Hopp |
7819ea |
***************
|
|
Karsten Hopp |
7819ea |
*** 740,741 ****
|
|
Karsten Hopp |
7819ea |
--- 740,743 ----
|
|
Karsten Hopp |
7819ea |
{ /* Add new patch number below this line */
|
|
Karsten Hopp |
7819ea |
+ /**/
|
|
Karsten Hopp |
7819ea |
+ 184,
|
|
Karsten Hopp |
7819ea |
/**/
|
|
Karsten Hopp |
7819ea |
|
|
Karsten Hopp |
7819ea |
--
|
|
Karsten Hopp |
7819ea |
WOMAN: I didn't know we had a king. I thought we were an autonomous
|
|
Karsten Hopp |
7819ea |
collective.
|
|
Karsten Hopp |
7819ea |
DENNIS: You're fooling yourself. We're living in a dictatorship. A
|
|
Karsten Hopp |
7819ea |
self-perpetuating autocracy in which the working classes--
|
|
Karsten Hopp |
7819ea |
WOMAN: Oh there you go, bringing class into it again.
|
|
Karsten Hopp |
7819ea |
DENNIS: That's what it's all about if only people would--
|
|
Karsten Hopp |
7819ea |
The Quest for the Holy Grail (Monty Python)
|
|
Karsten Hopp |
7819ea |
|
|
Karsten Hopp |
7819ea |
/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
|
|
Karsten Hopp |
7819ea |
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
|
|
Karsten Hopp |
7819ea |
\\\ an exciting new programming language -- http://www.Zimbu.org ///
|
|
Karsten Hopp |
7819ea |
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
|