jkunstle / rpms / vim

Forked from rpms/vim 3 years ago
Clone

Blame SOURCES/7.4.267

073263
To: vim_dev@googlegroups.com
073263
Subject: Patch 7.4.2
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.267 (after 7.4.178)
073263
Problem:    The '[ mark is in the wrong position after "gq". (Ingo Karkat)
073263
Solution:   Add the setmark argument to do_join(). (Christian Brabandt)
073263
Files:	    src/testdir/Make_amiga.mak, src/testdir/Make_dos.mak,
073263
	    src/testdir/Make_ming.mak, src/testdir/Make_os2.mak,
073263
	    src/testdir/Make_vms.mms, src/testdir/Makefile,
073263
	    src/testdir/test_autoformat_join.in,
073263
	    src/testdir/test_autoformat_join.ok, src/Makefile, src/edit.c,
073263
	    src/ex_cmds.c, src/ex_docmd.c, src/normal.c, src/ops.c,
073263
	    src/proto/ops.pro
073263
073263
073263
*** ../vim-7.4.266/src/testdir/Make_amiga.mak	2014-04-02 19:54:58.275599459 +0200
073263
--- src/testdir/Make_amiga.mak	2014-04-29 12:02:34.144046123 +0200
073263
***************
073263
*** 36,41 ****
073263
--- 36,42 ----
073263
  		test94.out test95.out test96.out test97.out test98.out \
073263
  		test99.out test100.out test101.out test102.out test103.out \
073263
  		test104.out test105.out test106.out \
073263
+ 		test_autoformat_join.out \
073263
  		test_eval.out \
073263
  		test_options.out
073263
  
073263
***************
073263
*** 160,164 ****
073263
--- 161,166 ----
073263
  test104.out: test104.in
073263
  test105.out: test105.in
073263
  test106.out: test106.in
073263
+ test_autoformat_join.out: test_autoformat_join.in
073263
  test_eval.out: test_eval.in
073263
  test_options.out: test_options.in
073263
*** ../vim-7.4.266/src/testdir/Make_dos.mak	2014-04-02 19:54:58.275599459 +0200
073263
--- src/testdir/Make_dos.mak	2014-04-29 12:02:45.128045931 +0200
073263
***************
073263
*** 35,40 ****
073263
--- 35,41 ----
073263
  		test94.out test95.out test96.out test98.out test99.out \
073263
  		test100.out test101.out test102.out test103.out test104.out \
073263
  		test105.out test106.out \
073263
+ 		test_autoformat_join.out \
073263
  		test_eval.out \
073263
  		test_options.out
073263
  
073263
*** ../vim-7.4.266/src/testdir/Make_ming.mak	2014-04-02 19:54:58.275599459 +0200
073263
--- src/testdir/Make_ming.mak	2014-04-29 12:02:54.020045775 +0200
073263
***************
073263
*** 55,60 ****
073263
--- 55,61 ----
073263
  		test94.out test95.out test96.out test98.out test99.out \
073263
  		test100.out test101.out test102.out test103.out test104.out \
073263
  		test105.out test106.out \
073263
+ 		test_autoformat_join.out \
073263
  		test_eval.out \
073263
  		test_options.out
073263
  
073263
*** ../vim-7.4.266/src/testdir/Make_os2.mak	2014-04-02 19:54:58.275599459 +0200
073263
--- src/testdir/Make_os2.mak	2014-04-29 12:03:03.384045611 +0200
073263
***************
073263
*** 37,42 ****
073263
--- 37,43 ----
073263
  		test94.out test95.out test96.out test98.out test99.out \
073263
  		test100.out test101.out test102.out test103.out test104.out \
073263
  		test105.out test106.out \
073263
+ 		test_autoformat_join.out \
073263
  		test_eval.out \
073263
  		test_options.out
073263
  
073263
*** ../vim-7.4.266/src/testdir/Make_vms.mms	2014-04-02 19:54:58.275599459 +0200
073263
--- src/testdir/Make_vms.mms	2014-04-29 12:03:12.200045456 +0200
073263
***************
073263
*** 96,101 ****
073263
--- 96,102 ----
073263
  	 test95.out test96.out test98.out test99.out \
