Karsten Hopp 45e71c
To: vim_dev@googlegroups.com
Karsten Hopp 45e71c
Subject: Patch 7.4.680
Karsten Hopp 45e71c
Fcc: outbox
Karsten Hopp 45e71c
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp 45e71c
Mime-Version: 1.0
Karsten Hopp 45e71c
Content-Type: text/plain; charset=UTF-8
Karsten Hopp 45e71c
Content-Transfer-Encoding: 8bit
Karsten Hopp 45e71c
------------
Karsten Hopp 45e71c
Karsten Hopp 45e71c
Patch 7.4.680
Karsten Hopp 45e71c
Problem:    CTRL-W in Insert mode does not work well for multi-byte
Karsten Hopp 45e71c
	    characters.
Karsten Hopp 45e71c
Solution:   Use mb_get_class(). (Yasuhiro Matsumoto)
Karsten Hopp 45e71c
Files:	    src/edit.c, src/testdir/Make_amiga.mak, src/testdir/Make_dos.mak,
Karsten Hopp 45e71c
	    src/testdir/Make_ming.mak, src/testdir/Make_os2.mak,
Karsten Hopp 45e71c
	    src/testdir/Make_vms.mms, src/testdir/Makefile,
Karsten Hopp 45e71c
	    src/testdir/test_erasebackword.in,
Karsten Hopp 45e71c
	    src/testdir/test_erasebackword.ok,
Karsten Hopp 45e71c
Karsten Hopp 45e71c
Karsten Hopp 45e71c
*** ../vim-7.4.679/src/edit.c	2015-03-20 18:11:44.967196356 +0100
Karsten Hopp 45e71c
--- src/edit.c	2015-03-24 17:40:27.705563807 +0100
Karsten Hopp 45e71c
***************
Karsten Hopp 45e71c
*** 9047,9118 ****
Karsten Hopp 45e71c
  	/*
Karsten Hopp 45e71c
  	 * Delete upto starting point, start of line or previous word.
Karsten Hopp 45e71c
  	 */
