diff src/ops.c @ 5288:46cf49cc9289 v7.4b.020

updated for version 7.4b.020 Problem: "g~ap" changes first character of next paragraph. (Manuel Ortega) Solution: Avoid subtracting (0 - 1) from todo. (Mike Williams)
author Bram Moolenaar <bram@vim.org>
date Fri, 09 Aug 2013 19:48:40 +0200
parents 8c6615a30951
children 22dfcd1494e4
line wrap: on
line diff
--- 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 */