jkunstle / rpms / vim

Forked from rpms/vim 3 years ago
Clone

Blame SOURCES/7.4.572

3ef2ca
To: vim_dev@googlegroups.com
3ef2ca
Subject: Patch 7.4.572
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.572
3ef2ca
Problem:    Address type of :wincmd depends on the argument.
3ef2ca
Solution:   Check the argument.
3ef2ca
Files:	    src/ex_docmd.c, src/window.c, src/proto/window.pro
3ef2ca
3ef2ca
3ef2ca
*** ../vim-7.4.571/src/ex_docmd.c	2015-01-14 11:24:51.851582151 +0100
3ef2ca
--- src/ex_docmd.c	2015-01-14 14:48:24.586468863 +0100
3ef2ca
***************
3ef2ca
*** 2130,2151 ****
3ef2ca
   * is equal to the lower.
3ef2ca
   */
3ef2ca
  
3ef2ca
-     if (ea.cmdidx != CMD_SIZE
3ef2ca
- #ifdef FEAT_USR_CMDS
3ef2ca
- 	&& ea.cmdidx != CMD_USER
3ef2ca
- 	&& ea.cmdidx != CMD_USER_BUF
3ef2ca
- #endif
3ef2ca
-        )
3ef2ca
- 	ea.addr_type = cmdnames[(int)ea.cmdidx].cmd_addr_type;
3ef2ca
-     else
3ef2ca
- #ifdef FEAT_USR_CMDS
3ef2ca
- 	if (ea.cmdidx != CMD_USER && ea.cmdidx != CMD_USER_BUF)
3ef2ca
- #endif
3ef2ca
- 	ea.addr_type = ADDR_LINES;
3ef2ca
      /* ea.addr_type for user commands is set by find_ucmd */
3ef2ca
!     ea.cmd = cmd;
3ef2ca
  
3ef2ca
      /* repeat for all ',' or ';' separated addresses */
3ef2ca
      for (;;)