073263
  	 test100.out test101.out test103.out test104.out \
073263
  	 test105.out test106.out \
073263
+ 	 test_autoformat_join.out \
073263
  	 test_eval.out \
073263
  	 test_options.out
073263
  
073263
*** ../vim-7.4.266/src/testdir/Makefile	2014-04-01 14:08:14.685074130 +0200
073263
--- src/testdir/Makefile	2014-04-29 12:02:09.152046561 +0200
073263
***************
073263
*** 33,38 ****
073263
--- 33,40 ----
073263
  		test94.out test95.out test96.out test97.out test98.out \
073263
  		test99.out test100.out test101.out test102.out test103.out \
073263
  		test104.out test105.out test106.out \
073263
+ 		test_autoformat_join.out \
073263
+ 		test_eval.out \
073263
  		test_options.out
073263
  
073263
  SCRIPTS_GUI = test16.out
073263
*** ../vim-7.4.266/src/testdir/test_autoformat_join.in	2014-04-29 12:12:57.324035202 +0200
073263
--- src/testdir/test_autoformat_join.in	2014-04-29 12:00:35.360048205 +0200
073263
***************
073263
*** 0 ****
073263
--- 1,23 ----
073263
+ Tests for setting the '[,'] marks when joining lines.
073263
+ 
073263
+ STARTTEST
073263
+ :so small.vim
073263
+ :/^\t\t/
073263
+ 0gqj?
073263
+ :let a=string(getpos("'[")).'/'.string(getpos("']"))
073263
+ :/^This line/;'}-join
073263
+ :let b=string(getpos("'[")).'/'.string(getpos("']"))
073263
+ :$put ='First test: Start/End '.string(a)
073263
+ :$put ='Second test: Start/End '.string(b)
073263
+ :/^\t\t/,$wq! test.out
073263
+ ENDTEST
073263
+ 
073263
+ 
073263
+ 		O sodales, ludite, vos qui
073263
+ attamen consulite per voster honur. Tua pulchra facies me fay planszer milies
073263
+ 
073263
+ This line.
073263
+ Should be joined with the next line
073263
+ and with this line
073263
+ 
073263
+ Results:
073263
*** ../vim-7.4.266/src/testdir/test_autoformat_join.ok	2014-04-29 12:12:57.332035201 +0200
073263
--- src/testdir/test_autoformat_join.ok	2014-04-29 12:00:35.360048205 +0200
073263
***************
073263
*** 0 ****
073263
--- 1,8 ----
073263
+ 		O sodales, ludite, vos qui attamen consulite per voster honur.
073263
+ Tua pulchra facies me fay planszer milies
073263
+ 
073263
+ This line.  Should be joined with the next line and with this line
073263
+ 
073263
+ Results:
073263
+ First test: Start/End '[0, 16, 1, 0]/[0, 17, 1, 0]'
073263
+ Second test: Start/End '[0, 19, 11, 0]/[0, 19, 67, 0]'
073263
*** ../vim-7.4.266/src/Makefile	2014-04-02 19:54:58.275599459 +0200
073263
--- src/Makefile	2014-04-29 12:03:48.600044818 +0200
073263
***************
073263
*** 1880,1885 ****
073263
--- 1880,1886 ----
073263
  
073263
  # Run individual test, assuming that Vim was already compiled.
073263
  test1 test2 test3 test4 test5 test6 test7 test8 test9 \
073263
+ 	test_autoformat_join \
073263
  	test_eval \
073263
  	test_options \
073263
  	test10 test11 test12 test13 test14 test15 test16 test17 test18 test19 \
073263
*** ../vim-7.4.266/src/edit.c	2014-03-23 15:12:29.915264336 +0100
073263
--- src/edit.c	2014-04-29 12:08:50.608039525 +0200
073263
***************
073263
*** 8685,8691 ****
073263
      {
073263
  	temp = curwin->w_cursor.col;
073263
  	if (!can_bs(BS_EOL)		/* only if "eol" included */
073263
! 		|| do_join(2, FALSE, TRUE, FALSE) == FAIL)
073263
  	    vim_beep();
073263
  	else
073263
  	    curwin->w_cursor.col = temp;
073263
--- 8685,8691 ----
073263
      {
073263
  	temp = curwin->w_cursor.col;
073263
  	if (!can_bs(BS_EOL)		/* only if "eol" included */
073263
! 		|| do_join(2, FALSE, TRUE, FALSE, FALSE) == FAIL)
073263
  	    vim_beep();
073263
  	else
073263
  	    curwin->w_cursor.col = temp;
073263
***************
073263
*** 8866,8872 ****
073263
  			ptr[len - 1] = NUL;
073263
  		}
073263
  
073263
! 		(void)do_join(2, FALSE, FALSE, FALSE);
073263
  		if (temp == NUL && gchar_cursor() != NUL)
073263
  		    inc_cursor();
073263
  	    }
073263
--- 8866,8872 ----
073263
  			ptr[len - 1] = NUL;
073263
  		}
073263
  
073263
! 		(void)do_join(2, FALSE, FALSE, FALSE, FALSE);
073263
  		if (temp == NUL && gchar_cursor() != NUL)
073263
  		    inc_cursor();
073263
  	    }
073263
*** ../vim-7.4.266/src/ex_cmds.c	2014-04-06 20:45:40.119357453 +0200
073263
--- src/ex_cmds.c	2014-04-29 12:08:50.612039525 +0200
073263
***************
073263
*** 4444,4450 ****
073263
  	else if (*cmd == 'p')
073263
  	    eap->flags = EXFLAG_PRINT;
073263
  
073263
! 	(void)do_join(eap->line2 - eap->line1 + 1, FALSE, TRUE, FALSE);
073263
  	sub_nlines = sub_nsubs = eap->line2 - eap->line1 + 1;
073263
  	(void)do_sub_msg(FALSE);
073263
  	ex_may_print(eap);
073263
--- 4444,4450 ----
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
*** ../vim-7.4.266/src/ex_docmd.c	2014-04-02 14:22:00.119874274 +0200
073263
--- src/ex_docmd.c	2014-04-29 12:08:50.616039525 +0200
073263
***************
073263
*** 8717,8723 ****
073263
  	}
073263
  	++eap->line2;
073263
      }
073263
!     (void)do_join(eap->line2 - eap->line1 + 1, !eap->forceit, TRUE, TRUE);
073263
      beginline(BL_WHITE | BL_FIX);
073263
      ex_may_print(eap);
073263
  }
073263
--- 8717,8723 ----
073263
  	}
073263
  	++eap->line2;
073263
      }
073263
!     (void)do_join(eap->line2 - eap->line1 + 1, !eap->forceit, TRUE, TRUE, TRUE);
073263
      beginline(BL_WHITE | BL_FIX);
073263
      ex_may_print(eap);
073263
  }
073263
*** ../vim-7.4.266/src/normal.c	2014-03-23 15:12:29.927264336 +0100
073263
--- src/normal.c	2014-04-29 12:08:50.616039525 +0200
073263
***************
073263
*** 812,818 ****
073263
  
073263
      if (text_locked() && (nv_cmds[idx].cmd_flags & NV_NCW))
073263
      {
073263
! 	/* This command is not allowed while editing a ccmdline: beep. */
073263
  	clearopbeep(oap);
073263
  	text_locked_msg();
073263
  	goto normal_end;
073263
--- 812,818 ----
073263
  
073263
      if (text_locked() && (nv_cmds[idx].cmd_flags & NV_NCW))
073263
      {
073263
! 	/* This command is not allowed while editing a cmdline: beep. */
073263
  	clearopbeep(oap);
073263
  	text_locked_msg();
073263
  	goto normal_end;
073263
***************
073263
*** 1905,1911 ****
073263
  	    else
073263
  	    {
073263
  		(void)do_join(oap->line_count, oap->op_type == OP_JOIN,
073263
! 								  TRUE, TRUE);
073263
  		auto_format(FALSE, TRUE);
073263
  	    }
073263
  	    break;
073263
--- 1905,1911 ----
073263
  	    else
073263
  	    {
073263
  		(void)do_join(oap->line_count, oap->op_type == OP_JOIN,
073263
! 							    TRUE, TRUE, TRUE);
073263
  		auto_format(FALSE, TRUE);
073263
  	    }
073263
  	    break;
073263
***************
073263
*** 9236,9242 ****
073263
  	{
073263
  	    prep_redo(cap->oap->regname, cap->count0,
073263
  			 NUL, cap->cmdchar, NUL, NUL, cap->nchar);
073263
! 	    (void)do_join(cap->count0, cap->nchar == NUL, TRUE, TRUE);
073263
  	}
073263
      }
073263
  }
