summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/ops.c7
-rw-r--r--src/testdir/test82.in10
-rw-r--r--src/testdir/test82.ok3
-rw-r--r--src/version.c2
4 files changed, 21 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 */
diff --git a/src/testdir/test82.in b/src/testdir/test82.in
index 63a81e789..8503f5488 100644
--- a/src/testdir/test82.in
+++ b/src/testdir/test82.in
@@ -1,4 +1,5 @@
Tests for case-insensitive UTF-8 comparisons (utf_strnicmp() in mbyte.c)
+Also test "g~ap".
STARTTEST
:so small.vim
@@ -88,6 +89,15 @@ ggdG
:for n in range(0x80, 0xBF) | call EQ(printf('xYz\xc2\x%.2XUvW', n), printf('XyZ\xc2\x%.2XuVw', n)) | endfor
:for n in range(0xC0, 0xFF) | call LT(printf('xYz\xc2\x%.2XUvW', n), printf('XyZ\xc2\x%.2XuVw', n)) | endfor
:call append(0, printf('%d checks passed', b:passed))
+:"
+:" test that g~ap changes one paragraph only.
+:new
+iabcd
+
+defggg0g~ap:let lns = getline(1,3)
+:q!
+:call append(line('$'), lns)
+:"
:wq! test.out
ENDTEST
diff --git a/src/testdir/test82.ok b/src/testdir/test82.ok
index fa6588346..3f1866a0f 100644
--- a/src/testdir/test82.ok
+++ b/src/testdir/test82.ok
@@ -1,2 +1,5 @@
3732 checks passed
+ABCD
+
+defg
diff --git a/src/version.c b/src/version.c
index 5e4a59543..3add57dd9 100644
--- a/src/version.c
+++ b/src/version.c
@@ -728,6 +728,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 20,
+/**/
19,
/**/
18,