changeset 6140:cb3218a69c2f v7.4.408

updated for version 7.4.408 Problem: Visual block insert breaks a multi-byte character. Solution: Calculate the position properly. (Yasuhiro Matsumoto)
author Bram Moolenaar <bram@vim.org>
date Sat, 16 Aug 2014 18:36:43 +0200
parents 70d1c941dfd0
children bd0eb8a79988
files src/ops.c src/testdir/Make_amiga.mak src/testdir/Make_dos.mak src/testdir/Make_ming.mak src/testdir/Make_os2.mak src/testdir/Make_vms.mms src/testdir/Makefile src/version.c
diffstat 8 files changed, 55 insertions(+), 26 deletions(-) [+]
line wrap: on
line diff
--- a/src/ops.c
+++ b/src/ops.c
@@ -609,6 +609,26 @@ block_insert(oap, s, b_insert, bdp)
 	    }
 	}
 
+#ifdef FEAT_MBYTE
+	if (has_mbyte && spaces > 0)
+	{
+	    /* Avoid starting halfway a multi-byte character. */
+	    if (b_insert)
+	    {
+		int off = (*mb_head_off)(oldp, oldp + offset + spaces);
+		spaces -= off;
+		count -= off;
+	    }
+	    else
+	    {
+		int off = (*mb_off_next)(oldp, oldp + offset);
+		offset += off;
+		spaces = 0;
+		count = 0;
+	    }
+	}
+#endif
+
 	newp = alloc_check((unsigned)(STRLEN(oldp)) + s_len + count + 1);
 	if (newp == NULL)
 	    continue;
--- a/src/testdir/Make_amiga.mak
+++ b/src/testdir/Make_amiga.mak
@@ -38,13 +38,14 @@ SCRIPTS = test1.out test3.out test4.out 
 		test104.out test105.out test106.out test107.out \
 		test_autoformat_join.out \
 		test_breakindent.out \
-		test_listlbr.out \
-		test_listlbr_utf8.out \
-		test_qf_title.out \
 		test_changelist.out \
 		test_eval.out \
 		test_insertcount.out \
-		test_options.out
+		test_listlbr.out \
+		test_listlbr_utf8.out \
+		test_options.out \
+		test_qf_title.out \
+		test_utf8.out
 
 .SUFFIXES: .in .out
 
@@ -170,10 +171,11 @@ test106.out: test106.in
 test107.out: test107.in
 test_autoformat_join.out: test_autoformat_join.in
 test_breakindent.out: test_breakindent.in
-test_listlbr.out: test_listlbr.in
-test_listlbr_utf8.out: test_listlbr_utf8.in
-test_qf_title.out: test_qf_title.in
 test_changelist.out: test_changelist.in
 test_eval.out: test_eval.in
 test_insertcount.out: test_insertcount.in
+test_listlbr.out: test_listlbr.in
+test_listlbr_utf8.out: test_listlbr_utf8.in
 test_options.out: test_options.in
+test_qf_title.out: test_qf_title.in
+test_utf8.out: test_utf8.in
--- a/src/testdir/Make_dos.mak
+++ b/src/testdir/Make_dos.mak
@@ -37,13 +37,14 @@ SCRIPTS =	test3.out test4.out test5.out 
 		test105.out test106.out  test107.out\
 		test_autoformat_join.out \
 		test_breakindent.out \
-		test_listlbr.out \
-		test_listlbr_utf8.out \
-		test_qf_title.out \
 		test_changelist.out \
 		test_eval.out \
 		test_insertcount.out \
-		test_options.out
+		test_listlbr.out \
+		test_listlbr_utf8.out \
+		test_options.out \
+		test_qf_title.out \
+		test_utf8.out
 
 SCRIPTS32 =	test50.out test70.out
 
--- a/src/testdir/Make_ming.mak
+++ b/src/testdir/Make_ming.mak
@@ -57,13 +57,14 @@ SCRIPTS =	test3.out test4.out test5.out 
 		test105.out test106.out test107.out \
 		test_autoformat_join.out \
 		test_breakindent.out \
-		test_listlbr.out \
-		test_listlbr_utf8.out \
-		test_qf_title.out \
 		test_changelist.out \
 		test_eval.out \
 		test_insertcount.out \
-		test_options.out
+		test_listlbr.out \
+		test_listlbr_utf8.out \
+		test_options.out \
+		test_qf_title.out \
+		test_utf8.out
 
 SCRIPTS32 =	test50.out test70.out
 
--- a/src/testdir/Make_os2.mak
+++ b/src/testdir/Make_os2.mak
@@ -38,14 +38,15 @@ SCRIPTS = test1.out test3.out test4.out 
 		test100.out test101.out test102.out test103.out test104.out \
 		test105.out test106.out test107.out \
 		test_autoformat_join.out \
+		test_breakindent.out \
 		test_changelist.out \
 		test_eval.out \
 		test_insertcount.out \
-		test_breakindent.out \
 		test_listlbr.out \
 		test_listlbr_utf8.out \
+		test_options.out \
 		test_qf_title.out \
-		test_options.out
+		test_utf8.out
 
 .SUFFIXES: .in .out
 
--- a/src/testdir/Make_vms.mms
+++ b/src/testdir/Make_vms.mms
@@ -4,7 +4,7 @@
 # Authors:	Zoltan Arpadffy, <arpadffy@polarhome.com>
 #		Sandor Kopanyi,  <sandor.kopanyi@mailbox.hu>
 #
-# Last change:  2014 Jul 30
+# Last change:  2014 Aug 16
 #
 # This has been tested on VMS 6.2 to 8.3 on DEC Alpha, VAX and IA64.
 # Edit the lines in the Configuration section below to select.
@@ -98,13 +98,14 @@ SCRIPT = test1.out  test2.out  test3.out
 	 test105.out test106.out test107.out \
 	 test_autoformat_join.out \
 	 test_breakindent.out \
-	 test_listlbr.out \
-	 test_listlbr_utf8.out \
-	 test_qf_title.out \
 	 test_changelist.out \
 	 test_eval.out \
 	 test_insertcount.out \
-	 test_options.out
+	 test_listlbr.out \
+	 test_listlbr_utf8.out \
+	 test_options.out \
+	 test_qf_title.out \
+	 test_utf8.out
 
 # Known problems:
 # test17: ?
--- a/src/testdir/Makefile
+++ b/src/testdir/Makefile
@@ -35,13 +35,14 @@ SCRIPTS = test1.out test2.out test3.out 
 		test104.out test105.out test106.out test107.out \
 		test_autoformat_join.out \
 		test_breakindent.out \
-		test_listlbr.out \
-		test_listlbr_utf8.out \
-		test_qf_title.out \
 		test_changelist.out \
 		test_eval.out \
 		test_insertcount.out \
-		test_options.out
+		test_listlbr.out \
+		test_listlbr_utf8.out \
+		test_options.out \
+		test_qf_title.out \
+		test_utf8.out
 
 SCRIPTS_GUI = test16.out
 
--- a/src/version.c
+++ b/src/version.c
@@ -742,6 +742,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    408,
+/**/
     407,
 /**/
     406,