Blob Blame History Raw
To: vim_dev@googlegroups.com
Subject: Patch 7.4.187
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------

Patch 7.4.187
Problem:    Delete that crosses line break splits multi-byte character.
Solution:   Advance a character instead of a byte. (Cade Foster)
Files:      src/normal.c, src/testdir/test69.in, src/testdir/test69.ok


*** ../vim-7.4.186/src/normal.c	2014-02-11 15:10:38.134111836 +0100
--- src/normal.c	2014-02-22 23:41:12.472897635 +0100
***************
*** 21,27 ****
  static int	resel_VIsual_mode = NUL;	/* 'v', 'V', or Ctrl-V */
  static linenr_T	resel_VIsual_line_count;	/* number of lines */
  static colnr_T	resel_VIsual_vcol;		/* nr of cols or end col */
! static int	VIsual_mode_orig = NUL;         /* type of Visual mode, that user entered */
  
  static int	restart_VIsual_select = 0;
  #endif
--- 21,27 ----
  static int	resel_VIsual_mode = NUL;	/* 'v', 'V', or Ctrl-V */
  static linenr_T	resel_VIsual_line_count;	/* number of lines */
  static colnr_T	resel_VIsual_vcol;		/* nr of cols or end col */
! static int	VIsual_mode_orig = NUL;		/* saved Visual mode */
  
  static int	restart_VIsual_select = 0;
  #endif
***************
*** 6202,6209 ****
  			    || cap->oap->op_type == OP_CHANGE)
  			&& !lineempty(curwin->w_cursor.lnum))
  		{
! 		    if (*ml_get_cursor() != NUL)
! 			++curwin->w_cursor.col;
  		    cap->retval |= CA_NO_ADJ_OP_END;
  		}
  		continue;
--- 6202,6218 ----
  			    || cap->oap->op_type == OP_CHANGE)
  			&& !lineempty(curwin->w_cursor.lnum))
  		{
! 		    char_u *cp = ml_get_cursor();
! 
! 		    if (*cp != NUL)
! 		    {
! #ifdef FEAT_MBYTE
! 			if (has_mbyte)
! 			    curwin->w_cursor.col += (*mb_ptr2len)(cp);
! 			else
! #endif
! 			    ++curwin->w_cursor.col;
! 		    }
  		    cap->retval |= CA_NO_ADJ_OP_END;
  		}
  		continue;
***************
*** 9482,9488 ****
  # ifdef FEAT_CLIPBOARD
  	    adjust_clip_reg(&regname);
  # endif
!            if (regname == 0 || regname == '"'
  				     || VIM_ISDIGIT(regname) || regname == '-'
  # ifdef FEAT_CLIPBOARD
  		    || (clip_unnamed && (regname == '*' || regname == '+'))
--- 9491,9497 ----
  # ifdef FEAT_CLIPBOARD
  	    adjust_clip_reg(&regname);
  # endif
! 	   if (regname == 0 || regname == '"'
  				     || VIM_ISDIGIT(regname) || regname == '-'
  # ifdef FEAT_CLIPBOARD
  		    || (clip_unnamed && (regname == '*' || regname == '+'))
*** ../vim-7.4.186/src/testdir/test69.in	2013-11-02 23:29:17.000000000 +0100
--- src/testdir/test69.in	2014-02-22 23:38:50.508897861 +0100
***************
*** 155,160 ****
--- 155,170 ----
  aab
  
  STARTTEST
+ :set whichwrap+=h
+ /^x
+ dh
+ :set whichwrap-=h
+ ENDTEST
+ 
+ á
+ x
+ 
+ STARTTEST
  :let a = '.é.' " one char of two bytes
  :let b = '.é.' " normal e with composing char
  /^byteidx
*** ../vim-7.4.186/src/testdir/test69.ok	2013-11-02 23:29:17.000000000 +0100
--- src/testdir/test69.ok	2014-02-22 23:38:53.752897856 +0100
***************
*** 150,155 ****
--- 150,158 ----
  aaa
  
  
+ áx
+ 
+ 
  byteidx
  [0, 1, 3, 4, -1]
  [0, 1, 4, 5, -1]
*** ../vim-7.4.186/src/version.c	2014-02-22 23:03:48.716901208 +0100
--- src/version.c	2014-02-22 23:30:24.412898667 +0100
***************
*** 740,741 ****
--- 740,743 ----
  {   /* Add new patch number below this line */
+ /**/
+     187,
  /**/

-- 
ARTHUR:  Then who is your lord?
WOMAN:   We don't have a lord.
ARTHUR:  What?
DENNIS:  I told you.  We're an anarcho-syndicalist commune.  We take it in
         turns to act as a sort of executive officer for the week.
                                  The Quest for the Holy Grail (Monty Python)

 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///