Blame SOURCES/7.4.543

22c937
To: vim_dev@googlegroups.com
22c937
Subject: Patch 7.4.543
22c937
Fcc: outbox
22c937
From: Bram Moolenaar <Bram@moolenaar.net>
22c937
Mime-Version: 1.0
22c937
Content-Type: text/plain; charset=UTF-8
22c937
Content-Transfer-Encoding: 8bit
22c937
------------
22c937
22c937
Patch 7.4.543
22c937
Problem:    Since patch 7.4.232 "1,3s/\n//" joins two lines instead of three.
22c937
	    (Eliseo Martínez)  Issue 287
22c937
Solution:   Correct the line count. (Christian Brabandt)
22c937
	    Also set the last used search pattern.
22c937
Files:	    src/ex_cmds.c, src/search.c, src/proto/search.pro
22c937
22c937
22c937
*** ../vim-7.4.542/src/ex_cmds.c	2014-11-30 13:34:16.889626728 +0100
22c937
--- src/ex_cmds.c	2014-12-13 03:11:09.032894963 +0100
22c937
***************
22c937
*** 4408,4413 ****
22c937
--- 4408,4415 ----
22c937
  	    && (*cmd == NUL || (cmd[1] == NUL && (*cmd == 'g' || *cmd == 'l'
22c937
  					     || *cmd == 'p' || *cmd == '#'))))
22c937
      {
22c937
+ 	linenr_T    joined_lines_count;
22c937
+ 
22c937
  	curwin->w_cursor.lnum = eap->line1;
22c937
  	if (*cmd == 'l')
22c937
  	    eap->flags = EXFLAG_LIST;
22c937
***************
22c937
*** 4416,4425 ****
22c937
  	else if (*cmd == 'p')
22c937
  	    eap->flags = EXFLAG_PRINT;
22c937
  
22c937
! 	(void)do_join(eap->line2 - eap->line1 + 1, FALSE, TRUE, FALSE, TRUE);
22c937
! 	sub_nlines = sub_nsubs = eap->line2 - eap->line1 + 1;
22c937
! 	(void)do_sub_msg(FALSE);
22c937
! 	ex_may_print(eap);
22c937
  	return;
22c937
      }
22c937
  
22c937
--- 4418,4444 ----
22c937
  	else if (*cmd == 'p')
22c937
  	    eap->flags = EXFLAG_PRINT;
22c937
  
22c937
! 	/* The number of lines joined is the number of lines in the range plus
22c937
! 	 * one.  One less when the last line is included. */
22c937
! 	joined_lines_count = eap->line2 - eap->line1 + 1;
22c937
! 	if (eap->line2 < curbuf->b_ml.ml_line_count)
22c937
! 	    ++joined_lines_count;
22c937
! 	if (joined_lines_count > 1)
22c937
! 	{
22c937
! 	    (void)do_join(joined_lines_count, FALSE, TRUE, FALSE, TRUE);
22c937
! 	    sub_nsubs = joined_lines_count - 1;
22c937
! 	    sub_nlines = 1;
22c937
! 	    (void)do_sub_msg(FALSE);
22c937
! 	    ex_may_print(eap);
22c937
! 	}
22c937
! 
22c937
! 	if (!cmdmod.keeppatterns)
22c937
! 	    save_re_pat(RE_SUBST, pat, p_magic);
22c937
! #ifdef FEAT_CMDHIST
22c937
! 	/* put pattern in history */
22c937
! 	add_to_history(HIST_SEARCH, pat, TRUE, NUL);
22c937
! #endif
22c937
! 
22c937
  	return;
22c937
      }
22c937
  
22c937
*** ../vim-7.4.542/src/search.c	2014-11-27 17:29:52.770188864 +0100
22c937
--- src/search.c	2014-12-13 03:12:18.032159491 +0100
22c937
***************
22c937
*** 12,18 ****
22c937
  
22c937
  #include "vim.h"
22c937
  
22c937
- static void save_re_pat __ARGS((int idx, char_u *pat, int magic));
22c937
  #ifdef FEAT_EVAL
22c937
  static void set_vv_searchforward __ARGS((void));
22c937
  static int first_submatch __ARGS((regmmatch_T *rp));
22c937
--- 12,17 ----
22c937
***************
22c937
*** 272,278 ****
22c937
  }
22c937
  #endif
22c937
  
22c937
!     static void
22c937
  save_re_pat(idx, pat, magic)
22c937
      int		idx;
22c937
      char_u	*pat;
22c937
--- 271,277 ----
22c937
  }
22c937
  #endif
22c937
  
22c937
!     void
22c937
  save_re_pat(idx, pat, magic)
22c937
      int		idx;
22c937
      char_u	*pat;
22c937
*** ../vim-7.4.542/src/proto/search.pro	2013-08-10 13:37:25.000000000 +0200
22c937
--- src/proto/search.pro	2014-12-13 03:12:21.440123253 +0100
22c937
***************
22c937
*** 2,7 ****
22c937
--- 2,8 ----
22c937
  int search_regcomp __ARGS((char_u *pat, int pat_save, int pat_use, int options, regmmatch_T *regmatch));
22c937
  char_u *get_search_pat __ARGS((void));
22c937
  char_u *reverse_text __ARGS((char_u *s));
22c937
+ void save_re_pat __ARGS((int idx, char_u *pat, int magic));
22c937
  void save_search_patterns __ARGS((void));
22c937
  void restore_search_patterns __ARGS((void));
22c937
  void free_search_patterns __ARGS((void));
22c937
*** ../vim-7.4.542/src/version.c	2014-12-08 04:16:26.273702793 +0100
22c937
--- src/version.c	2014-12-13 02:54:27.295570327 +0100
22c937
***************
22c937
*** 743,744 ****
22c937
--- 743,746 ----
22c937
  {   /* Add new patch number below this line */
22c937
+ /**/
22c937
+     543,
22c937
  /**/
22c937
22c937
-- 
22c937
For large projects, Team Leaders use sophisticated project management software
22c937
to keep track of who's doing what.  The software collects the lies and guesses
22c937
of the project team and organizes them in to instantly outdated charts that
22c937
are too boring to look at closely.  This is called "planning".
22c937
				(Scott Adams - The Dilbert principle)
22c937
22c937
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
22c937
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
22c937
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
22c937
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///