mirror of
https://github.com/correl/doom-modeline.git
synced 2024-11-23 11:09:54 +00:00
Fix #200: Helm mode line is mixedly active/inactive when previewing a line.
This commit is contained in:
parent
e2e8c1c422
commit
1834cf687d
1 changed files with 53 additions and 36 deletions
|
@ -2188,46 +2188,58 @@ The cdr can also be a function that returns a name to use.")
|
||||||
(doom-modeline-def-segment helm-buffer-id
|
(doom-modeline-def-segment helm-buffer-id
|
||||||
"Helm session identifier."
|
"Helm session identifier."
|
||||||
(when (bound-and-true-p helm-alive-p)
|
(when (bound-and-true-p helm-alive-p)
|
||||||
(concat
|
(let ((active (doom-modeline--active)))
|
||||||
(doom-modeline-spc)
|
(concat
|
||||||
(doom-modeline-icon-fileicon "elisp" :height 1.0 :v-adjust -0.15
|
(doom-modeline-spc)
|
||||||
:face (if doom-modeline-major-mode-color-icon
|
(doom-modeline-icon-fileicon "elisp"
|
||||||
'all-the-icons-purple
|
:height 1.0
|
||||||
'mode-line))
|
:v-adjust -0.15
|
||||||
(if doom-modeline-icon (doom-modeline-spc))
|
:face (if active
|
||||||
(propertize
|
(if doom-modeline-major-mode-color-icon
|
||||||
(let ((custom (cdr (assoc (buffer-name) doom-modeline--helm-buffer-ids)))
|
'all-the-icons-purple
|
||||||
(case-fold-search t)
|
'mode-line)
|
||||||
(name (replace-regexp-in-string "-" " " (buffer-name))))
|
'mode-line-inactive))
|
||||||
(cond ((stringp custom) custom)
|
(when doom-modeline-icon (doom-modeline-spc))
|
||||||
((functionp custom) (funcall custom))
|
(propertize
|
||||||
(t
|
(let ((custom (cdr (assoc (buffer-name) doom-modeline--helm-buffer-ids)))
|
||||||
(string-match "\\*helm:? \\(mode \\)?\\([^\\*]+\\)\\*" name)
|
(case-fold-search t)
|
||||||
(concat "HELM " (capitalize (match-string 2 name))))))
|
(name (replace-regexp-in-string "-" " " (buffer-name))))
|
||||||
'face 'doom-modeline-buffer-file)
|
(cond ((stringp custom) custom)
|
||||||
(doom-modeline-spc))))
|
((functionp custom) (funcall custom))
|
||||||
|
(t
|
||||||
|
(string-match "\\*helm:? \\(mode \\)?\\([^\\*]+\\)\\*" name)
|
||||||
|
(concat "HELM " (capitalize (match-string 2 name))))))
|
||||||
|
'face (if active' doom-modeline-buffer-file 'mode-line-inactive))
|
||||||
|
(doom-modeline-spc)))))
|
||||||
|
|
||||||
(doom-modeline-def-segment helm-number
|
(doom-modeline-def-segment helm-number
|
||||||
"Number of helm candidates."
|
"Number of helm candidates."
|
||||||
(when (bound-and-true-p helm-alive-p)
|
(when (bound-and-true-p helm-alive-p)
|
||||||
(concat
|
(let ((active (doom-modeline--active)))
|
||||||
(propertize (format " %d/%d"
|
(concat
|
||||||
(helm-candidate-number-at-point)
|
(propertize (format " %d/%d"
|
||||||
(helm-get-candidate-number t))
|
(helm-candidate-number-at-point)
|
||||||
'face 'doom-modeline-buffer-path)
|
(helm-get-candidate-number t))
|
||||||
(propertize (format " (%d total) " (helm-get-candidate-number))
|
'face (if active 'doom-modeline-buffer-path 'mode-line-inactive))
|
||||||
'face 'doom-modeline-info))))
|
(propertize (format " (%d total) " (helm-get-candidate-number))
|
||||||
|
'face (if active 'doom-modeline-info 'mode-line-inactive))))))
|
||||||
|
|
||||||
(doom-modeline-def-segment helm-help
|
(doom-modeline-def-segment helm-help
|
||||||
"Helm keybindings help."
|
"Helm keybindings help."
|
||||||
(when (bound-and-true-p helm-alive-p)
|
(when (bound-and-true-p helm-alive-p)
|
||||||
(-interleave
|
(let ((active (doom-modeline--active)))
|
||||||
(mapcar (lambda (s)
|
(-interleave
|
||||||
(propertize (substitute-command-keys s) 'face 'doom-modeline-buffer-file))
|
(mapcar (lambda (s)
|
||||||
'("\\<helm-map>\\[helm-help]"
|
(propertize (substitute-command-keys s)
|
||||||
"\\<helm-map>\\[helm-select-action]"
|
'face (if active
|
||||||
"\\<helm-map>\\[helm-maybe-exit-minibuffer]/F1/F2..."))
|
'doom-modeline-buffer-file
|
||||||
'("(help) " "(actions) " "(action) "))))
|
'mode-line-inactive)))
|
||||||
|
'("\\<helm-map>\\[helm-help]"
|
||||||
|
"\\<helm-map>\\[helm-select-action]"
|
||||||
|
"\\<helm-map>\\[helm-maybe-exit-minibuffer]/F1/F2..."))
|
||||||
|
(mapcar (lambda (s)
|
||||||
|
(propertize s 'face (if active 'mode-line 'mode-line-inactive)))
|
||||||
|
'("(help) " "(actions) " "(action) "))))))
|
||||||
|
|
||||||
(doom-modeline-def-segment helm-prefix-argument
|
(doom-modeline-def-segment helm-prefix-argument
|
||||||
"Helm prefix argument."
|
"Helm prefix argument."
|
||||||
|
@ -2235,7 +2247,10 @@ The cdr can also be a function that returns a name to use.")
|
||||||
helm--mode-line-display-prefarg)
|
helm--mode-line-display-prefarg)
|
||||||
(let ((arg (prefix-numeric-value (or prefix-arg current-prefix-arg))))
|
(let ((arg (prefix-numeric-value (or prefix-arg current-prefix-arg))))
|
||||||
(unless (= arg 1)
|
(unless (= arg 1)
|
||||||
(propertize (format "C-u %s" arg) 'face 'doom-modeline-info)))))
|
(propertize (format "C-u %s" arg)
|
||||||
|
'face (if (doom-modeline--active)
|
||||||
|
'doom-modeline-info
|
||||||
|
'mode-line-inactive))))))
|
||||||
|
|
||||||
(defvar doom-modeline--helm-current-source nil
|
(defvar doom-modeline--helm-current-source nil
|
||||||
"The currently active helm source.")
|
"The currently active helm source.")
|
||||||
|
@ -2244,7 +2259,9 @@ The cdr can also be a function that returns a name to use.")
|
||||||
(when (and (bound-and-true-p helm-alive-p)
|
(when (and (bound-and-true-p helm-alive-p)
|
||||||
doom-modeline--helm-current-source
|
doom-modeline--helm-current-source
|
||||||
(eq 1 (cdr (assq 'follow doom-modeline--helm-current-source))))
|
(eq 1 (cdr (assq 'follow doom-modeline--helm-current-source))))
|
||||||
"HF"))
|
(propertize "HF" 'face (if (doom-modeline--active)
|
||||||
|
'mode-line
|
||||||
|
'mode-line-inactive))))
|
||||||
|
|
||||||
;;
|
;;
|
||||||
;; git timemachine
|
;; git timemachine
|
||||||
|
@ -2268,8 +2285,8 @@ The cdr can also be a function that returns a name to use.")
|
||||||
|
|
||||||
;; buffer name
|
;; buffer name
|
||||||
(propertize "*%b*" 'face (if active
|
(propertize "*%b*" 'face (if active
|
||||||
'doom-modeline-buffer-file
|
'doom-modeline-buffer-file
|
||||||
'mode-line-inactive)))))
|
'mode-line-inactive)))))
|
||||||
|
|
||||||
(provide 'doom-modeline-segments)
|
(provide 'doom-modeline-segments)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue