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

Re: showmatch causes screen to scroll (since 7.3.769)

Expand Messages
  • Christian Brabandt
    Hi char101! ... Hm, I don t remember messing with that. I think, this happens, because before 7.3.769 we only jumped when closing braces were inserted and now
    Message 1 of 5 , Feb 20, 2013
    • 0 Attachment
      Hi char101!

      On Mi, 20 Feb 2013, char101 wrote:

      > Hi,
      >
      > I believe some change in patch 7.3.769 causes showmatch behaviour to change
      >
      > Test case
      >
      > - Start with an empty buffer
      > - Type ) in line &lines + 10 (the number of lines visible + 10)
      > - Go to line 1
      > - Type ( in line 5
      >
      > - The screen will scroll so that line 5 is now the first visible line


      Hm, I don't remember messing with that. I think, this happens, because
      before 7.3.769 we only jumped when closing braces were inserted and now
      we jump also on opening braces. Anyways, here is a patch, that makes
      sure a jump is only done, when the matching brace is visible on the
      screen.

      diff --git a/src/search.c b/src/search.c
      --- a/src/search.c
      +++ b/src/search.c
      @@ -2451,8 +2451,9 @@

      if ((lpos = findmatch(NULL, NUL)) == NULL) /* no match, so beep */
      vim_beep();
      - else if (lpos->lnum >= curwin->w_topline)
      + else if (lpos->lnum >= curwin->w_topline && lpos->lnum < curwin->w_topline + curwin->w_height)
      {
      + /* only jump to the matching brace, if it is within the current screen */
      if (!curwin->w_p_wrap)
      getvcol(curwin, lpos, NULL, &vcol, NULL);
      if (curwin->w_p_wrap || (vcol >= curwin->w_leftcol


      Mit freundlichen Grüßen
      Christian
      --
      Was es alles gibt, was ich nicht brauche!
      -- Aristoteles, 384-322 v. Chr.

      --
      --
      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
      ... This actually is a bug in patch 7.3.769. The FEAT_RIGHTLEFT check is done wrong, thus when the rightleft feature is compiled in it only shows a match for
      Message 2 of 5 , Feb 20, 2013
      • 0 Attachment
        Christian Brabandt wrote:

        > On Mi, 20 Feb 2013, char101 wrote:
        >
        > > Hi,
        > >
        > > I believe some change in patch 7.3.769 causes showmatch behaviour to change
        > >
        > > Test case
        > >
        > > - Start with an empty buffer
        > > - Type ) in line &lines + 10 (the number of lines visible + 10)
        > > - Go to line 1
        > > - Type ( in line 5
        > >
        > > - The screen will scroll so that line 5 is now the first visible line
        >
        >
        > Hm, I don't remember messing with that. I think, this happens, because
        > before 7.3.769 we only jumped when closing braces were inserted and now
        > we jump also on opening braces. Anyways, here is a patch, that makes
        > sure a jump is only done, when the matching brace is visible on the
        > screen.
        >
        > diff --git a/src/search.c b/src/search.c
        > --- a/src/search.c
        > +++ b/src/search.c
        > @@ -2451,8 +2451,9 @@
        >
        > if ((lpos = findmatch(NULL, NUL)) == NULL) /* no match, so beep */
        > vim_beep();
        > - else if (lpos->lnum >= curwin->w_topline)
        > + else if (lpos->lnum >= curwin->w_topline && lpos->lnum < curwin->w_topline + curwin->w_height)
        > {
        > + /* only jump to the matching brace, if it is within the current screen */
        > if (!curwin->w_p_wrap)
        > getvcol(curwin, lpos, NULL, &vcol, NULL);
        > if (curwin->w_p_wrap || (vcol >= curwin->w_leftcol

        This actually is a bug in patch 7.3.769. The FEAT_RIGHTLEFT check is
        done wrong, thus when the rightleft feature is compiled in it only shows
        a match for ")", when the feature is missing it also shows a match for
        "(". That should not happen, Vim beeps every time you type a "(" that
        doesn't have a match.

        I'll fix it. Your change is also needed, for when 'revins' is set.
        But we need to compare against w_botline.


        --
        Eye have a spelling checker, it came with my PC;
        It plainly marks four my revue mistakes I cannot sea.
        I've run this poem threw it, I'm sure your please to no,
        It's letter perfect in it's weigh, my checker tolled me sew!

        /// 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.
      • Charles
        ... Hi Christian, Thanks, I understand the problem now. When only showing match for the closing bracket, the test lpos- lnum = curwin- w_topline is sufficient
        Message 3 of 5 , Feb 20, 2013
        • 0 Attachment
          On Wed, Feb 20, 2013 at 7:38 PM, Christian Brabandt <cblists@...> wrote:
          >
          > Hm, I don't remember messing with that. I think, this happens, because
          > before 7.3.769 we only jumped when closing braces were inserted and now
          > we jump also on opening braces.

          Hi Christian,

          Thanks, I understand the problem now. When only showing match for the
          closing bracket, the test

          lpos->lnum >= curwin->w_topline

          is sufficient to test that the match is visible, but whe showing match
          for the opening bracket, that
          line does not correctly test for the match visibility.

          --
          --
          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.