vim-patch:7.4.806

Problem:    CTRL-A in Visual mode doesn't work properly with "alpha" in
            'nrformat'.
Solution:   Make it work. (Christian Brabandt)

cc218ab3ca
This commit is contained in:
watiko
2016-01-14 21:33:00 +09:00
parent 43fd126298
commit d21aaef456
4 changed files with 55 additions and 25 deletions

View File

@@ -4340,6 +4340,8 @@ int do_addsub(int command, linenr_T Prenum1, bool g_cmd)
}
for (int i = lnum; i <= lnume; i++) {
colnr_T stop = 0;
t = curwin->w_cursor;
curwin->w_cursor.lnum = i;
ptr = get_cursor_line_ptr();
@@ -4349,31 +4351,26 @@ int do_addsub(int command, linenr_T Prenum1, bool g_cmd)
continue;
}
if (visual) {
if (doalp) {
// search for ascii chars
while (!ASCII_ISALPHA(ptr[col]) && ptr[col]) {
col++;
}
} else if (dohex) {
// skip to first digit, but allow for leading '-'
while (!(ascii_isxdigit(ptr[col])
|| (ptr[col] == '-' && ascii_isxdigit(ptr[col + 1])))
&& ptr[col]) {
col++;
}
} else {
// decimal
while (!(ascii_isdigit(ptr[col])
|| (ptr[col] == '-' && ascii_isdigit(ptr[col + 1])))
&& ptr[col]) {
col++;
}
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
&& !ascii_isdigit(ptr[col])
&& !(doalp && ASCII_ISALPHA(ptr[col]))) {
if (col > 0 && col == stop) {
break;
}
col++;
}
if (col > startcol && ptr[col - 1] == '-') {
negative = true;
was_positive = false;
}
}
if (visual && ptr[col] == '-') {
negative = true;
was_positive = false;
col++;
}
// If a number was found, and saving for undo works, replace the number.
firstdigit = ptr[col];