On Wed, November 10, 2010 12:45 pm, Bram Moolenaar wrote: > Christian Brabandt wrote: >> 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.
Well, as James pointed out, it's not the correct way to fix it. I haven't found a proper way to fix it. > > 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? Sure, but first this issue needs to be fixed properly. regards, Christian -- 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
