Skip to content

Commit

Permalink
fix rendering bug in meow--render-indicator
Browse files Browse the repository at this point in the history
function used to only read meow-insert-indicator.
this commit adds an association list to map states to indicator faces.
fixes meow-edit#246
  • Loading branch information
eshrh committed May 15, 2022
1 parent 72d6ff3 commit b6db7f3
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 3 deletions.
14 changes: 13 additions & 1 deletion CUSTOMIZATIONS.org
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,19 @@ Default:
(beacon . "BEACON"))
#+end_src

A list of mappings for how state is displayed in modeline indicator.
A association list of state symbols to strings describing the state.
** meow-indicator-face-alist
Default:

#+begin_src emacs-lisp
((normal . meow-normal-indicator)
(motion . meow-motion-indicator)
(keypad . meow-keypad-indicator)
(insert . meow-insert-indicator)
(beacon . meow-beacon-indicator))
#+end_src

An association list of meow state symbols to indicator face symbols.

** meow-display-thing-help

Expand Down
6 changes: 4 additions & 2 deletions meow-util.el
Original file line number Diff line number Diff line change
Expand Up @@ -161,11 +161,13 @@ Looks up the state in meow-replace-state-name-list"
(defun meow--render-indicator ()
"Renders a short indicator based on the current state."
(when (bound-and-true-p meow-global-mode)
(let ((state-name (meow--get-state-name (meow--current-state))))
(let* ((state (meow--current-state))
(state-name (meow--get-state-name state))
(indicator-face (alist-get state meow-indicator-face-alist)))
(if state-name
(propertize
(format " %s " state-name)
'face 'meow-insert-indicator)
'face indicator-face)
""))))

(defun meow--update-indicator ()
Expand Down
8 changes: 8 additions & 0 deletions meow-var.el
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,14 @@ This will affect how selection is displayed."
:type '(alist :key-type (symbol :tag "Meow state")
:key-value (string :tag "Indicator")))

(defvar meow-indicator-face-alist
'((normal . meow-normal-indicator)
(motion . meow-motion-indicator)
(keypad . meow-keypad-indicator)
(insert . meow-insert-indicator)
(beacon . meow-beacon-indicator))
"Alist of meow states -> faces")

(defcustom meow-select-on-change t
"Whether to activate region when exiting INSERT mode
after `meow-change', `meow-change-char' and `meow-change-save'."
Expand Down

0 comments on commit b6db7f3

Please sign in to comment.