Hi Bram!
On So, 10 Feb 2013, Bram Moolenaar wrote:
>
> Marc Aldorasi wrote:
>
> > Steps to reproduce:
> >
> > 0. Have the matchparen plugin enabled.
> >
> > 1. Create a file with the following 3 lines:
> >
> > {
> > {
> > }
> >
> > 2. Move to the second line, and indent it with "=="
> >
> > 2.5 Notice that the brace on the third line is highlighted.
> >
> > 3. Type "=j" to indent the third line.
> >
> > What I expected:
> >
> > The highlighting on the third line should move with the brace.
> >
> > What actually happened:
> >
> > The highlighting on the third line did not move even though the brace
> > did. This is especially noticeable if you indent with tabs, as the
> > entire tab width is highlighted.
> >
> > This also happens if I use parens instead of braces, and happens even
> > when I start vim with " vim -u NONE +'set nocp | runtime
> > plugin/matchparen.vim' ". It also happens if there is other text
> > between the braces, and if I use "==" instead of "=j". It does not
> > happen if the first brace moves along with the second. The highlighting
> > returns to normal if the cursor is moved within the window, or if I
> > switch to another window and then switch back.
>
> Thanks for the clear explanation, I can reproduce the problem.
It's complicated to make this work as the user expects it. I think the
easiest solution is something like this patch, which makes sure the
matching parenthesis are actually at the required position (though in
the case above, it would only match the first parenthesis) until the
user moves the cursor, but this should be acceptable.
--- a/runtime/plugin/matchparen.vim
+++ b/runtime/plugin/matchparen.vim
@@ -138,7 +138,7 @@
" If a match is found setup match highlighting.
if m_lnum > 0 && m_lnum >= stoplinetop && m_lnum <= stoplinebottom
exe '3match MatchParen /\(\%' . c_lnum . 'l\%' . (c_col - before) .
- \ 'c\)\|\(\%' . m_lnum . 'l\%' . m_col . 'c\)/'
+ \ 'c\)\|\(\%' . m_lnum . 'l\%' . m_col . 'c\)['.c.c2.']/'
let w:paren_hl_on = 1
endif
endfunction
regards,
Christian
--
--
--
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.