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

Patch 7.3.871

Expand Messages
  • Bram Moolenaar
    Patch 7.3.871 Problem: search( ^$ , c ) does not use the empty match under the cursor. Solution: Special handling of the c flag. (Christian Brabandt)
    Message 1 of 6 , Mar 19 7:28 AM
    • 0 Attachment
      Patch 7.3.871
      Problem: search('^$', 'c') does not use the empty match under the cursor.
      Solution: Special handling of the 'c' flag. (Christian Brabandt)
      Add tests.
      Files: src/search.c, src/testdir/test14.in, src/testdir/test14.ok


      *** ../vim-7.3.870/src/search.c 2013-02-20 18:39:07.000000000 +0100
      --- src/search.c 2013-03-19 15:23:13.000000000 +0100
      ***************
      *** 727,732 ****
      --- 727,734 ----
      ++matchcol;
      }
      }
      + if (options & SEARCH_START)
      + break;
      if (ptr[matchcol] == NUL
      || (nmatched = vim_regexec_multi(®match,
      win, buf, lnum + matchpos.lnum,
      *** ../vim-7.3.870/src/testdir/test14.in 2010-08-15 21:57:29.000000000 +0200
      --- src/testdir/test14.in 2013-03-19 15:21:54.000000000 +0100
      ***************
      *** 2,7 ****
      --- 2,8 ----
      Also test ":s/pat/sub/" with different ~s in sub.
      Also test for ^Vxff and ^Vo123 in Insert mode.
      Also test "[m", "]m", "[M" and "]M"
      + Also test search()

      STARTTEST
      :so small.vim
      ***************
      *** 34,39 ****
      --- 35,50 ----
      2[MaJ :.w >>test.out
      k[MaK :.w >>test.out
      3[MaL :.w >>test.out
      + :"
      + /^foobar
      + :let startline = line('.')
      + :call search('foobar', 'c')
      + :call append(line('$'), line('.') - startline)
      + j:call search('^$', 'c')
      + :call append(line('$'), line('.') - startline)
      + :call search('^$', 'bc')
      + :call append(line('$'), line('.') - startline)
      + :/^search()/,$w >>test.out
      :qa!
      ENDTEST

      ***************
      *** 64,66 ****
      --- 75,82 ----
      }
      } e3
      }
      +
      + foobar
      +
      +
      + search()
      *** ../vim-7.3.870/src/testdir/test14.ok 2010-08-15 21:57:29.000000000 +0200
      --- src/testdir/test14.ok 2013-03-19 15:26:18.000000000 +0100
      ***************
      *** 15,17 ****
      --- 15,21 ----
      }JH e3
      }K e2
      {LF
      + search()
      + 0
      + 1
      + 1
      *** ../vim-7.3.870/src/version.c 2013-03-19 14:48:25.000000000 +0100
      --- src/version.c 2013-03-19 15:26:38.000000000 +0100
      ***************
      *** 730,731 ****
      --- 730,733 ----
      { /* Add new patch number below this line */
      + /**/
      + 871,
      /**/

      --
      hundred-and-one symptoms of being an internet addict:
      75. You start wondering whether you could actually upgrade your brain
      with a Pentium Pro microprocessor 80. The upgrade works just fine.

      /// 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.
    • Sung Pae
      ... Unfortunately, this patch breaks forward searching with the SEARCH_START flag set: foo bar| baz Cursor at | ... This places the cursor at column 1
      Message 2 of 6 , Mar 23 2:31 AM
      • 0 Attachment
        On Tue, Mar 19, 2013 at 03:28:07PM +0100, Bram Moolenaar wrote:
        >
        > Patch 7.3.871
        > Problem: search('^$', 'c') does not use the empty match under the cursor.
        > Solution: Special handling of the 'c' flag. (Christian Brabandt)
        > Add tests.
        > Files: src/search.c, src/testdir/test14.in, > src/testdir/test14.ok

        Unfortunately, this patch breaks forward searching with the SEARCH_START
        flag set:

        foo bar| baz " Cursor at |

        :call search('.', 'c')

        This places the cursor at column 1 instead of staying put as expected.
        The problem is that simply breaking the column advance loop if
        SEARCH_START is set will break all searches instead of just ones for the
        empty line "^$".

        Since matches at an empty line result in matchcol == 0, adding that to
        the conditional fixes just that corner case without affecting all other
        searches with the 'c' flag.

        Simple patch is attached.

        Sung Pae

        --
        --
        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.
      • Sung Pae
        ... Actually attach patch.
        Message 3 of 6 , Mar 23 2:33 AM
        • 0 Attachment
          On Sat, Mar 23, 2013 at 04:31:42AM -0500, Sung Pae wrote:
          > On Tue, Mar 19, 2013 at 03:28:07PM +0100, Bram Moolenaar wrote:
          > >
          > > Patch 7.3.871
          > > Problem: search('^$', 'c') does not use the empty match under the cursor.
          > > Solution: Special handling of the 'c' flag. (Christian Brabandt)
          > > Add tests.
          > > Files: src/search.c, src/testdir/test14.in, > src/testdir/test14.ok
          >
          > Unfortunately, this patch breaks forward searching with the SEARCH_START
          > flag set:
          >
          > foo bar| baz " Cursor at |
          >
          > :call search('.', 'c')
          >
          > This places the cursor at column 1 instead of staying put as expected.
          > The problem is that simply breaking the column advance loop if
          > SEARCH_START is set will break all searches instead of just ones for the
          > empty line "^$".
          >
          > Since matches at an empty line result in matchcol == 0, adding that to
          > the conditional fixes just that corner case without affecting all other
          > searches with the 'c' flag.
          >
          > Simple patch is attached.
          >
          > Sung Pae

          Actually attach patch.
        • Bram Moolenaar
          ... Thanks! Apparently the tests didn t catch this mistake. Would be nice to have a test for this. -- From know your smileys : (:-# Said something he
          Message 4 of 6 , Mar 23 7:00 AM
          • 0 Attachment
            Sung Pae wrote:

            > On Sat, Mar 23, 2013 at 04:31:42AM -0500, Sung Pae wrote:
            > > On Tue, Mar 19, 2013 at 03:28:07PM +0100, Bram Moolenaar wrote:
            > > >
            > > > Patch 7.3.871
            > > > Problem: search('^$', 'c') does not use the empty match under the cursor.
            > > > Solution: Special handling of the 'c' flag. (Christian Brabandt)
            > > > Add tests.
            > > > Files: src/search.c, src/testdir/test14.in, > src/testdir/test14.ok
            > >
            > > Unfortunately, this patch breaks forward searching with the SEARCH_START
            > > flag set:
            > >
            > > foo bar| baz " Cursor at |
            > >
            > > :call search('.', 'c')
            > >
            > > This places the cursor at column 1 instead of staying put as expected.
            > > The problem is that simply breaking the column advance loop if
            > > SEARCH_START is set will break all searches instead of just ones for the
            > > empty line "^$".
            > >
            > > Since matches at an empty line result in matchcol == 0, adding that to
            > > the conditional fixes just that corner case without affecting all other
            > > searches with the 'c' flag.
            > >
            > > Simple patch is attached.
            > >
            > > Sung Pae
            >
            > Actually attach patch.

            Thanks!

            Apparently the tests didn't catch this mistake. Would be nice to have a
            test for this.


            --
            From "know your smileys":
            (:-# Said something he shouldn't have

            /// 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.
          • Sung Pae
            ... Great! Attached is the previous patch plus a test: one two Cursor is at letter `t`, search forward with `c`, then write current line from current column to
            Message 5 of 6 , Mar 23 12:58 PM
            • 0 Attachment
              On Sat, Mar 23, 2013 at 03:00:48PM +0100, Bram Moolenaar wrote:

              > Thanks!
              >
              > Apparently the tests didn't catch this mistake. Would be nice to have a
              > test for this.

              Great! Attached is the previous patch plus a test:

              one two

              Cursor is at letter `t`, search forward with `c`, then write current
              line from current column to EOL. Failing test writes `one two`, passing
              test writes `two`.

              Thank you.

              Sung Pae
            • Bram Moolenaar
              ... Thanks. The more complex Vim gets, the more important it is to have tests. -- ... /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net
              Message 6 of 6 , Mar 23 1:51 PM
              • 0 Attachment
                Sung Pae wrote:

                > On Sat, Mar 23, 2013 at 03:00:48PM +0100, Bram Moolenaar wrote:
                >
                > > Thanks!
                > >
                > > Apparently the tests didn't catch this mistake. Would be nice to have a
                > > test for this.
                >
                > Great! Attached is the previous patch plus a test:
                >
                > one two
                >
                > Cursor is at letter `t`, search forward with `c`, then write current
                > line from current column to EOL. Failing test writes `one two`, passing
                > test writes `two`.

                Thanks. The more complex Vim gets, the more important it is to have
                tests.


                --
                From "know your smileys":
                :-X My lips are sealed

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