Lech Lorens wrote:
> Matchit does not work in a 2-line C file with the following contents:
> #if FOO
> #endif
>
> Steps to reproduce:
> vim -u NONE -U NONE
> :set nocompatible
> :filetype plugin indent on
> :syntax on
> :setf c
> :runtime macros/matchit.vim
> :call append(line('$'), "#if FOO")
> :call append(line('$'), "#endif")
> :1del _
> :normal 1G0
> :normal %
>
> Note that the cursor does not move to the second line until you set
> re=1. This boils down to the following condition in s:Wholematch being
> true for re=0 and false for re=1:
> if a:string !~ prefix . group . suffix
>
> with a:string being "#if FOO" and the regexp
> "^\%(\%((\|)\|{\|}\|[\|]\|^\s*#\s*if\(\|def\|ndef\)\>\|^\s*#\s*elif\>\|^\s*#\s*else\>\|^\s*#\s*endif\>\|(\|)\|{\|}\|\[\|\]\|\/\*\|\*\/\|#\s*if\%(def\)\=\|#\s*else\>\|#\s*elif\>\|#\s*endif\>\)\)\(\%>1c.*$\)\@="
>
> Sorry, I couldn't simplify it any further; for some reason this does not
> work when put in a simple script as follows (both produce 1):
>
> set re=1
> echo "string !~ regexp == " . string(string !~ regexp)
> set re=2
> echo "string !~ regexp == " . string(string !~ regexp)
I can reproduce the problem. With regexp logging enabled I can see
where it fails. I'll add a fix. And a test.
--
hundred-and-one symptoms of being an internet addict:
227. You sleep next to your monitor. Or on top of it.
/// Bram Moolenaar -- [email protected] -- 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 ///
--
--
You received this message from the "vim_dev" 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
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.