ui/doom-modeline: fix current index in iedit segment

This commit is contained in:
Henrik Lissner 2017-03-03 17:50:22 -05:00
parent fcb88ef940
commit ebf85fe0a8

View file

@ -454,19 +454,20 @@ lines are selected, or the NxM dimensions of a block selection."
(defsubst +doom-modeline--iedit () (defsubst +doom-modeline--iedit ()
"Show the number of iedit regions matches + what match you're on." "Show the number of iedit regions matches + what match you're on."
(when (and (featurep 'iedit) iedit-mode) (when (and iedit-mode iedit-occurrences-overlays)
(propertize (propertize
(let ((this-oc (let (message-log-max) (iedit-find-current-occurrence-overlay))) (let ((this-oc (or (let ((inhibit-message t))
(length (or (ignore-errors (length iedit-occurrences-overlays)) 0))) (iedit-find-current-occurrence-overlay))
(format " %s/%s " (progn (iedit-prev-occurrence)
(save-excursion (iedit-find-current-occurrence-overlay))))
(unless this-oc (length (length iedit-occurrences-overlays)))
(iedit-prev-occurrence) (format " %s/%d "
(setq this-oc (iedit-find-current-occurrence-overlay))) (if this-oc
(if this-oc (- length
;; NOTE: Not terribly reliable (length (cdr
(- length (-elem-index this-oc iedit-occurrences-overlays)) (memq this-oc (sort (append iedit-occurrences-overlays (list))
"-")) (lambda (x y) (< (overlay-start x) (overlay-start y))))))))
"-")
length)) length))
'face (if (active) 'doom-modeline-panel)))) 'face (if (active) 'doom-modeline-panel))))