To:
[email protected]
Subject: Patch 7.4b.020
Fcc: outbox
From: Bram Moolenaar <
[email protected]>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------
Patch 7.4b.020
Problem: "g~ap" changes first character of next paragraph. (Manuel Ortega)
Solution: Avoid subtracting (0 - 1) from todo. (Mike Williams)
Files: src/ops.c, src/testdir/test82.in, src/testdir/test82.ok
*** ../vim-7.4b.019/src/ops.c 2013-07-14 13:07:51.000000000 +0200
--- src/ops.c 2013-08-09 19:34:32.000000000 +0200
***************
*** 2429,2436 ****
{
# ifdef FEAT_MBYTE
if (has_mbyte)
/* we're counting bytes, not characters */
! todo -= (*mb_ptr2len)(ml_get_pos(pos)) - 1;
# endif
did_change |= swapchar(op_type, pos);
if (inc(pos) == -1) /* at end of file */
--- 2429,2441 ----
{
# ifdef FEAT_MBYTE
if (has_mbyte)
+ {
+ int len = (*mb_ptr2len)(ml_get_pos(pos));
+
/* we're counting bytes, not characters */
! if (len > 0)
! todo -= len - 1;
! }
# endif
did_change |= swapchar(op_type, pos);
if (inc(pos) == -1) /* at end of file */
*** ../vim-7.4b.019/src/testdir/test82.in 2011-07-15 18:22:46.000000000 +0200
--- src/testdir/test82.in 2013-08-09 19:32:57.000000000 +0200
***************
*** 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,93 ****
--- 89,103 ----
: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
*** ../vim-7.4b.019/src/testdir/test82.ok 2011-07-15 18:37:33.000000000 +0200
--- src/testdir/test82.ok 2013-08-09 19:33:24.000000000 +0200
***************
*** 1,2 ****
--- 1,5 ----
3732 checks passed
+ ABCD
+
+ defg
*** ../vim-7.4b.019/src/version.c 2013-08-07 21:13:17.000000000 +0200
--- src/version.c 2013-08-09 19:26:55.000000000 +0200
***************
*** 729,730 ****
--- 729,732 ----
{ /* Add new patch number below this line */
+ /**/
+ 20,
/**/
--
hundred-and-one symptoms of being an internet addict:
68. Your cat always puts viruses on your dogs homepage
/// Bram Moolenaar --
[email protected] --
http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features --
http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language --
http://www.Zimbu.org ///
\\\ help me help AIDS victims --
http://ICCF-Holland.org ///