branch: elpa/evil-numbers
commit e0f4ba3d135ddc87e3911bb2f1ae97ce033d2db4
Author: Michael Markert <[email protected]>
Commit: Michael Markert <[email protected]>
Fix number search.
Signed-off-by: Michael Markert <[email protected]>
---
evil-numbers.el | 23 ++++++++++++-----------
1 file changed, 12 insertions(+), 11 deletions(-)
diff --git a/evil-numbers.el b/evil-numbers.el
index d679970654..17b29046c6 100644
--- a/evil-numbers.el
+++ b/evil-numbers.el
@@ -39,18 +39,19 @@
(save-match-data
(if (not (or
;; numbers or format specifier in front
- (looking-back (rx (or (+? digit)
- (and "0" (or (and (in "bB") (*? (in "01")))
- (and (in "oO") (*? (in
"0-7")))
- (and (in "xX") (*? (in
"0-9A-Fa-f"))))))))
+ (and
+ (looking-back (rx (or (+? digit)
+ (and "0" (or (and (in "bB") (*? (in
"01")))
+ (and (in "oO") (*? (in
"0-7")))
+ (and (in "xX") (*? (in digit
"A-Fa-f"))))))))
+ ;; being on a specifier is handled in progn
+ (not (looking-at "[bBoOxX]")))
;; search for number in rest of line
- (re-search-forward (rx
- (or
- (and "0" (in "bB") (+? (in "01")))
- (and "0" (in "oO") (+? (in "0-7")))
- (and "0" (in "xX") (+? (in digit "a-fA-F")))
- (or (and "0" (not (in "bBoOxX"))) (+?
digit))))
- (point-at-eol) t)))
+ (progn
+ ;; match 0 of specifier or digit, being in a literal and after
specifier is handled above
+ (re-search-forward "[[:digit:]]" (point-at-eol) t)
+ ;; skip format specifiers
+ (skip-chars-forward "bBoOxX"))))
(error "No number at point or until end of line")
(or
;; find binary literals