Karsten Hopp f11e24
To: vim-dev@vim.org
Karsten Hopp f11e24
Subject: Patch 7.0.160
Karsten Hopp f11e24
Fcc: outbox
Karsten Hopp f11e24
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp f11e24
Mime-Version: 1.0
Karsten Hopp f11e24
Content-Type: text/plain; charset=ISO-8859-1
Karsten Hopp f11e24
Content-Transfer-Encoding: 8bit
Karsten Hopp f11e24
------------
Karsten Hopp f11e24
Karsten Hopp f11e24
Patch 7.0.160
Karsten Hopp f11e24
Problem:    ":@a" echoes the command, Vi doesn't do that.
Karsten Hopp f11e24
Solution:   Set the silent flag in the typeahead buffer to avoid echoing the
Karsten Hopp f11e24
            command.
Karsten Hopp f11e24
Files:      src/ex_docmd.c, src/normal.c, src/ops.c, src/proto/ops.pro
Karsten Hopp f11e24
Karsten Hopp f11e24
Karsten Hopp f11e24
*** ../vim-7.0.159/src/ex_docmd.c	Tue Oct 24 13:02:27 2006
Karsten Hopp f11e24
--- src/ex_docmd.c	Tue Nov  7 17:42:52 2006
Karsten Hopp f11e24
***************
Karsten Hopp f11e24
*** 8219,8226 ****
Karsten Hopp f11e24
      c = *eap->arg;
Karsten Hopp f11e24
      if (c == NUL || (c == '*' && *eap->cmd == '*'))
Karsten Hopp f11e24
  	c = '@';
Karsten Hopp f11e24
!     /* put the register in mapbuf */
Karsten Hopp f11e24
!     if (do_execreg(c, TRUE, vim_strchr(p_cpo, CPO_EXECBUF) != NULL) == FAIL)
Karsten Hopp f11e24
      {
Karsten Hopp f11e24
  	beep_flush();
Karsten Hopp f11e24
      }
Karsten Hopp f11e24
--- 8219,8227 ----
Karsten Hopp f11e24
      c = *eap->arg;
Karsten Hopp f11e24
      if (c == NUL || (c == '*' && *eap->cmd == '*'))
Karsten Hopp f11e24
  	c = '@';
Karsten Hopp f11e24
!     /* Put the register in the typeahead buffer with the "silent" flag. */
Karsten Hopp f11e24
!     if (do_execreg(c, TRUE, vim_strchr(p_cpo, CPO_EXECBUF) != NULL, TRUE)
Karsten Hopp f11e24
! 								      == FAIL)
Karsten Hopp f11e24
      {
Karsten Hopp f11e24
  	beep_flush();
Karsten Hopp f11e24
      }
Karsten Hopp f11e24
*** ../vim-7.0.159/src/normal.c	Tue Oct 17 22:40:14 2006
Karsten Hopp f11e24
--- src/normal.c	Tue Nov  7 17:42:59 2006
Karsten Hopp f11e24
***************
Karsten Hopp f11e24
*** 8860,8866 ****
Karsten Hopp f11e24
  #endif
Karsten Hopp f11e24
      while (cap->count1-- && !got_int)