073263
--- 9236,9242 ----
073263
  	{
073263
  	    prep_redo(cap->oap->regname, cap->count0,
073263
  			 NUL, cap->cmdchar, NUL, NUL, cap->nchar);
073263
! 	    (void)do_join(cap->count0, cap->nchar == NUL, TRUE, TRUE, TRUE);
073263
  	}
073263
      }
073263
  }
073263
*** ../vim-7.4.266/src/ops.c	2014-04-12 12:26:25.856424387 +0200
073263
--- src/ops.c	2014-04-29 12:10:29.428037794 +0200
073263
***************
073263
*** 1979,1985 ****
073263
  		curwin->w_cursor = curpos;	/* restore curwin->w_cursor */
073263
  	    }
073263
  	    if (curwin->w_cursor.lnum < curbuf->b_ml.ml_line_count)
073263
! 		(void)do_join(2, FALSE, FALSE, FALSE);
073263
  	}
073263
      }
073263
  
073263
--- 1979,1985 ----
073263
  		curwin->w_cursor = curpos;	/* restore curwin->w_cursor */
073263
  	    }
073263
  	    if (curwin->w_cursor.lnum < curbuf->b_ml.ml_line_count)
073263
! 		(void)do_join(2, FALSE, FALSE, FALSE, FALSE);
073263
  	}
073263
      }
073263
  
073263
***************
073263
*** 4323,4339 ****
073263
  /*
073263
   * Join 'count' lines (minimal 2) at cursor position.
073263
   * When "save_undo" is TRUE save lines for undo first.
073263
!  * Set "use_formatoptions" to FALSE when e.g. processing
073263
!  * backspace and comment leaders should not be removed.
073263
   *
073263
   * return FAIL for failure, OK otherwise
073263
   */
073263
      int
073263
! do_join(count, insert_space, save_undo, use_formatoptions)
073263
      long    count;
073263
      int	    insert_space;
073263
      int	    save_undo;
073263
      int	    use_formatoptions UNUSED;
