jkunstle / rpms / vim

Forked from rpms/vim 3 years ago
Clone

Blame SOURCES/7.4.546

3ef2ca
To: vim_dev@googlegroups.com
3ef2ca
Subject: Patch 7.4.546
3ef2ca
Fcc: outbox
3ef2ca
From: Bram Moolenaar <Bram@moolenaar.net>
3ef2ca
Mime-Version: 1.0
3ef2ca
Content-Type: text/plain; charset=UTF-8
3ef2ca
Content-Transfer-Encoding: 8bit
3ef2ca
------------
3ef2ca
3ef2ca
Patch 7.4.546
3ef2ca
Problem:    Repeated use of vim_snprintf() with a number.
3ef2ca
Solution:   Move these vim_snprintf() calls into a function.
3ef2ca
Files:	    src/window.c
3ef2ca
3ef2ca
3ef2ca
*** ../vim-7.4.545/src/window.c	2014-11-27 16:22:42.746412995 +0100
3ef2ca
--- src/window.c	2014-12-13 03:54:57.760646343 +0100
3ef2ca
***************
3ef2ca
*** 11,16 ****
3ef2ca
--- 11,17 ----
3ef2ca
  
3ef2ca
  static int path_is_url __ARGS((char_u *p));
3ef2ca
  #if defined(FEAT_WINDOWS) || defined(PROTO)
3ef2ca
+ static void cmd_with_count __ARGS((char *cmd, char_u *bufp, size_t bufsize, long Prenum));
3ef2ca
  static void win_init __ARGS((win_T *newp, win_T *oldp, int flags));
3ef2ca
  static void win_init_some __ARGS((win_T *newp, win_T *oldp));
3ef2ca
  static void frame_comp_pos __ARGS((frame_T *topfrp, int *row, int *col));
3ef2ca
***************
3ef2ca
*** 167,176 ****
3ef2ca
      case '^':
3ef2ca
  		CHECK_CMDWIN
3ef2ca
  		reset_VIsual_and_resel();	/* stop Visual mode */
3ef2ca
! 		STRCPY(cbuf, "split #");
3ef2ca
! 		if (Prenum)
3ef2ca
! 		    vim_snprintf((char *)cbuf + 7, sizeof(cbuf) - 7,
3ef2ca
! 							       "%ld", Prenum);
3ef2ca
  		do_cmdline_cmd(cbuf);
3ef2ca
  		break;
3ef2ca
  
3ef2ca
--- 168,174 ----
3ef2ca
      case '^':
3ef2ca
  		CHECK_CMDWIN
3ef2ca
  		reset_VIsual_and_resel();	/* stop Visual mode */
3ef2ca
! 		cmd_with_count("split #", cbuf, sizeof(cbuf), Prenum);
3ef2ca
  		do_cmdline_cmd(cbuf);
3ef2ca
  		break;
3ef2ca
  
3ef2ca
***************
3ef2ca
*** 199,208 ****
3ef2ca
      case Ctrl_Q:
3ef2ca
      case 'q':
3ef2ca
  		reset_VIsual_and_resel();	/* stop Visual mode */
3ef2ca
! 		STRCPY(cbuf, "quit");
3ef2ca
! 		if (Prenum)
3ef2ca
! 		    vim_snprintf((char *)cbuf + 4, sizeof(cbuf) - 5,
3ef2ca
! 							    "%ld", Prenum);
3ef2ca
  		do_cmdline_cmd(cbuf);
3ef2ca
  		break;
3ef2ca
  
3ef2ca
--- 197,203 ----
3ef2ca
      case Ctrl_Q:
3ef2ca
      case 'q':
3ef2ca
  		reset_VIsual_and_resel();	/* stop Visual mode */
3ef2ca
! 		cmd_with_count("quit", cbuf, sizeof(cbuf), Prenum);
3ef2ca
  		do_cmdline_cmd(cbuf);
3ef2ca
  		break;
3ef2ca
  
