summaryrefslogtreecommitdiff
path: root/src/ops.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2014-08-16 18:36:43 +0200
committerBram Moolenaar <Bram@vim.org>2014-08-16 18:36:43 +0200
commitb5cf6c34e84bd52ba43c3db06ff337abbcb08326 (patch)
treec2e960cef292d1b6b5bd4259983a2da902c89a8b /src/ops.c
parent1fc7e972b00ce271328fcb2734a321562b7194da (diff)
downloadvim-git-b5cf6c34e84bd52ba43c3db06ff337abbcb08326.tar.gz
updated for version 7.4.408v7.4.408
Problem: Visual block insert breaks a multi-byte character. Solution: Calculate the position properly. (Yasuhiro Matsumoto)
Diffstat (limited to 'src/ops.c')
-rw-r--r--src/ops.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/ops.c b/src/ops.c
index 2b400916f..86408a494 100644
--- 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;