diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2014-10-10 15:37:12 -0400 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2014-10-10 15:37:12 -0400 |
commit | 867aff3d2d59e84caa914c84063862b07d306f4c (patch) | |
tree | c6ddea6e012019f962bf63b659f819dc3c0c7f6b /src/nvim/ops.c | |
parent | 7ff71b5790e942ecf9fad4093d2cbb0abac0a591 (diff) | |
parent | d62545e5ba65853ae556993a3e219df23e561b2c (diff) | |
download | rneovim-867aff3d2d59e84caa914c84063862b07d306f4c.tar.gz rneovim-867aff3d2d59e84caa914c84063862b07d306f4c.tar.bz2 rneovim-867aff3d2d59e84caa914c84063862b07d306f4c.zip |
Merge pull request #1280 from splinterofchaos/visual-mb
vim-patch:7.4.408
Diffstat (limited to 'src/nvim/ops.c')
-rw-r--r-- | src/nvim/ops.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/nvim/ops.c b/src/nvim/ops.c index ed2a82d55c..e74fcef8d9 100644 --- a/src/nvim/ops.c +++ b/src/nvim/ops.c @@ -512,6 +512,20 @@ static void block_insert(oparg_T *oap, char_u *s, int b_insert, struct block_def } } + 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; + } + } + newp = (char_u *) xmalloc((size_t)(STRLEN(oldp) + s_len + count + 1)); /* copy up to shifted part */ |