branch: elpa/evil-numbers
commit e5dd1e2e31cd230884a6c6af0e20539ca92c10e8
Author: Jan Path <[email protected]>
Commit: Jan Path <[email protected]>
Fix changing the number directly behind us
E.g. in the following position (where ^ shows where point is) we want to
increase 2, not 1 when calling inc-at-pt.
1 2
^
---
evil-numbers.el | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/evil-numbers.el b/evil-numbers.el
index 4564c72e78..4b676eb5df 100644
--- a/evil-numbers.el
+++ b/evil-numbers.el
@@ -86,11 +86,16 @@ INCREMENTAL causes the first number to be increased by
1*amount, the second by
(lambda (beg end)
(evil-with-restriction beg end
(while (re-search-forward
"\\(?:0\\(?:[Bb][01]+\\|[Oo][0-7]+\\|[Xx][0-9A-Fa-f]+\\)\\|-?[0-9]+\\)" nil t)
+ ;; Backward char, to cancel out the forward-char below. We
need
+ ;; this, as re-search-forwards puts us behind the match.
+ (backward-char)
(evil-numbers/inc-at-pt (* amount count) nil nil nil)
(if incremental (setq count (+ count 1)))
;; Undo vim compatability.
(forward-char 1)))))))))
(t (save-match-data
+ ;; forward-char, so that we do not match the number directly behind us.
+ (forward-char)
(if (not (evil-numbers/search-number))
(error "No number at point or until end of line")
(or