mirror of
https://github.com/vim/vim.git
synced 2025-07-26 11:04:33 -04:00
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)
This commit is contained in:
parent
05fe017c1a
commit
6a3c8aff04
32
src/ops.c
32
src/ops.c
@ -5339,31 +5339,6 @@ block_prep(oap, bdp, lnum, is_del)
|
|||||||
bdp->textstart = pstart;
|
bdp->textstart = pstart;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef FEAT_RIGHTLEFT
|
|
||||||
static void reverse_line __ARGS((char_u *s));
|
|
||||||
|
|
||||||
static void
|
|
||||||
reverse_line(s)
|
|
||||||
char_u *s;
|
|
||||||
{
|
|
||||||
int i, j;
|
|
||||||
char_u c;
|
|
||||||
|
|
||||||
if ((i = (int)STRLEN(s) - 1) <= 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
curwin->w_cursor.col = i - curwin->w_cursor.col;
|
|
||||||
for (j = 0; j < i; j++, i--)
|
|
||||||
{
|
|
||||||
c = s[i]; s[i] = s[j]; s[j] = c;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
# define RLADDSUBFIX(ptr) if (curwin->w_p_rl) reverse_line(ptr);
|
|
||||||
#else
|
|
||||||
# define RLADDSUBFIX(ptr)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* add or subtract 'Prenum1' from a number in a line
|
* add or subtract 'Prenum1' from a number in a line
|
||||||
* 'command' is CTRL-A for add, CTRL-X for subtract
|
* 'command' is CTRL-A for add, CTRL-X for subtract
|
||||||
@ -5426,7 +5401,6 @@ do_addsub(command, Prenum1, g_cmd)
|
|||||||
}
|
}
|
||||||
|
|
||||||
ptr = ml_get(VIsual.lnum);
|
ptr = ml_get(VIsual.lnum);
|
||||||
RLADDSUBFIX(ptr);
|
|
||||||
if (VIsual_mode == 'V')
|
if (VIsual_mode == 'V')
|
||||||
{
|
{
|
||||||
VIsual.col = 0;
|
VIsual.col = 0;
|
||||||
@ -5457,7 +5431,6 @@ do_addsub(command, Prenum1, g_cmd)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
ptr = ml_get_curline();
|
ptr = ml_get_curline();
|
||||||
RLADDSUBFIX(ptr);
|
|
||||||
|
|
||||||
if (dobin)
|
if (dobin)
|
||||||
while (col > 0 && vim_isbdigit(ptr[col]))
|
while (col > 0 && vim_isbdigit(ptr[col]))
|
||||||
@ -5526,7 +5499,6 @@ do_addsub(command, Prenum1, g_cmd)
|
|||||||
t = curwin->w_cursor;
|
t = curwin->w_cursor;
|
||||||
curwin->w_cursor.lnum = i;
|
curwin->w_cursor.lnum = i;
|
||||||
ptr = ml_get_curline();
|
ptr = ml_get_curline();
|
||||||
RLADDSUBFIX(ptr);
|
|
||||||
if ((int)STRLEN(ptr) <= col)
|
if ((int)STRLEN(ptr) <= col)
|
||||||
/* try again on next line */
|
/* try again on next line */
|
||||||
continue;
|
continue;
|
||||||
@ -5812,10 +5784,6 @@ do_addsub(command, Prenum1, g_cmd)
|
|||||||
col = 0;
|
col = 0;
|
||||||
Prenum1 += offset;
|
Prenum1 += offset;
|
||||||
curwin->w_set_curswant = TRUE;
|
curwin->w_set_curswant = TRUE;
|
||||||
#ifdef FEAT_RIGHTLEFT
|
|
||||||
ptr = ml_get_buf(curbuf, curwin->w_cursor.lnum, TRUE);
|
|
||||||
RLADDSUBFIX(ptr);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
if (visual)
|
if (visual)
|
||||||
/* cursor at the top of the selection */
|
/* cursor at the top of the selection */
|
||||||
|
@ -558,4 +558,21 @@ func Test_visual_increment_26()
|
|||||||
call assert_equal([0, 1, 1, 0], getpos('.'))
|
call assert_equal([0, 1, 1, 0], getpos('.'))
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
" 27) increment with 'rightreft', if supported
|
||||||
|
func Test_visual_increment_27()
|
||||||
|
if exists('+rightleft')
|
||||||
|
set rightleft
|
||||||
|
call setline(1, ["1234 56"])
|
||||||
|
|
||||||
|
exec "norm! $\<C-A>"
|
||||||
|
call assert_equal(["1234 57"], getline(1, '$'))
|
||||||
|
call assert_equal([0, 1, 7, 0], getpos('.'))
|
||||||
|
|
||||||
|
exec "norm! \<C-A>"
|
||||||
|
call assert_equal(["1234 58"], getline(1, '$'))
|
||||||
|
call assert_equal([0, 1, 7, 0], getpos('.'))
|
||||||
|
set norightleft
|
||||||
|
endif
|
||||||
|
endfunc
|
||||||
|
|
||||||
" vim: tabstop=2 shiftwidth=2 expandtab
|
" vim: tabstop=2 shiftwidth=2 expandtab
|
||||||
|
@ -741,6 +741,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
1076,
|
||||||
/**/
|
/**/
|
||||||
1075,
|
1075,
|
||||||
/**/
|
/**/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user