Karsten Hopp f11e24
      {
Karsten Hopp f11e24
! 	if (do_execreg(cap->nchar, FALSE, FALSE) == FAIL)
Karsten Hopp f11e24
  	{
Karsten Hopp f11e24
  	    clearopbeep(cap->oap);
Karsten Hopp f11e24
  	    break;
Karsten Hopp f11e24
--- 8860,8866 ----
Karsten Hopp f11e24
  #endif
Karsten Hopp f11e24
      while (cap->count1-- && !got_int)
Karsten Hopp f11e24
      {
Karsten Hopp f11e24
! 	if (do_execreg(cap->nchar, FALSE, FALSE, FALSE) == FAIL)
Karsten Hopp f11e24
  	{
Karsten Hopp f11e24
  	    clearopbeep(cap->oap);
Karsten Hopp f11e24
  	    break;
Karsten Hopp f11e24
*** ../vim-7.0.159/src/ops.c	Tue Oct 17 16:26:52 2006
Karsten Hopp f11e24
--- src/ops.c	Tue Nov  7 17:52:30 2006
Karsten Hopp f11e24
***************
Karsten Hopp f11e24
*** 95,102 ****
Karsten Hopp f11e24
  static void block_insert __ARGS((oparg_T *oap, char_u *s, int b_insert, struct block_def*bdp));
Karsten Hopp f11e24
  #endif
Karsten Hopp f11e24
  static int	stuff_yank __ARGS((int, char_u *));
Karsten Hopp f11e24
! static void	put_reedit_in_typebuf __ARGS((void));
Karsten Hopp f11e24
! static int	put_in_typebuf __ARGS((char_u *s, int colon));
Karsten Hopp f11e24
  static void	stuffescaped __ARGS((char_u *arg, int literally));
Karsten Hopp f11e24
  #ifdef FEAT_MBYTE
Karsten Hopp f11e24
  static void	mb_adjust_opend __ARGS((oparg_T *oap));
Karsten Hopp f11e24
--- 95,102 ----
Karsten Hopp f11e24
  static void block_insert __ARGS((oparg_T *oap, char_u *s, int b_insert, struct block_def*bdp));
Karsten Hopp f11e24
  #endif
Karsten Hopp f11e24
  static int	stuff_yank __ARGS((int, char_u *));
Karsten Hopp f11e24
! static void	put_reedit_in_typebuf __ARGS((int silent));
Karsten Hopp f11e24
! static int	put_in_typebuf __ARGS((char_u *s, int colon, int silent));
Karsten Hopp f11e24
  static void	stuffescaped __ARGS((char_u *arg, int literally));
Karsten Hopp f11e24
  #ifdef FEAT_MBYTE
Karsten Hopp f11e24
  static void	mb_adjust_opend __ARGS((oparg_T *oap));
Karsten Hopp f11e24
***************
Karsten Hopp f11e24
*** 1120,1129 ****
Karsten Hopp f11e24
   * return FAIL for failure, OK otherwise
Karsten Hopp f11e24
   */
Karsten Hopp f11e24
      int
Karsten Hopp f11e24
! do_execreg(regname, colon, addcr)
Karsten Hopp f11e24
      int	    regname;
Karsten Hopp f11e24
      int	    colon;		/* insert ':' before each line */
Karsten Hopp f11e24
      int	    addcr;		/* always add '\n' to end of line */
Karsten Hopp f11e24
  {
Karsten Hopp f11e24
      static int	lastc = NUL;
Karsten Hopp f11e24
      long	i;
Karsten Hopp f11e24
--- 1120,1130 ----
Karsten Hopp f11e24
   * return FAIL for failure, OK otherwise
Karsten Hopp f11e24
   */
Karsten Hopp f11e24
      int
Karsten Hopp f11e24
! do_execreg(regname, colon, addcr, silent)
Karsten Hopp f11e24
      int	    regname;
Karsten Hopp f11e24
      int	    colon;		/* insert ':' before each line */
Karsten Hopp f11e24
      int	    addcr;		/* always add '\n' to end of line */
Karsten Hopp f11e24
+     int	    silent;		/* set "silent" flag in typeahead buffer */
Karsten Hopp f11e24
  {
Karsten Hopp f11e24
      static int	lastc = NUL;
Karsten Hopp f11e24
      long	i;
Karsten Hopp f11e24
***************
Karsten Hopp f11e24
*** 1173,1181 ****
Karsten Hopp f11e24
  	    /* When in Visual mode "'<,'>" will be prepended to the command.
Karsten Hopp f11e24
  	     * Remove it when it's already there. */
Karsten Hopp f11e24
  	    if (VIsual_active && STRNCMP(p, "'<,'>", 5) == 0)
Karsten Hopp f11e24
! 		retval = put_in_typebuf(p + 5, TRUE);
Karsten Hopp f11e24
  	    else
Karsten Hopp f11e24
! 		retval = put_in_typebuf(p, TRUE);
Karsten Hopp f11e24
  	}
Karsten Hopp f11e24
  	vim_free(p);
Karsten Hopp f11e24
      }
Karsten Hopp f11e24
--- 1174,1182 ----
Karsten Hopp f11e24
  	    /* When in Visual mode "'<,'>" will be prepended to the command.
Karsten Hopp f11e24
  	     * Remove it when it's already there. */
Karsten Hopp f11e24
  	    if (VIsual_active && STRNCMP(p, "'<,'>", 5) == 0)
Karsten Hopp f11e24
! 		retval = put_in_typebuf(p + 5, TRUE, silent);
Karsten Hopp f11e24
  	    else
Karsten Hopp f11e24
! 		retval = put_in_typebuf(p, TRUE, silent);
Karsten Hopp f11e24
  	}
Karsten Hopp f11e24
  	vim_free(p);
Karsten Hopp f11e24
      }
Karsten Hopp f11e24
***************
Karsten Hopp f11e24
*** 1186,1192 ****
Karsten Hopp f11e24
  	p = get_expr_line();
Karsten Hopp f11e24
  	if (p == NULL)
Karsten Hopp f11e24
  	    return FAIL;
Karsten Hopp f11e24
! 	retval = put_in_typebuf(p, colon);
Karsten Hopp f11e24
  	vim_free(p);
Karsten Hopp f11e24
      }
Karsten Hopp f11e24
  #endif
Karsten Hopp f11e24
--- 1187,1193 ----
Karsten Hopp f11e24
  	p = get_expr_line();
Karsten Hopp f11e24
  	if (p == NULL)
Karsten Hopp f11e24
  	    return FAIL;
Karsten Hopp f11e24
! 	retval = put_in_typebuf(p, colon, silent);
Karsten Hopp f11e24
  	vim_free(p);
Karsten Hopp f11e24
      }