3ef2ca
***************
3ef2ca
*** 210,219 ****
3ef2ca
      case Ctrl_C:
3ef2ca
      case 'c':
3ef2ca
  		reset_VIsual_and_resel();	/* stop Visual mode */
3ef2ca
! 		STRCPY(cbuf, "close");
3ef2ca
! 		if (Prenum)
3ef2ca
! 		    vim_snprintf((char *)cbuf + 5, sizeof(cbuf) - 5,
3ef2ca
! 							       "%ld", Prenum);
3ef2ca
  		do_cmdline_cmd(cbuf);
3ef2ca
  		break;
3ef2ca
  
3ef2ca
--- 205,211 ----
3ef2ca
      case Ctrl_C:
3ef2ca
      case 'c':
3ef2ca
  		reset_VIsual_and_resel();	/* stop Visual mode */
3ef2ca
! 		cmd_with_count("close", cbuf, sizeof(cbuf), Prenum);
3ef2ca
  		do_cmdline_cmd(cbuf);
3ef2ca
  		break;
3ef2ca
  
3ef2ca
***************
3ef2ca
*** 243,252 ****
3ef2ca
      case 'o':
3ef2ca
  		CHECK_CMDWIN
3ef2ca
  		reset_VIsual_and_resel();	/* stop Visual mode */
3ef2ca
! 		STRCPY(cbuf, "only");
3ef2ca
! 		if (Prenum > 0)
3ef2ca
! 		    vim_snprintf((char *)cbuf + 4, sizeof(cbuf) - 4,
3ef2ca
! 								"%ld", Prenum);
3ef2ca
  		do_cmdline_cmd(cbuf);
3ef2ca
  		break;
3ef2ca
  
3ef2ca
--- 235,241 ----
3ef2ca
      case 'o':
3ef2ca
  		CHECK_CMDWIN
3ef2ca
  		reset_VIsual_and_resel();	/* stop Visual mode */
3ef2ca
! 		cmd_with_count("only", cbuf, sizeof(cbuf), Prenum);
3ef2ca
  		do_cmdline_cmd(cbuf);
3ef2ca
  		break;
3ef2ca
  
3ef2ca
***************
3ef2ca
*** 635,640 ****
3ef2ca
--- 624,643 ----
3ef2ca
      }
3ef2ca
  }
3ef2ca
  
3ef2ca
+     static void
3ef2ca
+ cmd_with_count(cmd, bufp, bufsize, Prenum)
3ef2ca
+     char	*cmd;
3ef2ca
+     char_u	*bufp;
3ef2ca
+     size_t	bufsize;
3ef2ca
+     long	Prenum;
3ef2ca
+ {
3ef2ca
+     size_t	len = STRLEN(cmd);
3ef2ca
+ 
3ef2ca
+     STRCPY(bufp, cmd);
3ef2ca
+     if (Prenum > 0)
3ef2ca
+ 	vim_snprintf((char *)bufp + len, bufsize - len, "%ld", Prenum);
3ef2ca
+ }
3ef2ca
+ 
3ef2ca
  /*
3ef2ca
   * split the current window, implements CTRL-W s and :split
3ef2ca
   *
3ef2ca
*** ../vim-7.4.545/src/version.c	2014-12-13 03:36:34.992435104 +0100
3ef2ca
--- src/version.c	2014-12-13 03:43:58.447663037 +0100
3ef2ca
***************
3ef2ca
*** 743,744 ****
3ef2ca
--- 743,746 ----
3ef2ca
  {   /* Add new patch number below this line */
3ef2ca
+ /**/
3ef2ca
+     546,
3ef2ca
  /**/
3ef2ca
3ef2ca
-- 
3ef2ca
The only way the average employee can speak to an executive is by taking a
3ef2ca
second job as a golf caddie.
3ef2ca
				(Scott Adams - The Dilbert principle)
3ef2ca
3ef2ca
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
3ef2ca
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
3ef2ca
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
3ef2ca
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///