bug in match() function

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

bug in match() function

Marian Csontos
Hi folks,

I was playing with tip for printing highlighted matches  
(http://vim.sourceforge.net/tips/tip.php?tip_id=1141) and found out that:

match('abc def','\<',0) returns 0 - OK
match('abc def','\<',1) returns 1 instead of 4

similarly

match('abc def','^',0) returns 0 - OK
match('abc def','^',1) returns 1 instead of -1

Should be this considered a bug?

In both Vim 6.3.86 and 7.00aa snapshot 205

-- Regards

Marian

PS: it seems my previous message has been filtered, if not excuse me for  
duplicate post.


________ Information from NOD32 ________
This message was checked by NOD32 Antivirus System for Linux Mail Server.
  part000.txt - is OK
http://www.nod32.com
Reply | Threaded
Open this post in threaded view
|

Re: bug in match() function

Benji Fisher
On Thu, Mar 02, 2006 at 12:46:02PM +0100, Marian Csontos wrote:
> Hi folks,
>
> Should be this considered a bug?
>
> :echo match('abc def','\<',0)
> 0
> :echo match('abc def','\<',1)
> 1 instead of 4
[snip]

     I think this was brought up a week or two ago, and Bram's reply was
that it has worked this way for a while, and changing it might cause
problems.

     Perhaps, under :help match(), after

                If {start} is given, the search starts from index {start}.

it would help to add a note like this:

                This acts like calling match(strpart({expr}, {start}), {pat}).

HTH --Benji Fisher
Reply | Threaded
Open this post in threaded view
|

Re: bug in match() function

Yakov Lerner
"Benji Fisher" <[hidden email]> wrote:

> On Thu, Mar 02, 2006 at 12:46:02PM +0100, Marian Csontos wrote:
> > Hi folks,
> >
> > Should be this considered a bug?
> >
> > :echo match('abc def','\<',0)
> > 0
> > :echo match('abc def','\<',1)
> > 1 instead of 4
>      I think this was brought up a week or two ago, and Bram's reply was
> that it has worked this way for a while, and changing it might cause
> problems.

Still, the following is strange:
    :echo match("abcde abcde",'\<',0,3) prints 2
Shall not it print 6 ?

Ya
--
 
  [hidden email]

--
http://www.fastmail.fm - I mean, what is it about a decent email service?