Karsten Hopp f11e24
  #endif
Karsten Hopp f11e24
***************
Karsten Hopp f11e24
*** 1198,1204 ****
Karsten Hopp f11e24
  	    EMSG(_(e_noinstext));
Karsten Hopp f11e24
  	    return FAIL;
Karsten Hopp f11e24
  	}
Karsten Hopp f11e24
! 	retval = put_in_typebuf(p, colon);
Karsten Hopp f11e24
  	vim_free(p);
Karsten Hopp f11e24
      }
Karsten Hopp f11e24
      else
Karsten Hopp f11e24
--- 1199,1205 ----
Karsten Hopp f11e24
  	    EMSG(_(e_noinstext));
Karsten Hopp f11e24
  	    return FAIL;
Karsten Hopp f11e24
  	}
Karsten Hopp f11e24
! 	retval = put_in_typebuf(p, colon, silent);
Karsten Hopp f11e24
  	vim_free(p);
Karsten Hopp f11e24
      }
Karsten Hopp f11e24
      else
Karsten Hopp f11e24
***************
Karsten Hopp f11e24
*** 1213,1232 ****
Karsten Hopp f11e24
  	/*
Karsten Hopp f11e24
  	 * Insert lines into typeahead buffer, from last one to first one.
Karsten Hopp f11e24
  	 */
Karsten Hopp f11e24
! 	put_reedit_in_typebuf();
Karsten Hopp f11e24
  	for (i = y_current->y_size; --i >= 0; )
Karsten Hopp f11e24
  	{
Karsten Hopp f11e24
  	    /* insert NL between lines and after last line if type is MLINE */
Karsten Hopp f11e24
  	    if (y_current->y_type == MLINE || i < y_current->y_size - 1
Karsten Hopp f11e24
  								     || addcr)
Karsten Hopp f11e24
  	    {
Karsten Hopp f11e24
! 		if (ins_typebuf((char_u *)"\n", remap, 0, TRUE, FALSE) == FAIL)
Karsten Hopp f11e24
  		    return FAIL;
Karsten Hopp f11e24
  	    }
Karsten Hopp f11e24
! 	    if (ins_typebuf(y_current->y_array[i], remap, 0, TRUE, FALSE)
Karsten Hopp f11e24
  								      == FAIL)
Karsten Hopp f11e24
  		return FAIL;
Karsten Hopp f11e24
! 	    if (colon && ins_typebuf((char_u *)":", remap, 0, TRUE, FALSE)
Karsten Hopp f11e24
  								      == FAIL)
Karsten Hopp f11e24
  		return FAIL;
Karsten Hopp f11e24
  	}
Karsten Hopp f11e24
--- 1214,1233 ----
Karsten Hopp f11e24
  	/*
Karsten Hopp f11e24
  	 * Insert lines into typeahead buffer, from last one to first one.
Karsten Hopp f11e24
  	 */
Karsten Hopp f11e24
! 	put_reedit_in_typebuf(silent);
Karsten Hopp f11e24
  	for (i = y_current->y_size; --i >= 0; )
