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

Behaviour changed in 7.1.025 regarding excmds and ?foo? address

Expand Messages
  • ap
    ==buffer== foo bar foo ... In versions prior to 7.1.025, this effectively swapped the 2nd and 3rd line. Since patch 7.1.025 this does nothing, apparently
    Message 1 of 2 , Mar 2, 2008
    • 0 Attachment
      ==buffer==
      foo
      bar
      foo
      =========

      :3|.m?foo?

      In versions prior to 7.1.025, this effectively swapped the 2nd and 3rd
      line.
      Since patch 7.1.025 this does nothing, apparently because the
      pattern does match in the 3rd instead of the 1st line.

      The patch is very small and here it goes :


      Patch 7.1.025
      Problem: search() and searchpos() don't use match under cursor at
      start of
      line when using 'bc' flags. (Viktor Kojouharov)
      Solution: Don't go to the previous line when the 'c' flag is
      present.
      Also fix that "j" doesn't move the cursor to the right column.
      Files: src/eval.c, src/search.c


      *** ../vim-7.1.024/src/eval.c Tue Jun 19 17:23:46 2007
      --- src/eval.c Thu Jul 5 21:16:31 2007
      ***************
      *** 13925,13930 ****
      --- 13925,13932 ----
      /* If 'n' flag is used: restore cursor position. */
      if (flags & SP_NOMOVE)
      curwin->w_cursor = save_cursor;
      + else
      + curwin->w_set_curswant = TRUE;
      theend:
      p_ws = save_p_ws;

      *** ../vim-7.1.024/src/search.c Tue Jul 10 13:07:08 2007
      --- src/search.c Thu Jul 5 21:18:55 2007
      ***************
      *** 573,580 ****
      /*
      * Start searching in current line, unless searching backwards and
      * we're in column 0.
      */
      ! if (dir == BACKWARD && start_pos.col == 0)
      {
      lnum = pos->lnum - 1;
      at_first_line = FALSE;
      --- 573,584 ----
      /*
      * Start searching in current line, unless searching backwards and
      * we're in column 0.
      + * If we are searching backwards, in column 0, and not including
      the
      + * current position, gain some efficiency by skipping back a line.
      + * Otherwise begin the search in the current line.
      */
      ! if (dir == BACKWARD && start_pos.col == 0
      ! && (options & SEARCH_START) == 0)
      {
      lnum = pos->lnum - 1;
      at_first_line = FALSE;
      *** ../vim-7.1.024/src/version.c Tue Jul 10 13:07:08 2007
      --- src/version.c Tue Jul 10 13:26:13 2007
      ***************
      *** 668,669 ****
      --- 668,671 ----
      { /* Add new patch number below this line */
      + /**/
      + 25,
      /**/

      --


      --~--~---------~--~----~------------~-------~--~----~
      You received this message from the "vim_dev" maillist.
      For more information, visit http://www.vim.org/maillist.php
      -~----------~----~----~----~------~----~------~--~---
    • Bram Moolenaar
      ... Hmm, why did the code for Ex addresses use the SEARCH_START flag? Not clear to me at all. If I remove it the search appears to work properly: ...
      Message 2 of 2 , Mar 2, 2008
      • 0 Attachment
        A.Politz wrote:

        > ==buffer==
        > foo
        > bar
        > foo
        > =========
        >
        > :3|.m?foo?
        >
        > In versions prior to 7.1.025, this effectively swapped the 2nd and 3rd
        > line.
        > Since patch 7.1.025 this does nothing, apparently because the
        > pattern does match in the 3rd instead of the 1st line.

        Hmm, why did the code for Ex addresses use the SEARCH_START flag? Not
        clear to me at all. If I remove it the search appears to work properly:

        *** ../vim-7.1.266/src/ex_docmd.c Tue Feb 26 21:29:06 2008
        --- src/ex_docmd.c Sun Mar 2 20:50:43 2008
        ***************
        *** 3932,3939 ****
        curwin->w_cursor.col = 0;
        searchcmdlen = 0;
        if (!do_search(NULL, c, cmd, 1L,
        ! SEARCH_HIS + SEARCH_MSG + SEARCH_START,
        ! NULL))
        {
        curwin->w_cursor = pos;
        cmd = NULL;
        --- 3932,3938 ----
        curwin->w_cursor.col = 0;
        searchcmdlen = 0;
        if (!do_search(NULL, c, cmd, 1L,
        ! SEARCH_HIS | SEARCH_MSG, NULL))
        {
        curwin->w_cursor = pos;
        cmd = NULL;
        ***************
        *** 3980,3987 ****
        pos.col = 0;
        if (searchit(curwin, curbuf, &pos,
        *cmd == '?' ? BACKWARD : FORWARD,
        ! (char_u *)"", 1L,
        ! SEARCH_MSG + SEARCH_START,
        i, (linenr_T)0, NULL) != FAIL)
        lnum = pos.lnum;
        else
        --- 3979,3985 ----
        pos.col = 0;
        if (searchit(curwin, curbuf, &pos,
        *cmd == '?' ? BACKWARD : FORWARD,
        ! (char_u *)"", 1L, SEARCH_MSG,
        i, (linenr_T)0, NULL) != FAIL)
        lnum = pos.lnum;
        else
        *** ../vim-7.1.266/src/search.c Wed Feb 20 13:41:14 2008
        --- src/search.c Sun Mar 2 20:49:59 2008
        ***************
        *** 538,544 ****
        return FAIL;
        }

        ! if (options & SEARCH_START)
        extra_col = 0;
        #ifdef FEAT_MBYTE
        /* Watch out for the "col" being MAXCOL - 2, used in a closed fold. */
        --- 538,544 ----
        return FAIL;
        }

        ! if ((options & SEARCH_START) || pos->col == MAXCOL)
        extra_col = 0;
        #ifdef FEAT_MBYTE
        /* Watch out for the "col" being MAXCOL - 2, used in a closed fold. */


        --
        hundred-and-one symptoms of being an internet addict:
        83. Batteries in the TV remote now last for months.

        /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
        /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
        \\\ download, build and distribute -- http://www.A-A-P.org ///
        \\\ help me help AIDS victims -- http://ICCF-Holland.org ///

        --~--~---------~--~----~------------~-------~--~----~
        You received this message from the "vim_dev" maillist.
        For more information, visit http://www.vim.org/maillist.php
        -~----------~----~----~----~------~----~------~--~---
      Your message has been successfully submitted and would be delivered to recipients shortly.