Karsten Hopp 45e71c
! 	else do
Karsten Hopp 45e71c
  	{
Karsten Hopp 45e71c
  #ifdef FEAT_RIGHTLEFT
Karsten Hopp 45e71c
! 	    if (!revins_on) /* put cursor on char to be deleted */
Karsten Hopp 45e71c
  #endif
Karsten Hopp 45e71c
! 		dec_cursor();
Karsten Hopp 45e71c
  
Karsten Hopp 45e71c
! 	    /* start of word? */
Karsten Hopp 45e71c
! 	    if (mode == BACKSPACE_WORD && !vim_isspace(gchar_cursor()))
Karsten Hopp 45e71c
! 	    {
Karsten Hopp 45e71c
! 		mode = BACKSPACE_WORD_NOT_SPACE;
Karsten Hopp 45e71c
! 		temp = vim_iswordc(gchar_cursor());
Karsten Hopp 45e71c
! 	    }
Karsten Hopp 45e71c
! 	    /* end of word? */
Karsten Hopp 45e71c
! 	    else if (mode == BACKSPACE_WORD_NOT_SPACE
Karsten Hopp 45e71c
! 		    && (vim_isspace(cc = gchar_cursor())
Karsten Hopp 45e71c
! 			    || vim_iswordc(cc) != temp))
Karsten Hopp 45e71c
! 	    {
Karsten Hopp 45e71c
  #ifdef FEAT_RIGHTLEFT
Karsten Hopp 45e71c
! 		if (!revins_on)
Karsten Hopp 45e71c
  #endif
Karsten Hopp 45e71c
! 		    inc_cursor();
Karsten Hopp 45e71c
  #ifdef FEAT_RIGHTLEFT
Karsten Hopp 45e71c
! 		else if (State & REPLACE_FLAG)
Karsten Hopp 45e71c
! 		    dec_cursor();
Karsten Hopp 45e71c
  #endif
Karsten Hopp 45e71c
! 		break;
Karsten Hopp 45e71c
! 	    }
Karsten Hopp 45e71c
! 	    if (State & REPLACE_FLAG)
Karsten Hopp 45e71c
! 		replace_do_bs(-1);
Karsten Hopp 45e71c
! 	    else
Karsten Hopp 45e71c
! 	    {
Karsten Hopp 45e71c
  #ifdef FEAT_MBYTE
Karsten Hopp 45e71c
! 		if (enc_utf8 && p_deco)
Karsten Hopp 45e71c
! 		    (void)utfc_ptr2char(ml_get_cursor(), cpc);
Karsten Hopp 45e71c
  #endif
Karsten Hopp 45e71c
! 		(void)del_char(FALSE);
Karsten Hopp 45e71c
  #ifdef FEAT_MBYTE
Karsten Hopp 45e71c
! 		/*
Karsten Hopp 45e71c
! 		 * If there are combining characters and 'delcombine' is set
Karsten Hopp 45e71c
! 		 * move the cursor back.  Don't back up before the base
Karsten Hopp 45e71c
! 		 * character.
Karsten Hopp 45e71c
! 		 */
Karsten Hopp 45e71c
! 		if (enc_utf8 && p_deco && cpc[0] != NUL)
Karsten Hopp 45e71c
! 		    inc_cursor();
Karsten Hopp 45e71c
  #endif
Karsten Hopp 45e71c
  #ifdef FEAT_RIGHTLEFT
Karsten Hopp 45e71c
! 		if (revins_chars)
Karsten Hopp 45e71c
! 		{
Karsten Hopp 45e71c
! 		    revins_chars--;
Karsten Hopp 45e71c
! 		    revins_legal++;
Karsten Hopp 45e71c
  		}
Karsten Hopp 45e71c
! 		if (revins_on && gchar_cursor() == NUL)
Karsten Hopp 45e71c
  		    break;
Karsten Hopp 45e71c
! #endif
Karsten Hopp 45e71c
! 	    }
Karsten Hopp 45e71c
! 	    /* Just a single backspace?: */
Karsten Hopp 45e71c
! 	    if (mode == BACKSPACE_CHAR)
Karsten Hopp 45e71c
! 		break;
Karsten Hopp 45e71c
! 	} while (
Karsten Hopp 45e71c
  #ifdef FEAT_RIGHTLEFT
Karsten Hopp 45e71c
! 		revins_on ||
Karsten Hopp 45e71c
  #endif
Karsten Hopp 45e71c
! 		(curwin->w_cursor.col > mincol
Karsten Hopp 45e71c
! 		 && (curwin->w_cursor.lnum != Insstart_orig.lnum
Karsten Hopp 45e71c
! 		     || curwin->w_cursor.col != Insstart_orig.col)));
Karsten Hopp 45e71c
  	did_backspace = TRUE;
Karsten Hopp 45e71c
      }
Karsten Hopp 45e71c
  #ifdef FEAT_SMARTINDENT
Karsten Hopp 45e71c
--- 9047,9140 ----
Karsten Hopp 45e71c
  	/*
Karsten Hopp 45e71c
  	 * Delete upto starting point, start of line or previous word.
Karsten Hopp 45e71c
  	 */