Karsten Hopp f11e24
  	{
Karsten Hopp f11e24
  	    /* insert NL between lines and after last line if type is MLINE */
Karsten Hopp f11e24
  	    if (y_current->y_type == MLINE || i < y_current->y_size - 1
Karsten Hopp f11e24
  								     || addcr)
Karsten Hopp f11e24
  	    {
Karsten Hopp f11e24
! 		if (ins_typebuf((char_u *)"\n", remap, 0, TRUE, silent) == FAIL)
Karsten Hopp f11e24
  		    return FAIL;
Karsten Hopp f11e24
  	    }
Karsten Hopp f11e24
! 	    if (ins_typebuf(y_current->y_array[i], remap, 0, TRUE, silent)
Karsten Hopp f11e24
  								      == FAIL)
Karsten Hopp f11e24
  		return FAIL;
Karsten Hopp f11e24
! 	    if (colon && ins_typebuf((char_u *)":", remap, 0, TRUE, silent)
Karsten Hopp f11e24
  								      == FAIL)
Karsten Hopp f11e24
  		return FAIL;
Karsten Hopp f11e24
  	}
Karsten Hopp f11e24
***************
Karsten Hopp f11e24
*** 1240,1246 ****
Karsten Hopp f11e24
   * used only after other typeahead has been processed.
Karsten Hopp f11e24
   */
Karsten Hopp f11e24
      static void
Karsten Hopp f11e24
! put_reedit_in_typebuf()
Karsten Hopp f11e24
  {
Karsten Hopp f11e24
      char_u	buf[3];
Karsten Hopp f11e24
  
Karsten Hopp f11e24
--- 1241,1248 ----
Karsten Hopp f11e24
   * used only after other typeahead has been processed.
Karsten Hopp f11e24
   */
Karsten Hopp f11e24
      static void
Karsten Hopp f11e24
! put_reedit_in_typebuf(silent)
Karsten Hopp f11e24
!     int		silent;
Karsten Hopp f11e24
  {
Karsten Hopp f11e24
      char_u	buf[3];
Karsten Hopp f11e24
  
Karsten Hopp f11e24
***************
Karsten Hopp f11e24
*** 1257,1281 ****
Karsten Hopp f11e24
  	    buf[0] = restart_edit == 'I' ? 'i' : restart_edit;
Karsten Hopp f11e24
  	    buf[1] = NUL;
Karsten Hopp f11e24
  	}
Karsten Hopp f11e24
! 	if (ins_typebuf(buf, REMAP_NONE, 0, TRUE, FALSE) == OK)
Karsten Hopp f11e24
  	    restart_edit = NUL;
Karsten Hopp f11e24
      }
Karsten Hopp f11e24
  }
Karsten Hopp f11e24
  
Karsten Hopp f11e24
      static int
Karsten Hopp f11e24
! put_in_typebuf(s, colon)
Karsten Hopp f11e24
      char_u	*s;
Karsten Hopp f11e24
      int		colon;	    /* add ':' before the line */
Karsten Hopp f11e24
  {
Karsten Hopp f11e24
      int		retval = OK;
Karsten Hopp f11e24
  
Karsten Hopp f11e24
!     put_reedit_in_typebuf();
Karsten Hopp f11e24
      if (colon)
Karsten Hopp f11e24
! 	retval = ins_typebuf((char_u *)"\n", REMAP_YES, 0, TRUE, FALSE);
Karsten Hopp f11e24
      if (retval == OK)
Karsten Hopp f11e24
! 	retval = ins_typebuf(s, REMAP_YES, 0, TRUE, FALSE);
Karsten Hopp f11e24
      if (colon && retval == OK)
Karsten Hopp f11e24
! 	retval = ins_typebuf((char_u *)":", REMAP_YES, 0, TRUE, FALSE);
Karsten Hopp f11e24
      return retval;
Karsten Hopp f11e24
  }
Karsten Hopp f11e24
  
Karsten Hopp f11e24
--- 1259,1284 ----
Karsten Hopp f11e24
  	    buf[0] = restart_edit == 'I' ? 'i' : restart_edit;
Karsten Hopp f11e24
  	    buf[1] = NUL;
Karsten Hopp f11e24
  	}
