diff options
Diffstat (limited to 'src/nvim/ops.c')
| -rw-r--r-- | src/nvim/ops.c | 12 | 
1 files changed, 6 insertions, 6 deletions
| diff --git a/src/nvim/ops.c b/src/nvim/ops.c index 9b33b6732c..3cefc9f623 100644 --- a/src/nvim/ops.c +++ b/src/nvim/ops.c @@ -515,17 +515,17 @@ static void block_insert(oparg_T *oap, char_u *s, int b_insert, struct block_def      }      if (has_mbyte && spaces > 0) { +      int off; +        // Avoid starting halfway a multi-byte character.        if (b_insert) { -        int off = (*mb_head_off)(oldp, oldp + offset + spaces); -        spaces -= off; -        count -= off; +        off = (*mb_head_off)(oldp, oldp + offset + spaces);        } else { -        int off = (*mb_off_next)(oldp, oldp + offset); +        off = (*mb_off_next)(oldp, oldp + offset);          offset += off; -        spaces = 0; -        count = 0;        } +      spaces -= off; +      count -= off;      }      newp = (char_u *) xmalloc((size_t)(STRLEN(oldp) + s_len + count + 1)); | 