Karsten Hopp 45e71c
! 	else
Karsten Hopp 45e71c
  	{
Karsten Hopp 45e71c
+ #ifdef FEAT_MBYTE
Karsten Hopp 45e71c
+ 	    int cclass = 0, prev_cclass = 0;
Karsten Hopp 45e71c
+ 
Karsten Hopp 45e71c
+ 	    if (has_mbyte)
Karsten Hopp 45e71c
+ 		cclass = mb_get_class(ml_get_cursor());
Karsten Hopp 45e71c
+ #endif
Karsten Hopp 45e71c
+ 	    do
Karsten Hopp 45e71c
+ 	    {
Karsten Hopp 45e71c
  #ifdef FEAT_RIGHTLEFT
Karsten Hopp 45e71c
! 		if (!revins_on) /* put cursor on char to be deleted */
Karsten Hopp 45e71c
  #endif
Karsten Hopp 45e71c
! 		    dec_cursor();
Karsten Hopp 45e71c
  
Karsten Hopp 45e71c
! 		cc = gchar_cursor();
Karsten Hopp 45e71c
! #ifdef FEAT_MBYTE
Karsten Hopp 45e71c
! 		/* look multi-byte character class */
Karsten Hopp 45e71c
! 		if (has_mbyte)
Karsten Hopp 45e71c
! 		{
Karsten Hopp 45e71c
! 		    prev_cclass = cclass;
Karsten Hopp 45e71c
! 		    cclass = mb_get_class(ml_get_cursor());
Karsten Hopp 45e71c
! 		}
Karsten Hopp 45e71c
! #endif
Karsten Hopp 45e71c
! 
Karsten Hopp 45e71c
! 		/* start of word? */
Karsten Hopp 45e71c
! 		if (mode == BACKSPACE_WORD && !vim_isspace(cc))
Karsten Hopp 45e71c
! 		{
Karsten Hopp 45e71c
! 		    mode = BACKSPACE_WORD_NOT_SPACE;
Karsten Hopp 45e71c
! 		    temp = vim_iswordc(cc);
Karsten Hopp 45e71c
! 		}
Karsten Hopp 45e71c
! 		/* end of word? */
Karsten Hopp 45e71c
! 		else if (mode == BACKSPACE_WORD_NOT_SPACE
Karsten Hopp 45e71c
! 			&& ((vim_isspace(cc) || vim_iswordc(cc) != temp)
Karsten Hopp 45e71c
! #ifdef FEAT_MBYTE
Karsten Hopp 45e71c
! 			|| prev_cclass != cclass
Karsten Hopp 45e71c
! #endif
Karsten Hopp 45e71c
! 			))
Karsten Hopp 45e71c
! 		{
Karsten Hopp 45e71c
  #ifdef FEAT_RIGHTLEFT
Karsten Hopp 45e71c
! 		    if (!revins_on)
Karsten Hopp 45e71c
  #endif
Karsten Hopp 45e71c
! 			inc_cursor();
Karsten Hopp 45e71c
  #ifdef FEAT_RIGHTLEFT
Karsten Hopp 45e71c
! 		    else if (State & REPLACE_FLAG)
Karsten Hopp 45e71c
! 			dec_cursor();
Karsten Hopp 45e71c
  #endif
Karsten Hopp 45e71c
! 		    break;
Karsten Hopp 45e71c
! 		}
Karsten Hopp 45e71c
! 		if (State & REPLACE_FLAG)
Karsten Hopp 45e71c
! 		    replace_do_bs(-1);
Karsten Hopp 45e71c
! 		else
Karsten Hopp 45e71c
! 		{
Karsten Hopp 45e71c
  #ifdef FEAT_MBYTE
Karsten Hopp 45e71c
! 		    if (enc_utf8 && p_deco)
Karsten Hopp 45e71c
! 			(void)utfc_ptr2char(ml_get_cursor(), cpc);
Karsten Hopp 45e71c
  #endif
Karsten Hopp 45e71c
! 		    (void)del_char(FALSE);
Karsten Hopp 45e71c
  #ifdef FEAT_MBYTE
Karsten Hopp 45e71c
! 		    /*
Karsten Hopp 45e71c
! 		     * If there are combining characters and 'delcombine' is set
Karsten Hopp 45e71c
! 		     * move the cursor back.  Don't back up before the base
Karsten Hopp 45e71c
! 		     * character.
Karsten Hopp 45e71c
! 		     */
Karsten Hopp 45e71c
! 		    if (enc_utf8 && p_deco && cpc[0] != NUL)
Karsten Hopp 45e71c
! 			inc_cursor();
Karsten Hopp 45e71c
  #endif
Karsten Hopp 45e71c
  #ifdef FEAT_RIGHTLEFT
Karsten Hopp 45e71c
! 		    if (revins_chars)
Karsten Hopp 45e71c
! 		    {
Karsten Hopp 45e71c
! 			revins_chars--;
Karsten Hopp 45e71c
! 			revins_legal++;
Karsten Hopp 45e71c
! 		    }
Karsten Hopp 45e71c
! 		    if (revins_on && gchar_cursor() == NUL)
Karsten Hopp 45e71c
! 			break;
Karsten Hopp 45e71c
! #endif
Karsten Hopp 45e71c
  		}
Karsten Hopp 45e71c
! 		/* Just a single backspace?: */
Karsten Hopp 45e71c
! 		if (mode == BACKSPACE_CHAR)
Karsten Hopp 45e71c
  		    break;
Karsten Hopp 45e71c
! 	    } while (
Karsten Hopp 45e71c
  #ifdef FEAT_RIGHTLEFT
Karsten Hopp 45e71c
! 		    revins_on ||
Karsten Hopp 45e71c
  #endif
Karsten Hopp 45e71c
! 		    (curwin->w_cursor.col > mincol
Karsten Hopp 45e71c
! 		    && (curwin->w_cursor.lnum != Insstart_orig.lnum
Karsten Hopp 45e71c
! 			|| curwin->w_cursor.col != Insstart_orig.col)));
Karsten Hopp 45e71c
! 	}
Karsten Hopp 45e71c
  	did_backspace = TRUE;