Karsten Hopp f11e24
! 	if (ins_typebuf(buf, REMAP_NONE, 0, TRUE, silent) == OK)
Karsten Hopp f11e24
  	    restart_edit = NUL;
Karsten Hopp f11e24
      }
Karsten Hopp f11e24
  }
Karsten Hopp f11e24
  
Karsten Hopp f11e24
      static int
Karsten Hopp f11e24
! put_in_typebuf(s, colon, silent)
Karsten Hopp f11e24
      char_u	*s;
Karsten Hopp f11e24
      int		colon;	    /* add ':' before the line */
Karsten Hopp f11e24
+     int		silent;
Karsten Hopp f11e24
  {
Karsten Hopp f11e24
      int		retval = OK;
Karsten Hopp f11e24
  
Karsten Hopp f11e24
!     put_reedit_in_typebuf(silent);
Karsten Hopp f11e24
      if (colon)
Karsten Hopp f11e24
! 	retval = ins_typebuf((char_u *)"\n", REMAP_YES, 0, TRUE, silent);
Karsten Hopp f11e24
      if (retval == OK)
Karsten Hopp f11e24
! 	retval = ins_typebuf(s, REMAP_YES, 0, TRUE, silent);
Karsten Hopp f11e24
      if (colon && retval == OK)
Karsten Hopp f11e24
! 	retval = ins_typebuf((char_u *)":", REMAP_YES, 0, TRUE, silent);
Karsten Hopp f11e24
      return retval;
Karsten Hopp f11e24
  }
Karsten Hopp f11e24
  
Karsten Hopp f11e24
*** ../vim-7.0.159/src/proto/ops.pro	Tue Oct 17 16:26:52 2006
Karsten Hopp f11e24
--- src/proto/ops.pro	Tue Nov  7 18:08:35 2006
Karsten Hopp f11e24
***************
Karsten Hopp f11e24
*** 17,23 ****
Karsten Hopp f11e24
  extern void put_register __ARGS((int name, void *reg));
Karsten Hopp f11e24
  extern int yank_register_mline __ARGS((int regname));
Karsten Hopp f11e24
  extern int do_record __ARGS((int c));
Karsten Hopp f11e24
! extern int do_execreg __ARGS((int regname, int colon, int addcr));
Karsten Hopp f11e24
  extern int insert_reg __ARGS((int regname, int literally));
Karsten Hopp f11e24
  extern int get_spec_reg __ARGS((int regname, char_u **argp, int *allocated, int errmsg));
Karsten Hopp f11e24
  extern int cmdline_paste_reg __ARGS((int regname, int literally, int remcr));
Karsten Hopp f11e24
--- 17,23 ----
Karsten Hopp f11e24
  extern void put_register __ARGS((int name, void *reg));
Karsten Hopp f11e24
  extern int yank_register_mline __ARGS((int regname));
Karsten Hopp f11e24
  extern int do_record __ARGS((int c));
Karsten Hopp f11e24
! extern int do_execreg __ARGS((int regname, int colon, int addcr, int silent));
Karsten Hopp f11e24
  extern int insert_reg __ARGS((int regname, int literally));
Karsten Hopp f11e24
  extern int get_spec_reg __ARGS((int regname, char_u **argp, int *allocated, int errmsg));
Karsten Hopp f11e24
  extern int cmdline_paste_reg __ARGS((int regname, int literally, int remcr));
Karsten Hopp f11e24
*** ../vim-7.0.159/src/version.c	Tue Nov  7 18:02:19 2006
Karsten Hopp f11e24
--- src/version.c	Tue Nov  7 18:05:36 2006
Karsten Hopp f11e24
***************
Karsten Hopp f11e24
*** 668,669 ****
Karsten Hopp f11e24
--- 668,671 ----
Karsten Hopp f11e24
  {   /* Add new patch number below this line */
Karsten Hopp f11e24
+ /**/
Karsten Hopp f11e24
+     160,
Karsten Hopp f11e24
  /**/
Karsten Hopp f11e24
Karsten Hopp f11e24
-- 
Karsten Hopp f11e24
hundred-and-one symptoms of being an internet addict:
Karsten Hopp f11e24
172. You join listservers just for the extra e-mail.
Karsten Hopp f11e24
Karsten Hopp f11e24
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp f11e24
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp f11e24
\\\        download, build and distribute -- http://www.A-A-P.org        ///
Karsten Hopp f11e24
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///