James McCoy wrote:
> MatchParen uses knowledge of how the character under the cursor is
> highlighted to help guide its matching. However, it is only looking at
> the top-most item in the syntax stack, which may not match the patterns
> being checked.
>
> The behavior of matchparen in the following zsh script demonstrates the
> problem.
>
> $ cat foo.zsh
> #! /bin/zsh
> Data_Path_Saved="${HOME}/some/valid/path/"
> SavedFilesList=("${(f@)$(ls ${Data_Path_Saved}**/*(.))}")
> print "Found ${#SavedFilesList} files."
>
> In this case, the problematic line is
>
> SavedFilesList=("${(f@)$(ls ${Data_Path_Saved}**/*(.))}")
> / / \
> cursor expected actual
> match match
>
> The syntax of the ")" to the left of the expected match is zshString.
> This causes searchpairpos() to skip over it when trying to match the "("
> under the cursor because it isn't also a "string" syntax item. However,
> the entire syntax stack for the cursor's position is ['zshParentheses',
> 'zshString', 'zshSubst', 'zshSubst', 'zshSubstDelim'].
>
> The attached patch changes matchparen to check the whole syntax stack.
> I also added some more comments about exactly how this part works
> because it took me a few reads to grok what was going on. Hopefully the
> comments make it a little clearer for the next reader.
Thanks for looking into this and making a patch.
I would appreciate a few people to try this out on different file types.
--
Q: What kind of stuff do you do?
A: I collect hobbies.
/// 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/d/optout.