Karsten Hopp 45e71c
      }
Karsten Hopp 45e71c
  #ifdef FEAT_SMARTINDENT
Karsten Hopp 45e71c
*** ../vim-7.4.679/src/testdir/Make_amiga.mak	2015-03-13 15:02:46.254059251 +0100
Karsten Hopp 45e71c
--- src/testdir/Make_amiga.mak	2015-03-24 17:36:08.200314390 +0100
Karsten Hopp 45e71c
***************
Karsten Hopp 45e71c
*** 43,48 ****
Karsten Hopp 45e71c
--- 43,49 ----
Karsten Hopp 45e71c
  		test_changelist.out \
Karsten Hopp 45e71c
  		test_close_count.out \
Karsten Hopp 45e71c
  		test_command_count.out \
Karsten Hopp 45e71c
+ 		test_erasebackword.out \
Karsten Hopp 45e71c
  		test_eval.out \
Karsten Hopp 45e71c
  		test_insertcount.out \
Karsten Hopp 45e71c
  		test_listlbr.out \
Karsten Hopp 45e71c
***************
Karsten Hopp 45e71c
*** 185,190 ****
Karsten Hopp 45e71c
--- 186,192 ----
Karsten Hopp 45e71c
  test_changelist.out: test_changelist.in
Karsten Hopp 45e71c
  test_close_count.out: test_close_count.in
Karsten Hopp 45e71c
  test_command_count.out: test_command_count.in
Karsten Hopp 45e71c
+ test_erasebackword.out: test_erasebackword.in
Karsten Hopp 45e71c
  test_eval.out: test_eval.in
Karsten Hopp 45e71c
  test_insertcount.out: test_insertcount.in
Karsten Hopp 45e71c
  test_listlbr.out: test_listlbr.in
Karsten Hopp 45e71c
*** ../vim-7.4.679/src/testdir/Make_dos.mak	2015-03-13 15:02:46.258059206 +0100
Karsten Hopp 45e71c
--- src/testdir/Make_dos.mak	2015-03-24 17:36:16.360226912 +0100
Karsten Hopp 45e71c
***************
Karsten Hopp 45e71c
*** 42,47 ****
Karsten Hopp 45e71c
--- 42,48 ----
Karsten Hopp 45e71c
  		test_changelist.out \
Karsten Hopp 45e71c
  		test_close_count.out \
Karsten Hopp 45e71c
  		test_command_count.out \
Karsten Hopp 45e71c
+ 		test_erasebackword.out \
Karsten Hopp 45e71c
  		test_eval.out \
Karsten Hopp 45e71c
  		test_insertcount.out \
Karsten Hopp 45e71c
  		test_listlbr.out \
Karsten Hopp 45e71c
*** ../vim-7.4.679/src/testdir/Make_ming.mak	2015-03-13 15:02:46.258059206 +0100
Karsten Hopp 45e71c
--- src/testdir/Make_ming.mak	2015-03-24 17:36:20.296184745 +0100
Karsten Hopp 45e71c
***************
Karsten Hopp 45e71c
*** 64,69 ****
Karsten Hopp 45e71c
--- 64,70 ----
Karsten Hopp 45e71c
  		test_changelist.out \
Karsten Hopp 45e71c
  		test_close_count.out \
Karsten Hopp 45e71c
  		test_command_count.out \
