Kana Natsuno wrote:

> "@:" - repeat last command-line - doesn't work if ":" is mapped to
> something.
> The following is a patch to fix this bug.
> 
> 
> *** src/ops.c~  Mon Apr 27 17:06:58 2009
> --- src/ops.c   Tue Jan 19 12:08:41 2010
> *************** put_in_typebuf(s, esc, colon, silent)
> *** 1327,1333 ****
>             vim_free(p);
>       }
>       if (colon && retval == OK)
> !       retval = ins_typebuf((char_u *)":", REMAP_YES, 0, TRUE,
> silent);
>       return retval;
>   }
> 
> --- 1327,1333 ----
>             vim_free(p);
>       }
>       if (colon && retval == OK)
> !       retval = ins_typebuf((char_u *)":", REMAP_NONE, 0, TRUE,
> silent);
>       return retval;
>   }

I'm wondering if REMAP_NONE should be used for all calls to
ins_typebuf().  For example, typing:

        :cmap hello hello there
        :echo "hello"
        @:

The first hello results in "hello there" (expanded while typing).
The "@:" results in "hello there there", it's expanded again.  Not
really what you would expect when repeating a command.

However @. appears to contain what is typed, thus the "esc" argument
must be used to decide about remapping.


*** ../vim-7.2.330/src/ops.c    2009-11-25 12:38:49.000000000 +0100
--- src/ops.c   2010-01-19 11:53:54.000000000 +0100
***************
*** 1301,1310 ****
      }
  }
  
      static int
  put_in_typebuf(s, esc, colon, silent)
      char_u    *s;
!     int               esc;        /* Escape CSI characters */
      int               colon;      /* add ':' before the line */
      int               silent;
  {
--- 1301,1316 ----
      }
  }
  
+ /*
+  * Insert register contents "s" into the typeahead buffer, so that it will be
+  * executed again.
+  * When "esc" is TRUE it is to be taken literally: Escape CSI characters and
+  * no remapping.
+  */
      static int
  put_in_typebuf(s, esc, colon, silent)
      char_u    *s;
!     int               esc;
      int               colon;      /* add ':' before the line */
      int               silent;
  {
***************
*** 1312,1318 ****
  
      put_reedit_in_typebuf(silent);
      if (colon)
!       retval = ins_typebuf((char_u *)"\n", REMAP_YES, 0, TRUE, silent);
      if (retval == OK)
      {
        char_u  *p;
--- 1318,1324 ----
  
      put_reedit_in_typebuf(silent);
      if (colon)
!       retval = ins_typebuf((char_u *)"\n", REMAP_NONE, 0, TRUE, silent);
      if (retval == OK)
      {
        char_u  *p;
***************
*** 1324,1335 ****
        if (p == NULL)
            retval = FAIL;
        else
!           retval = ins_typebuf(p, REMAP_YES, 0, TRUE, silent);
        if (esc)
            vim_free(p);
      }
      if (colon && retval == OK)
!       retval = ins_typebuf((char_u *)":", REMAP_YES, 0, TRUE, silent);
      return retval;
  }
  
--- 1330,1342 ----
        if (p == NULL)
            retval = FAIL;
        else
!           retval = ins_typebuf(p, esc ? REMAP_NONE : REMAP_YES,
!                                                            0, TRUE, silent);
        if (esc)
            vim_free(p);
      }
      if (colon && retval == OK)
!       retval = ins_typebuf((char_u *)":", REMAP_NONE, 0, TRUE, silent);
      return retval;
  }
  


-- 
hundred-and-one symptoms of being an internet addict:
115. You are late picking up your kid from school and try to explain
     to the teacher you were stuck in Web traffic.

 /// Bram Moolenaar -- [email protected] -- 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

Raspunde prin e-mail lui