Loading ...
Sorry, an error occurred while loading the content.

Parenthesis match highlighting isn't updated when only the match is moved with =

Expand Messages
  • Marc Aldorasi
    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
    Message 1 of 4 , Feb 9, 2013
    • 0 Attachment
      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.

      A copy of bugreport.txt is attached.

      --
      --
      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 vim_dev+unsubscribe@....
      For more options, visit https://groups.google.com/groups/opt_out.
    • Bram Moolenaar
      ... Thanks for the clear explanation, I can reproduce the problem. -- Sometimes I think the surest sign that intelligent life exists elsewhere in the universe
      Message 2 of 4 , Feb 10, 2013
      • 0 Attachment
        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.

        --
        Sometimes I think the surest sign that intelligent life exists elsewhere
        in the universe is that none of it has tried to contact us. (Calvin)

        /// Bram Moolenaar -- Bram@... -- 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 vim_dev+unsubscribe@....
        For more options, visit https://groups.google.com/groups/opt_out.
      • Christian Brabandt
        Hi Bram! ... 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
        Message 3 of 4 , Feb 13, 2013
        • 0 Attachment
          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 vim_dev+unsubscribe@....
          For more options, visit https://groups.google.com/groups/opt_out.
        • Bram Moolenaar
          ... Thanks for the hint. I ll have a closer look later. -- BEDEVERE: Stand by for attack!! [CUT TO enormous army forming up. Trebuchets, rows of PIKEMEN,
          Message 4 of 4 , Feb 13, 2013
          • 0 Attachment
            Christian Brabandt wrote:

            > 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

            Thanks for the hint. I'll have a closer look later.

            --
            BEDEVERE: Stand by for attack!!
            [CUT TO enormous army forming up. Trebuchets, rows of PIKEMEN, siege
            towers, pennants flying, shouts of "Stand by for attack!" Traditional
            army build-up shots. The shouts echo across the ranks of the army.
            We see various groups reacting, and stirring themselves in readiness.]
            ARTHUR: Who are they?
            BEDEVERE: Oh, just some friends!
            "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

            /// Bram Moolenaar -- Bram@... -- 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 vim_dev+unsubscribe@....
            For more options, visit https://groups.google.com/groups/opt_out.
          Your message has been successfully submitted and would be delivered to recipients shortly.