Skip to content

Commit 6a3c8af

Browse files
committed
patch 7.4.1076
Problem: CTRL-A does not work well in right-left mode. Solution: Remove reversing the line, add a test. (Hirohito Higashi)
1 parent 05fe017 commit 6a3c8af

File tree

3 files changed

+19
-32
lines changed

3 files changed

+19
-32
lines changed

src/ops.c

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -5339,31 +5339,6 @@ block_prep(oap, bdp, lnum, is_del)
53395339
bdp->textstart = pstart;
53405340
}
53415341

5342-
#ifdef FEAT_RIGHTLEFT
5343-
static void reverse_line __ARGS((char_u *s));
5344-
5345-
static void
5346-
reverse_line(s)
5347-
char_u *s;
5348-
{
5349-
int i, j;
5350-
char_u c;
5351-
5352-
if ((i = (int)STRLEN(s) - 1) <= 0)
5353-
return;
5354-
5355-
curwin->w_cursor.col = i - curwin->w_cursor.col;
5356-
for (j = 0; j < i; j++, i--)
5357-
{
5358-
c = s[i]; s[i] = s[j]; s[j] = c;
5359-
}
5360-
}
5361-
5362-
# define RLADDSUBFIX(ptr) if (curwin->w_p_rl) reverse_line(ptr);
5363-
#else
5364-
# define RLADDSUBFIX(ptr)
5365-
#endif
5366-
53675342
/*
53685343
* add or subtract 'Prenum1' from a number in a line
53695344
* 'command' is CTRL-A for add, CTRL-X for subtract
@@ -5426,7 +5401,6 @@ do_addsub(command, Prenum1, g_cmd)
54265401
}
54275402

54285403
ptr = ml_get(VIsual.lnum);
5429-
RLADDSUBFIX(ptr);
54305404
if (VIsual_mode == 'V')
54315405
{
54325406
VIsual.col = 0;
@@ -5457,7 +5431,6 @@ do_addsub(command, Prenum1, g_cmd)
54575431
else
54585432
{
54595433
ptr = ml_get_curline();
5460-
RLADDSUBFIX(ptr);
54615434

54625435
if (dobin)
54635436
while (col > 0 && vim_isbdigit(ptr[col]))
@@ -5526,7 +5499,6 @@ do_addsub(command, Prenum1, g_cmd)
55265499
t = curwin->w_cursor;
55275500
curwin->w_cursor.lnum = i;
55285501
ptr = ml_get_curline();
5529-
RLADDSUBFIX(ptr);
55305502
if ((int)STRLEN(ptr) <= col)
55315503
/* try again on next line */
55325504
continue;
@@ -5812,10 +5784,6 @@ do_addsub(command, Prenum1, g_cmd)
58125784
col = 0;
58135785
Prenum1 += offset;
58145786
curwin->w_set_curswant = TRUE;
5815-
#ifdef FEAT_RIGHTLEFT
5816-
ptr = ml_get_buf(curbuf, curwin->w_cursor.lnum, TRUE);
5817-
RLADDSUBFIX(ptr);
5818-
#endif
58195787
}
58205788
if (visual)
58215789
/* cursor at the top of the selection */

src/testdir/test_increment.vim

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -558,4 +558,21 @@ func Test_visual_increment_26()
558558
call assert_equal([0, 1, 1, 0], getpos('.'))
559559
endfunc
560560

561+
" 27) increment with 'rightreft', if supported
562+
func Test_visual_increment_27()
563+
if exists('+rightleft')
564+
set rightleft
565+
call setline(1, ["1234 56"])
566+
567+
exec "norm! $\<C-A>"
568+
call assert_equal(["1234 57"], getline(1, '$'))
569+
call assert_equal([0, 1, 7, 0], getpos('.'))
570+
571+
exec "norm! \<C-A>"
572+
call assert_equal(["1234 58"], getline(1, '$'))
573+
call assert_equal([0, 1, 7, 0], getpos('.'))
574+
set norightleft
575+
endif
576+
endfunc
577+
561578
" vim: tabstop=2 shiftwidth=2 expandtab

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -741,6 +741,8 @@ static char *(features[]) =
741741

742742
static int included_patches[] =
743743
{ /* Add new patch number below this line */
744+
/**/
745+
1076,
744746
/**/
745747
1075,
746748
/**/

0 commit comments

Comments
 (0)