073263
  {
073263
      char_u	*curr = NULL;
073263
      char_u      *curr_start = NULL;
073263
--- 4323,4342 ----
073263
  /*
073263
   * Join 'count' lines (minimal 2) at cursor position.
073263
   * When "save_undo" is TRUE save lines for undo first.
073263
!  * Set "use_formatoptions" to FALSE when e.g. processing backspace and comment
073263
!  * leaders should not be removed.
073263
!  * When setmark is TRUE, sets the '[ and '] mark, else, the caller is expected
073263
!  * to set those marks.
073263
   *
073263
   * return FAIL for failure, OK otherwise
073263
   */
073263
      int
073263
! do_join(count, insert_space, save_undo, use_formatoptions, setmark)
073263
      long    count;
073263
      int	    insert_space;
073263
      int	    save_undo;
073263
      int	    use_formatoptions UNUSED;
073263
+     int	    setmark;
073263
  {
073263
      char_u	*curr = NULL;
073263
      char_u      *curr_start = NULL;
073263
***************
073263
*** 4384,4390 ****
073263
      for (t = 0; t < count; ++t)
073263
      {
073263
  	curr = curr_start = ml_get((linenr_T)(curwin->w_cursor.lnum + t));
073263
! 	if (t == 0)
073263
  	{
073263
  	    /* Set the '[ mark. */
073263
  	    curwin->w_buffer->b_op_start.lnum = curwin->w_cursor.lnum;
073263
--- 4387,4393 ----
073263
      for (t = 0; t < count; ++t)
073263
      {
073263
  	curr = curr_start = ml_get((linenr_T)(curwin->w_cursor.lnum + t));
073263
! 	if (t == 0 && setmark)
073263
  	{
073263
  	    /* Set the '[ mark. */
073263
  	    curwin->w_buffer->b_op_start.lnum = curwin->w_cursor.lnum;
073263
***************
073263
*** 4506,4514 ****
073263
      }
073263
      ml_replace(curwin->w_cursor.lnum, newp, FALSE);
073263
  
073263
!     /* Set the '] mark. */
073263
!     curwin->w_buffer->b_op_end.lnum = curwin->w_cursor.lnum;
073263
!     curwin->w_buffer->b_op_end.col  = (colnr_T)STRLEN(newp);
073263
  
073263
      /* Only report the change in the first line here, del_lines() will report
073263
       * the deleted line. */
073263
--- 4509,4520 ----
073263
      }
073263
      ml_replace(curwin->w_cursor.lnum, newp, FALSE);
073263
  
073263
!     if (setmark)
073263
!     {
073263
! 	/* Set the '] mark. */
073263
! 	curwin->w_buffer->b_op_end.lnum = curwin->w_cursor.lnum;
073263
! 	curwin->w_buffer->b_op_end.col  = (colnr_T)STRLEN(newp);
073263
!     }
073263
  
073263
      /* Only report the change in the first line here, del_lines() will report
073263
       * the deleted line. */
073263
***************
073263
*** 5009,5015 ****
073263
  		    }
073263
  		}
073263
  		curwin->w_cursor.lnum--;
073263
! 		if (do_join(2, TRUE, FALSE, FALSE) == FAIL)
073263
  		{
073263
  		    beep_flush();
073263
  		    break;
073263
--- 5015,5021 ----
073263
  		    }
073263
  		}
073263
  		curwin->w_cursor.lnum--;
073263
! 		if (do_join(2, TRUE, FALSE, FALSE, FALSE) == FAIL)
073263
  		{
073263
  		    beep_flush();
073263
  		    break;
073263
*** ../vim-7.4.266/src/proto/ops.pro	2014-04-02 22:17:00.003482236 +0200
073263
--- src/proto/ops.pro	2014-04-29 12:08:50.620039525 +0200
073263
***************
073263
*** 37,43 ****
073263
  int preprocs_left __ARGS((void));
073263
  int get_register_name __ARGS((int num));
073263
  void ex_display __ARGS((exarg_T *eap));
073263
! int do_join __ARGS((long count, int insert_space, int save_undo, int use_formatoptions));
073263
  void op_format __ARGS((oparg_T *oap, int keep_cursor));
073263
  void op_formatexpr __ARGS((oparg_T *oap));
073263
  int fex_format __ARGS((linenr_T lnum, long count, int c));
073263
--- 37,43 ----
073263
  int preprocs_left __ARGS((void));
073263
  int get_register_name __ARGS((int num));
073263
  void ex_display __ARGS((exarg_T *eap));
073263
! int do_join __ARGS((long count, int insert_space, int save_undo, int use_formatoptions, int setmark));
073263
  void op_format __ARGS((oparg_T *oap, int keep_cursor));
073263
  void op_formatexpr __ARGS((oparg_T *oap));
073263
  int fex_format __ARGS((linenr_T lnum, long count, int c));
073263
*** ../vim-7.4.266/src/version.c	2014-04-29 11:55:26.176053624 +0200
073263
--- src/version.c	2014-04-29 11:59:35.620049252 +0200
073263
***************
073263
*** 736,737 ****
073263
--- 736,739 ----
073263
  {   /* Add new patch number below this line */
073263
+ /**/
073263
+     267,
073263
  /**/
073263
073263
-- 
073263
I AM THANKFUL...
073263
...for all the complaining I hear about the government
073263
because it means we have freedom of speech.
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    ///