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