Fix: not displaying count for the first match.

This commit is contained in:
Vincent Zhang 2018-12-31 18:38:37 +08:00
parent 1b0cbe842f
commit 9feaa79b4d

View file

@ -1203,21 +1203,18 @@ Requires `anzu', also `evil-anzu' if using `evil-mode' for compatibility with
(defsubst doom-modeline--symbol-overlay () (defsubst doom-modeline--symbol-overlay ()
"Show the number of matches for symbol overlay." "Show the number of matches for symbol overlay."
(when (and (bound-and-true-p symbol-overlay-keywords-alist) (let* ((keyword (symbol-overlay-assoc
(not (bound-and-true-p symbol-overlay-temp-symbol)) (ignore-errors (symbol-overlay-get-symbol))))
(not (bound-and-true-p iedit-mode))) (symbol (car keyword))
(when-let* ((keyword (symbol-overlay-assoc (before (symbol-overlay-get-list symbol 'car))
(ignore-errors (symbol-overlay-get-symbol)))) (after (symbol-overlay-get-list symbol 'cdr))
(symbol (car keyword)) (count (length before)))
(before (symbol-overlay-get-list symbol 'car)) (if (symbol-overlay-assoc symbol)
(after (symbol-overlay-get-list symbol 'cdr)) (propertize
(count (length before))) (format (concat " %d/%d " (and (cadr keyword) "in scope "))
(if (symbol-overlay-assoc symbol) (+ count 1)
(propertize (+ count (length after)))
(format (concat " %d/%d " (and (cadr keyword) "in scope ")) 'face (if (doom-modeline--active) 'doom-modeline-panel)))))
(+ count 1)
(+ count (length after)))
'face (if (doom-modeline--active) 'doom-modeline-panel))))))
(defsubst doom-modeline--multiple-cursors () (defsubst doom-modeline--multiple-cursors ()
"Show the number of multiple cursors." "Show the number of multiple cursors."