On Mi, 29 Jul 2015, Christian Brabandt wrote: Updated patch, that also fixes the redraw issue (mentioned in a different thread).
Best, Christian -- Die Freigebigkeit erwirbt einem jeden Gunst, vorzüglich wenn sie von Demut begleitet wird. -- Goethe, Maximen und Reflektionen, Nr. 230 -- -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
diff --git a/src/normal.c b/src/normal.c --- a/src/normal.c +++ b/src/normal.c @@ -4256,11 +4256,7 @@ nv_addsub(cap) else clearopbeep(cap->oap); if (visual) - { - VIsual_active = FALSE; - redo_VIsual_busy = FALSE; - redraw_later(INVERTED); - } + end_visual_mode(); } /* diff --git a/src/ops.c b/src/ops.c --- a/src/ops.c +++ b/src/ops.c @@ -5492,6 +5492,7 @@ 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,30 +5502,27 @@ do_addsub(command, Prenum1, g_cmd) continue; 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]) - col++; + if (col > 0 && col == stop) + 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] == '-' - && vim_isxdigit(ptr[col+1]))) && ptr[col]) - col++; + negative = TRUE; + was_positive = FALSE; } - 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. diff --git a/src/testdir/test_increment.in b/src/testdir/test_increment.in --- a/src/testdir/test_increment.in +++ b/src/testdir/test_increment.in @@ -260,6 +260,16 @@ Text: 9 12 +19) increment on number with nrformat including alpha +Text: + 1 + 1a + + Expected: + 1) <Ctrl-V>j$ <ctrl-a> + 2 + 1b + STARTTEST @@ -369,6 +379,13 @@ 4kj$2j. :/^E18=/+put a V3kg.. +:" Test 19 +:set nrformats+=alpha +:/^S19=/+,/^E19=/-y a +:/^E19=/+put a +k$ +:set nrformats&vim + :" Save the report :/^# Test 1/,$w! test.out :qa! @@ -547,6 +564,13 @@ E18==== +# Test 19 +S19==== +1 +1a +E19==== + + ENDTEST diff --git a/src/testdir/test_increment.ok b/src/testdir/test_increment.ok --- a/src/testdir/test_increment.ok +++ b/src/testdir/test_increment.ok @@ -261,6 +261,15 @@ 9 12 +# Test 19 +S19==== +1 +1a +E19==== + +2 +2a + ENDTEST