[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 5493d22 05/39: Fix description truncation when showing doc
From: |
Justin Burkett |
Subject: |
[elpa] master 5493d22 05/39: Fix description truncation when showing docstrings |
Date: |
Thu, 21 Jun 2018 15:48:12 -0400 (EDT) |
branch: master
commit 5493d22489d159a758cb3f5e5f34f191c35c58de
Author: Justin Burkett <address@hidden>
Commit: Justin Burkett <address@hidden>
Fix description truncation when showing docstrings
---
which-key.el | 18 ++++++++++--------
1 file changed, 10 insertions(+), 8 deletions(-)
diff --git a/which-key.el b/which-key.el
index 1f4bfa1..ae69371 100644
--- a/which-key.el
+++ b/which-key.el
@@ -1515,10 +1515,12 @@ If KEY contains any \"special keys\" defined in
(defsubst which-key--truncate-description (desc)
"Truncate DESC description to `which-key-max-description-length'."
- (if (and which-key-max-description-length
- (> (length desc) which-key-max-description-length))
- (concat (substring desc 0 which-key-max-description-length) "..")
- desc))
+ (let* ((last-face (get-text-property (1- (length desc)) 'face desc))
+ (dots (propertize ".." 'face last-face)))
+ (if (and which-key-max-description-length
+ (> (length desc) which-key-max-description-length))
+ (concat (substring desc 0 which-key-max-description-length) dots)
+ desc)))
(defun which-key--highlight-face (description)
"Return the highlight face for DESCRIPTION if it has one."
@@ -1549,8 +1551,7 @@ ORIGINAL-DESCRIPTION is the description given by
(let* ((desc description)
(desc (if (string-match-p "^group:" desc)
(substring desc 6) desc))
- (desc (if group (concat which-key-prefix-prefix desc) desc))
- (desc (which-key--truncate-description desc)))
+ (desc (if group (concat which-key-prefix-prefix desc) desc)))
(make-text-button desc nil
'face (cond (hl-face hl-face)
(group 'which-key-group-description-face)
@@ -1623,8 +1624,9 @@ alists. Returns a list (key separator description)."
(hl-face (which-key--highlight-face orig-desc))
(key-binding (which-key--maybe-replace (cons keys orig-desc)))
(final-desc (which-key--propertize-description
- (cdr key-binding) group local hl-face orig-desc)))
- (setq final-desc (which-key--maybe-add-docstring final-desc orig-desc))
+ (cdr key-binding) group local hl-face orig-desc))
+ (final-desc (which-key--maybe-add-docstring final-desc orig-desc))
+ (final-desc (which-key--truncate-description final-desc)))
(when (consp key-binding)
(push
(list (which-key--propertize-key
- [elpa] master 1219622 02/39: Remove debugging message, (continued)
- [elpa] master 1219622 02/39: Remove debugging message, Justin Burkett, 2018/06/21
- [elpa] master c71fbbb 03/39: Add option to show docstrings in which-key buffer, Justin Burkett, 2018/06/21
- [elpa] master fce520f 08/39: Improve which-key--format-and-replace, Justin Burkett, 2018/06/21
- [elpa] master caa18b2 12/39: Fix descriptions of keys involving meta when showing keymaps, Justin Burkett, 2018/06/21
- [elpa] master e5db4b6 07/39: Handle null description in which-key--propertize-description, Justin Burkett, 2018/06/21
- [elpa] master 0aae4c8 04/39: Improve which-key-show-docstrings option, Justin Burkett, 2018/06/21
- [elpa] master 6a4d2c2 09/39: Extract which-key--ignore-keys-regexp and which-key-show-keymap-1, Justin Burkett, 2018/06/21
- [elpa] master ca991b0 11/39: Autoload the show keymap functions, Justin Burkett, 2018/06/21
- [elpa] master fd714bc 13/39: Fix docstring of which-key--get-keymap-bindings, Justin Burkett, 2018/06/21
- [elpa] master b5f7063 15/39: Detect menu-items in which-key--get-keymap-bindings, Justin Burkett, 2018/06/21
- [elpa] master 5493d22 05/39: Fix description truncation when showing docstrings,
Justin Burkett <=
- [elpa] master 2e53187 14/39: Fix typo in previous commit, Justin Burkett, 2018/06/21
- [elpa] master 7da9f8c 16/39: Fix which-key--show-keymap when no bidnings found, Justin Burkett, 2018/06/21
- [elpa] master 3c05294 26/39: Fix which-key--create-pages, Justin Burkett, 2018/06/21
- [elpa] master adc0d66 06/39: Use safe version of propertize, Justin Burkett, 2018/06/21
- [elpa] master 0f80d0f 17/39: Use symbol at point in whow keymap functions, Justin Burkett, 2018/06/21
- [elpa] master 61e399f 22/39: Add and use which-key--automatic-display, Justin Burkett, 2018/06/21
- [elpa] master 506c348 10/39: Add which-key-show-full-keymap, Justin Burkett, 2018/06/21
- [elpa] master d19fe4e 30/39: Fix switching to top-level from which-key-undo-key, Justin Burkett, 2018/06/21
- [elpa] master 9dc8d32 20/39: Add which-key-toggle-docstrings, Justin Burkett, 2018/06/21
- [elpa] master 206be7a 33/39: Fix behavior of f and t in evil operator map, Justin Burkett, 2018/06/21