Karsten Hopp 45e71c
+ 		test_erasebackword.out \
Karsten Hopp 45e71c
  		test_eval.out \
Karsten Hopp 45e71c
  		test_insertcount.out \
Karsten Hopp 45e71c
  		test_listlbr.out \
Karsten Hopp 45e71c
*** ../vim-7.4.679/src/testdir/Make_os2.mak	2015-03-13 15:02:46.258059206 +0100
Karsten Hopp 45e71c
--- src/testdir/Make_os2.mak	2015-03-24 17:36:22.864157273 +0100
Karsten Hopp 45e71c
***************
Karsten Hopp 45e71c
*** 44,49 ****
Karsten Hopp 45e71c
--- 44,50 ----
Karsten Hopp 45e71c
  		test_changelist.out \
Karsten Hopp 45e71c
  		test_close_count.out \
Karsten Hopp 45e71c
  		test_command_count.out \
Karsten Hopp 45e71c
+ 		test_erasebackword.out \
Karsten Hopp 45e71c
  		test_eval.out \
Karsten Hopp 45e71c
  		test_insertcount.out \
Karsten Hopp 45e71c
  		test_listlbr.out \
Karsten Hopp 45e71c
*** ../vim-7.4.679/src/testdir/Make_vms.mms	2015-03-13 15:02:46.258059206 +0100
Karsten Hopp 45e71c
--- src/testdir/Make_vms.mms	2015-03-24 17:36:33.368044688 +0100
Karsten Hopp 45e71c
***************
Karsten Hopp 45e71c
*** 4,10 ****
Karsten Hopp 45e71c
  # Authors:	Zoltan Arpadffy, <arpadffy@polarhome.com>
Karsten Hopp 45e71c
  #		Sandor Kopanyi,  <sandor.kopanyi@mailbox.hu>
Karsten Hopp 45e71c
  #
Karsten Hopp 45e71c
! # Last change:  2015 Mar 13
Karsten Hopp 45e71c
  #
Karsten Hopp 45e71c
  # This has been tested on VMS 6.2 to 8.3 on DEC Alpha, VAX and IA64.
Karsten Hopp 45e71c
  # Edit the lines in the Configuration section below to select.
Karsten Hopp 45e71c
--- 4,10 ----
Karsten Hopp 45e71c
  # Authors:	Zoltan Arpadffy, <arpadffy@polarhome.com>
Karsten Hopp 45e71c
  #		Sandor Kopanyi,  <sandor.kopanyi@mailbox.hu>
Karsten Hopp 45e71c
  #
Karsten Hopp 45e71c
! # Last change:  2015 Mar 24
Karsten Hopp 45e71c
  #
Karsten Hopp 45e71c
  # This has been tested on VMS 6.2 to 8.3 on DEC Alpha, VAX and IA64.
Karsten Hopp 45e71c
  # Edit the lines in the Configuration section below to select.
Karsten Hopp 45e71c
***************
Karsten Hopp 45e71c
*** 103,108 ****
Karsten Hopp 45e71c
--- 103,109 ----
Karsten Hopp 45e71c
  	 test_changelist.out \
Karsten Hopp 45e71c
  	 test_close_count.out \
Karsten Hopp 45e71c
  	 test_command_count.out \
Karsten Hopp 45e71c
+ 	 test_erasebackword.out \
Karsten Hopp 45e71c
  	 test_eval.out \
Karsten Hopp 45e71c
  	 test_insertcount.out \
Karsten Hopp 45e71c
  	 test_listlbr.out \
Karsten Hopp 45e71c
*** ../vim-7.4.679/src/testdir/Makefile	2015-03-13 15:02:46.258059206 +0100
Karsten Hopp 45e71c
--- src/testdir/Makefile	2015-03-24 17:36:58.747773608 +0100
Karsten Hopp 45e71c
***************
Karsten Hopp 45e71c
*** 40,45 ****
Karsten Hopp 45e71c
--- 40,46 ----
Karsten Hopp 45e71c
  		test_changelist.out \
Karsten Hopp 45e71c
  		test_close_count.out \
Karsten Hopp 45e71c
  		test_command_count.out \
