summaryrefslogtreecommitdiff
path: root/src/ops.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/ops.c')
-rw-r--r--src/ops.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/ops.c b/src/ops.c
index 3ee6e5516..3989802d3 100644
--- a/src/ops.c
+++ b/src/ops.c
@@ -2429,8 +2429,13 @@ swapchars(op_type, pos, length)
{
# ifdef FEAT_MBYTE
if (has_mbyte)
+ {
+ int len = (*mb_ptr2len)(ml_get_pos(pos));
+
/* we're counting bytes, not characters */
- todo -= (*mb_ptr2len)(ml_get_pos(pos)) - 1;
+ if (len > 0)
+ todo -= len - 1;
+ }
# endif
did_change |= swapchar(op_type, pos);
if (inc(pos) == -1) /* at end of file */