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