mirror of
https://github.com/vim/vim.git
synced 2025-09-26 04:04:07 -04:00
patch 7.4.806
Problem: CTRL-A in Visual mode doesn't work properly with "alpha" in 'nrformat'. Solution: Make it work. (Christian Brabandt)
This commit is contained in:
39
src/ops.c
39
src/ops.c
@@ -5492,6 +5492,8 @@ do_addsub(command, Prenum1, g_cmd)
|
|||||||
|
|
||||||
for (i = lnum; i <= lnume; i++)
|
for (i = lnum; i <= lnume; i++)
|
||||||
{
|
{
|
||||||
|
colnr_T stop = 0;
|
||||||
|
|
||||||
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();
|
||||||
@@ -5501,30 +5503,27 @@ do_addsub(command, Prenum1, g_cmd)
|
|||||||
continue;
|
continue;
|
||||||
if (visual)
|
if (visual)
|
||||||
{
|
{
|
||||||
if (doalp) /* search for ascii chars */
|
if (VIsual_mode == 'v'
|
||||||
|
&& i == lnume)
|
||||||
|
stop = curwin->w_cursor.col;
|
||||||
|
else if (VIsual_mode == Ctrl_V
|
||||||
|
&& curbuf->b_visual.vi_curswant != MAXCOL)
|
||||||
|
stop = curwin->w_cursor.col;
|
||||||
|
|
||||||
|
while (ptr[col] != NUL
|
||||||
|
&& !vim_isdigit(ptr[col])
|
||||||
|
&& !(doalp && ASCII_ISALPHA(ptr[col])))
|
||||||
{
|
{
|
||||||
while (!ASCII_ISALPHA(ptr[col]) && ptr[col])
|
if (col > 0 && col == stop)
|
||||||
col++;
|
break;
|
||||||
|
++col;
|
||||||
}
|
}
|
||||||
/* skip to first digit, but allow for leading '-' */
|
|
||||||
else if (dohex)
|
if (col > startcol && ptr[col - 1] == '-')
|
||||||
{
|
{
|
||||||
while (!(vim_isxdigit(ptr[col]) || (ptr[col] == '-'
|
negative = TRUE;
|
||||||
&& vim_isxdigit(ptr[col+1]))) && ptr[col])
|
was_positive = FALSE;
|
||||||
col++;
|
|
||||||
}
|
}
|
||||||
else /* decimal */
|
|
||||||
{
|
|
||||||
while (!(vim_isdigit(ptr[col]) || (ptr[col] == '-'
|
|
||||||
&& vim_isdigit(ptr[col+1]))) && ptr[col])
|
|
||||||
col++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (visual && ptr[col] == '-')
|
|
||||||
{
|
|
||||||
negative = TRUE;
|
|
||||||
was_positive = FALSE;
|
|
||||||
col++;
|
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* If a number was found, and saving for undo works, replace the number.
|
* If a number was found, and saving for undo works, replace the number.
|
||||||
|
@@ -260,6 +260,16 @@ Text:
|
|||||||
9
|
9
|
||||||
12
|
12
|
||||||
|
|
||||||
|
19) increment on number with nrformat including alpha
|
||||||
|
Text:
|
||||||
|
1
|
||||||
|
1a
|
||||||
|
|
||||||
|
Expected:
|
||||||
|
1) <Ctrl-V>j$ <ctrl-a>
|
||||||
|
2
|
||||||
|
1b
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
STARTTEST
|
STARTTEST
|
||||||
@@ -369,6 +379,13 @@ V3k
|
|||||||
:/^E18=/+put a
|
:/^E18=/+put a
|
||||||
V3kg..
|
V3kg..
|
||||||
|
|
||||||
|
:" Test 19
|
||||||
|
:set nrformats+=alpha
|
||||||
|
:/^S19=/+,/^E19=/-y a
|
||||||
|
:/^E19=/+put a
|
||||||
|
k$
|
||||||
|
:set nrformats&vim
|
||||||
|
|
||||||
:" Save the report
|
:" Save the report
|
||||||
:/^# Test 1/,$w! test.out
|
:/^# Test 1/,$w! test.out
|
||||||
:qa!
|
:qa!
|
||||||
@@ -547,6 +564,13 @@ E18====
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Test 19
|
||||||
|
S19====
|
||||||
|
1
|
||||||
|
1a
|
||||||
|
E19====
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
ENDTEST
|
ENDTEST
|
||||||
|
@@ -261,6 +261,15 @@ E18====
|
|||||||
12
|
12
|
||||||
|
|
||||||
|
|
||||||
|
# Test 19
|
||||||
|
S19====
|
||||||
|
1
|
||||||
|
1a
|
||||||
|
E19====
|
||||||
|
|
||||||
|
2
|
||||||
|
2a
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
ENDTEST
|
ENDTEST
|
||||||
|
@@ -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 */
|
||||||
|
/**/
|
||||||
|
806,
|
||||||
/**/
|
/**/
|
||||||
805,
|
805,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user