3ef2ca
      {
3ef2ca
  	ea.line1 = ea.line2;
3ef2ca
--- 2130,2152 ----
3ef2ca
   * is equal to the lower.
3ef2ca
   */
3ef2ca
  
3ef2ca
      /* ea.addr_type for user commands is set by find_ucmd */
3ef2ca
!     if (!IS_USER_CMDIDX(ea.cmdidx))
3ef2ca
!     {
3ef2ca
! 	if (ea.cmdidx != CMD_SIZE)
3ef2ca
! 	    ea.addr_type = cmdnames[(int)ea.cmdidx].cmd_addr_type;
3ef2ca
! 	else
3ef2ca
! 	    ea.addr_type = ADDR_LINES;
3ef2ca
! 
3ef2ca
! #ifdef FEAT_WINDOWS
3ef2ca
! 	/* :wincmd range depends on the argument. */
3ef2ca
! 	if (ea.cmdidx == CMD_wincmd)
3ef2ca
! 	    get_wincmd_addr_type(p, &ea);
3ef2ca
! #endif
3ef2ca
!     }
3ef2ca
  
3ef2ca
      /* repeat for all ',' or ';' separated addresses */
3ef2ca
+     ea.cmd = cmd;
3ef2ca
      for (;;)
3ef2ca
      {
3ef2ca
  	ea.line1 = ea.line2;
3ef2ca
***************
3ef2ca
*** 2181,2187 ****
3ef2ca
  	{
3ef2ca
  	    if (*ea.cmd == '%')		    /* '%' - all lines */
3ef2ca
  	    {
3ef2ca
- 		buf_T	*buf;
3ef2ca
  		++ea.cmd;
3ef2ca
  		switch (ea.addr_type)
3ef2ca
  		{
3ef2ca
--- 2182,2187 ----
3ef2ca
***************
3ef2ca
*** 2190,2204 ****
3ef2ca
  			ea.line2 = curbuf->b_ml.ml_line_count;
3ef2ca
  			break;
3ef2ca
  		    case ADDR_LOADED_BUFFERS:
3ef2ca
! 			buf = firstbuf;
3ef2ca
! 			while (buf->b_next != NULL && buf->b_ml.ml_mfp == NULL)
3ef2ca
! 			    buf = buf->b_next;
3ef2ca
! 			ea.line1 = buf->b_fnum;
3ef2ca
! 			buf = lastbuf;
3ef2ca
! 			while (buf->b_prev != NULL && buf->b_ml.ml_mfp == NULL)
3ef2ca
! 			    buf = buf->b_prev;
3ef2ca
! 			ea.line2 = buf->b_fnum;
3ef2ca
! 			break;
3ef2ca
  		    case ADDR_BUFFERS:
3ef2ca
  			ea.line1 = firstbuf->b_fnum;
3ef2ca
  			ea.line2 = lastbuf->b_fnum;
3ef2ca
--- 2190,2209 ----
3ef2ca
  			ea.line2 = curbuf->b_ml.ml_line_count;
3ef2ca
  			break;
3ef2ca
  		    case ADDR_LOADED_BUFFERS:
3ef2ca
! 			{
3ef2ca
! 			    buf_T	*buf = firstbuf;
3ef2ca
! 
3ef2ca
! 			    while (buf->b_next != NULL
3ef2ca
! 						  && buf->b_ml.ml_mfp == NULL)
3ef2ca
! 				buf = buf->b_next;
3ef2ca
! 			    ea.line1 = buf->b_fnum;
3ef2ca
! 			    buf = lastbuf;
3ef2ca
! 			    while (buf->b_prev != NULL
3ef2ca
! 						  && buf->b_ml.ml_mfp == NULL)
3ef2ca
! 				buf = buf->b_prev;
3ef2ca
! 			    ea.line2 = buf->b_fnum;
3ef2ca
! 			    break;
3ef2ca
! 			}
3ef2ca
  		    case ADDR_BUFFERS:
3ef2ca
  			ea.line1 = firstbuf->b_fnum;
3ef2ca
  			ea.line2 = lastbuf->b_fnum;
3ef2ca
*** ../vim-7.4.571/src/window.c	2014-12-13 03:58:03.794672546 +0100
3ef2ca
--- src/window.c	2015-01-14 15:17:18.543647480 +0100
3ef2ca
***************
3ef2ca
*** 624,629 ****
3ef2ca
--- 624,733 ----
3ef2ca
      }
3ef2ca
  }
3ef2ca
  
3ef2ca
+ /*
3ef2ca
+  * Figure out the address type for ":wnncmd".
3ef2ca
+  */
3ef2ca
+     void
3ef2ca
+ get_wincmd_addr_type(arg, eap)
3ef2ca
+     char_u	*arg;
3ef2ca
+     exarg_T	*eap;
3ef2ca
+ {
3ef2ca
+     switch (*arg)
3ef2ca
+     {
3ef2ca
+     case 'S':
3ef2ca
+     case Ctrl_S:
3ef2ca
+     case 's':
3ef2ca
+     case Ctrl_N:
3ef2ca
+     case 'n':
3ef2ca
+     case 'j':
3ef2ca
+     case Ctrl_J:
3ef2ca
+     case 'k':
3ef2ca
+     case Ctrl_K:
3ef2ca
+     case 'T':
3ef2ca
+     case Ctrl_R:
3ef2ca
+     case 'r':
3ef2ca
+     case 'R':
3ef2ca
+     case 'K':
3ef2ca
+     case 'J':
3ef2ca
+     case '+':
3ef2ca
+     case '-':
3ef2ca
+     case Ctrl__:
3ef2ca
+     case '_':
3ef2ca
+     case '|':
3ef2ca
+     case ']':
3ef2ca
+     case Ctrl_RSB:
3ef2ca
+     case 'g':
3ef2ca
+     case Ctrl_G:
3ef2ca
+ #ifdef FEAT_VERTSPLIT
3ef2ca
+     case Ctrl_V:
3ef2ca
+     case 'v':
3ef2ca
+     case 'h':
3ef2ca
+     case Ctrl_H:
3ef2ca
+     case 'l':
3ef2ca
+     case Ctrl_L:
3ef2ca
+     case 'H':
3ef2ca
+     case 'L':
3ef2ca
+     case '>':
3ef2ca
+     case '<':
3ef2ca
+ #endif
3ef2ca
+ #if defined(FEAT_QUICKFIX)
3ef2ca
+     case '}':
3ef2ca
+ #endif
3ef2ca
+ #ifdef FEAT_SEARCHPATH
3ef2ca
+     case 'f':
3ef2ca
+     case 'F':
3ef2ca
+     case Ctrl_F:
3ef2ca
+ #endif
3ef2ca
+ #ifdef FEAT_FIND_ID
3ef2ca
+     case 'i':
3ef2ca
+     case Ctrl_I:
3ef2ca
+     case 'd':
3ef2ca
+     case Ctrl_D:
3ef2ca
+ #endif
3ef2ca
+ 		/* window size or any count */
3ef2ca
+ 		eap->addr_type = ADDR_LINES;
3ef2ca
+ 		break;
3ef2ca
+ 
3ef2ca
+     case Ctrl_HAT:
3ef2ca
+     case '^':
3ef2ca
+ 		/* buffer number */
3ef2ca
+ 		eap->addr_type = ADDR_BUFFERS;
3ef2ca
+ 		break;
3ef2ca
+ 
3ef2ca
+     case Ctrl_Q:
3ef2ca
+     case 'q':
3ef2ca
+     case Ctrl_C:
3ef2ca
+     case 'c':
3ef2ca
+     case Ctrl_O:
3ef2ca
+     case 'o':
3ef2ca
+     case Ctrl_W:
3ef2ca
+     case 'w':
3ef2ca
+     case 'W':
3ef2ca
+     case 'x':
3ef2ca
+     case Ctrl_X:
3ef2ca
+ 		/* window number */
3ef2ca
+ 		eap->addr_type = ADDR_WINDOWS;
3ef2ca
+ 		break;
3ef2ca
+ 
3ef2ca
+ #if defined(FEAT_QUICKFIX)
3ef2ca
+     case Ctrl_Z:
3ef2ca
+     case 'z':
3ef2ca
+     case 'P':
3ef2ca
+ #endif
3ef2ca
+     case 't':
3ef2ca
+     case Ctrl_T:
3ef2ca
+     case 'b':
3ef2ca
+     case Ctrl_B:
3ef2ca
+     case 'p':
3ef2ca
+     case Ctrl_P:
3ef2ca
+     case '=':
3ef2ca
+     case CAR:
3ef2ca
+ 		/* no count */
3ef2ca
+ 		eap->addr_type = 0;
3ef2ca
+ 		break;
3ef2ca
+     }
3ef2ca
+ }
3ef2ca
+ 
3ef2ca
      static void
3ef2ca
  cmd_with_count(cmd, bufp, bufsize, Prenum)
3ef2ca
      char	*cmd;
3ef2ca
*** ../vim-7.4.571/src/proto/window.pro	2014-12-17 14:47:52.870412129 +0100
3ef2ca
--- src/proto/window.pro	2015-01-14 15:16:37.544092744 +0100
3ef2ca
***************
3ef2ca
*** 1,5 ****
3ef2ca
--- 1,6 ----
3ef2ca
  /* window.c */
3ef2ca
  void do_window __ARGS((int nchar, long Prenum, int xchar));
3ef2ca
+ void get_wincmd_addr_type __ARGS((char_u *arg, exarg_T *eap));
3ef2ca
  int win_split __ARGS((int size, int flags));
3ef2ca
  int win_split_ins __ARGS((int size, int flags, win_T *new_wp, int dir));
3ef2ca
  int win_valid __ARGS((win_T *win));
3ef2ca
*** ../vim-7.4.571/src/version.c	2015-01-14 14:08:40.364402377 +0100
3ef2ca
--- src/version.c	2015-01-14 15:46:36.136651958 +0100
3ef2ca
***************
3ef2ca
*** 743,744 ****
3ef2ca
--- 743,746 ----
3ef2ca
  {   /* Add new patch number below this line */
3ef2ca
+ /**/
3ef2ca
+     572,
3ef2ca
  /**/
3ef2ca
3ef2ca
-- 
3ef2ca
From "know your smileys":
3ef2ca
 :^[/   mean-smiley-with-cigarette
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    ///