diff options
author | Bram Moolenaar <Bram@vim.org> | 2015-08-04 18:23:22 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2015-08-04 18:23:22 +0200 |
commit | cc218ab3caf983a0dcd3399beb8e1ecfcf0dd25d (patch) | |
tree | 9246ca372020a59e3210a72bd54b212c485d0f66 /src/ops.c | |
parent | 29bc9db36e41cb519dca9381cc29a3fc1ff02106 (diff) | |
download | vim-git-cc218ab3caf983a0dcd3399beb8e1ecfcf0dd25d.tar.gz |
patch 7.4.806v7.4.806
Problem: CTRL-A in Visual mode doesn't work properly with "alpha" in
'nrformat'.
Solution: Make it work. (Christian Brabandt)
Diffstat (limited to 'src/ops.c')
-rw-r--r-- | src/ops.c | 39 |
1 files changed, 19 insertions, 20 deletions
@@ -5492,6 +5492,8 @@ do_addsub(command, Prenum1, g_cmd) for (i = lnum; i <= lnume; i++) { + colnr_T stop = 0; + t = curwin->w_cursor; curwin->w_cursor.lnum = i; ptr = ml_get_curline(); @@ -5501,31 +5503,28 @@ do_addsub(command, Prenum1, g_cmd) continue; if (visual) { - if (doalp) /* search for ascii chars */ - { - while (!ASCII_ISALPHA(ptr[col]) && ptr[col]) - col++; - } - /* skip to first digit, but allow for leading '-' */ - else if (dohex) + 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 (!(vim_isxdigit(ptr[col]) || (ptr[col] == '-' - && vim_isxdigit(ptr[col+1]))) && ptr[col]) - col++; + if (col > 0 && col == stop) + break; + ++col; } - else /* decimal */ + + if (col > startcol && ptr[col - 1] == '-') { - while (!(vim_isdigit(ptr[col]) || (ptr[col] == '-' - && vim_isdigit(ptr[col+1]))) && ptr[col]) - col++; + 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. */ |