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

[bug] with regular expression and SEARCH_START flag

Expand Messages
  • Christian Brabandt
    Bram, I think I ve found a bug with the regular expression engine: ~$ vim -u NONE -N ... Note how the cursor /does not/ move ... Note, that the cursor
    Message 1 of 3 , Feb 16, 2013
    • 0 Attachment
      Bram,
      I think I've found a bug with the regular expression engine:

      ~$ vim -u NONE -N
      :$put ='foobar'
      :$put =''
      :$put =''
      :/foobar/
      :call search('foobar', 'c')
      " Note how the cursor /does not/ move
      :+
      :call search('^$', 'c')
      " Note, that the cursor /moves/ one line down, although the 'c' flag is
      " given and so the cursor should stay in its actual position
      :call search('^$', 'bc')
      " Note, that when searching backwards, the cursor /does not/ move as
      " expected.

      Sorry for this brief explanation. I hope, you see the problem.
      I am kind of busy currently, so I can't provide a detailed bug report or
      a patch.

      Mit freundlichen Grüßen
      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
      ... I can reproduce it. I hope you can find a fix when you are not busy. -- Mynd you, m00se bites Kan be pretty nasti ... Monty Python and the Holy Grail
      Message 2 of 3 , Feb 16, 2013
      • 0 Attachment
        Christian Brabandt wrote:

        > I think I've found a bug with the regular expression engine:
        >
        > ~$ vim -u NONE -N
        > :$put ='foobar'
        > :$put =''
        > :$put =''
        > :/foobar/
        > :call search('foobar', 'c')
        > " Note how the cursor /does not/ move
        > :+
        > :call search('^$', 'c')
        > " Note, that the cursor /moves/ one line down, although the 'c' flag is
        > " given and so the cursor should stay in its actual position
        > :call search('^$', 'bc')
        > " Note, that when searching backwards, the cursor /does not/ move as
        > " expected.
        >
        > Sorry for this brief explanation. I hope, you see the problem.
        > I am kind of busy currently, so I can't provide a detailed bug report or
        > a patch.

        I can reproduce it. I hope you can find a fix when you are not busy.

        --
        Mynd you, m00se bites Kan be pretty nasti ...
        "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.
      • Christian Brabandt
        Hi Bram! ... This patch fixes it for me: diff --git a/src/search.c b/src/search.c ... +++ b/src/search.c @@ -727,6 +727,8 @@ ++matchcol; } } +
        Message 3 of 3 , Feb 16, 2013
        • 0 Attachment
          Hi Bram!

          On Sa, 16 Feb 2013, Bram Moolenaar wrote:

          >
          > Christian Brabandt wrote:
          >
          > > I think I've found a bug with the regular expression engine:
          > >
          > > ~$ vim -u NONE -N
          > > :$put ='foobar'
          > > :$put =''
          > > :$put =''
          > > :/foobar/
          > > :call search('foobar', 'c')
          > > " Note how the cursor /does not/ move
          > > :+
          > > :call search('^$', 'c')
          > > " Note, that the cursor /moves/ one line down, although the 'c' flag is
          > > " given and so the cursor should stay in its actual position
          > > :call search('^$', 'bc')
          > > " Note, that when searching backwards, the cursor /does not/ move as
          > > " expected.
          > >
          > > Sorry for this brief explanation. I hope, you see the problem.
          > > I am kind of busy currently, so I can't provide a detailed bug report or
          > > a patch.
          >
          > I can reproduce it. I hope you can find a fix when you are not busy.

          This patch fixes it for me:


          diff --git a/src/search.c b/src/search.c
          --- a/src/search.c
          +++ b/src/search.c
          @@ -727,6 +727,8 @@
          ++matchcol;
          }
          }
          + if (options & SEARCH_START)
          + break;
          if (ptr[matchcol] == NUL
          || (nmatched = vim_regexec_multi(®match,
          win, buf, lnum + matchpos.lnum,


          Mit freundlichen Grüßen
          Christian
          --
          Ich brauche das Alleinsein, um den Weg nach innen zu suchen.
          -- Petter Moen

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