Christian Brabandt wrote:
> Hi Benjamin!
>
> (re-posting to vim-dev, for clarity).
>
> On Fr, 05 Nov 2010, Benjamin R. Haskell wrote:
>
> > I still don't quite understand why my attempted solution to rameo's
> > problem didn't work... As a pared down example, why is the entire
> > visual range matched in this:
> >
> > x = outside visual block, V = nonspaces in visual, ' ' = space in visual
> >
> > /\%V\%(\S\+\s*\)*\%V
> >
> > xxxxx VVV VVV VVV xxxxx - text
> > mmmmmmmmmmmmmmm - match
> > xxxxx VVV xxxxx - text
> > mmmmmmm - match
> >
> > I don't understand how the leading spaces in the visual range can be
> > matched by a pattern that can't match leading spaces.
>
> I think, I understand this part. This part boils down to a visual
> selection item followed by zero or more of a sequence of any number of
> non-space items followed by zero or more space. In other words, this can
> match /\%V\%V and in fact that is what it matches.
>
> > Removing the optionality, it's also weird, as the trailing space
> > (singular!?) isn't matched:
> >
> > /\%V\S\+\s*\%V
> > xxxxx VVV VVV VVV xxxxx - text
> > mmmmmmmmmmmm - match
> > xxxxx VVV xxxxx - text
> > mmmm - match
> >
> > Can anyone shed some light on this?
>
> This is a bug. The regular expression engine is quite complex in Vim. I
> think, the attached patch fixes it.
Thanks for making a patch.
Like you say, the regular expression code is very complex. Therefore we
should test as much as we can. I've had it on my todo list to add many
tests for the regexp engine, but nothing much got done yet. This is
also needed to switch to the faster regexp engine that's available.
Can you at least add a test for this specific issue?
--
BRIDGEKEEPER: What is your favorite colour?
LAUNCELOT: Blue.
BRIDGEKEEPER: Right. Off you go.
"Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD
/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ download, build and distribute -- http://www.A-A-P.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php