Karsten Hopp 45e71c
+ 		test_erasebackword.out \
Karsten Hopp 45e71c
  		test_eval.out \
Karsten Hopp 45e71c
  		test_insertcount.out \
Karsten Hopp 45e71c
  		test_listlbr.out \
Karsten Hopp 45e71c
*** ../vim-7.4.679/src/testdir/test_erasebackword.in	2015-03-24 17:49:11.672057691 +0100
Karsten Hopp 45e71c
--- src/testdir/test_erasebackword.in	2015-01-30 03:19:14.000000000 +0100
Karsten Hopp 45e71c
***************
Karsten Hopp 45e71c
*** 0 ****
Karsten Hopp 45e71c
--- 1,19 ----
Karsten Hopp 45e71c
+ Test for erasing backword
Karsten Hopp 45e71c
+ 
Karsten Hopp 45e71c
+ STARTTEST
Karsten Hopp 45e71c
+ :so small.vim
Karsten Hopp 45e71c
+ :so mbyte.vim
Karsten Hopp 45e71c
+ :set encoding=utf-8
Karsten Hopp 45e71c
+ G
Karsten Hopp 45e71c
+ o wwwこんにちわ世界ワールドvim ??
Karsten Hopp 45e71c
+ o wwwこんにちわ世界ワールドvim ???
Karsten Hopp 45e71c
+ o wwwこんにちわ世界ワールドvim ????
Karsten Hopp 45e71c
+ o wwwこんにちわ世界ワールドvim ?????
Karsten Hopp 45e71c
+ o wwwこんにちわ世界ワールドvim ??????
Karsten Hopp 45e71c
+ o wwwこんにちわ世界ワールドvim ???????
Karsten Hopp 45e71c
+ :/^test/,$w! test.out
Karsten Hopp 45e71c
+ :qa!
Karsten Hopp 45e71c
+ ENDTEST
Karsten Hopp 45e71c
+ 
Karsten Hopp 45e71c
+ test starts here:
Karsten Hopp 45e71c
+ 
Karsten Hopp 45e71c
*** ../vim-7.4.679/src/testdir/test_erasebackword.ok	2015-03-24 17:49:11.676057649 +0100
Karsten Hopp 45e71c
--- src/testdir/test_erasebackword.ok	2015-01-30 03:19:33.000000000 +0100
Karsten Hopp 45e71c
***************
Karsten Hopp 45e71c
*** 0 ****
Karsten Hopp 45e71c
--- 1,8 ----
Karsten Hopp 45e71c
+ test starts here:
Karsten Hopp 45e71c
+ 
Karsten Hopp 45e71c
+  wwwこんにちわ世界ワールド
Karsten Hopp 45e71c
+  wwwこんにちわ世界
Karsten Hopp 45e71c
+  wwwこんにちわ
Karsten Hopp 45e71c
+  www
Karsten Hopp 45e71c
+  
Karsten Hopp 45e71c
+ 
Karsten Hopp 45e71c
*** ../vim-7.4.679/src/version.c	2015-03-24 17:12:04.477113277 +0100
Karsten Hopp 45e71c
--- src/version.c	2015-03-24 17:17:06.769333643 +0100
Karsten Hopp 45e71c
***************
Karsten Hopp 45e71c
*** 743,744 ****
Karsten Hopp 45e71c
--- 743,746 ----
Karsten Hopp 45e71c
  {   /* Add new patch number below this line */
Karsten Hopp 45e71c
+ /**/
Karsten Hopp 45e71c
+     680,
Karsten Hopp 45e71c
  /**/
Karsten Hopp 45e71c
Karsten Hopp 45e71c
-- 
Karsten Hopp 45e71c
TALL KNIGHT: We are now no longer the Knights Who Say Ni!
Karsten Hopp 45e71c
ONE KNIGHT:  Ni!
Karsten Hopp 45e71c
OTHERS:      Sh!
Karsten Hopp 45e71c
ONE KNIGHT:  (whispers) Sorry.
Karsten Hopp 45e71c
                 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD
Karsten Hopp 45e71c
Karsten Hopp 45e71c
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp 45e71c
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp 45e71c
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
Karsten Hopp 45e71c
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///