mu4e-main: fix off-by-one error in `mu4e~main-action-str'

For bookmarks, which specify the key combo instead of using the first
character of the string had an off-by-one error in the mouse
highlighting since it wasn't consuming that first letter.
This commit is contained in:
Sean Farley 2020-05-12 22:25:11 -07:00 committed by Dirk-Jan C. Binnema
parent 5110b02349
commit 9f1e231824
1 changed files with 8 additions and 1 deletions

View File

@ -107,7 +107,14 @@ clicked."
(define-key map (kbd "RET") func)
(put-text-property 0 (length newstr) 'keymap map newstr)
(put-text-property (string-match "\\[.+$" newstr)
(- (length newstr) 1) 'mouse-face 'highlight newstr)
;; only subtract one from length of newstr if we're
;; actually consuming the first letter (e.g.
;; `func-or-shortcut' is a function, meaning we put
;; braces around the first letter of `str')
(if (stringp func-or-shortcut)
(length newstr)
(- (length newstr) 1))
'mouse-face 'highlight newstr)
newstr))