diff options
author | Artur Malabarba <bruce.connor.am@gmail.com> | 2016-03-01 14:27:48 -0300 |
---|---|---|
committer | Artur Malabarba <bruce.connor.am@gmail.com> | 2016-03-01 14:30:06 -0300 |
commit | 814692dd7c5e5a9aac19879909634504fe2ec9c1 (patch) | |
tree | ba608d885fc8e18947f3c010072bff6aae4db9f3 /nrepl-client.el | |
parent | fdc8d1894c1d9e11f762715cb67222cfbbfcdd20 (diff) |
[Fix #1568] Mouse clicks expand collapsed dicts in nrepl-messages
Diffstat (limited to 'nrepl-client.el')
-rw-r--r-- | nrepl-client.el | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/nrepl-client.el b/nrepl-client.el index ed1d9365..bdab522a 100644 --- a/nrepl-client.el +++ b/nrepl-client.el @@ -1253,6 +1253,20 @@ Set this to nil to prevent truncation." "Expand the text hidden under overlay BUTTON." (delete-overlay button)) +(defun nrepl--expand-button-mouse (event) + "Expand the text hidden under overlay BUTTON." + (interactive "e") + (pcase (elt event 1) + (`(,window ,_ ,_ ,_ ,_ ,point . ,_) + (with-selected-window window + (nrepl--expand-button (button-at point)))))) + +(define-button-type 'nrepl--collapsed-dict + 'display "..." + 'action #'nrepl--expand-button + 'face 'link + 'help-echo "RET: Expand dict.") + (defun nrepl--pp (object &optional foreground) "Pretty print nREPL OBJECT, delimited using FOREGROUND." (if (not (and (listp object) @@ -1282,12 +1296,9 @@ Set this to nil to prevent truncation." (> (count-screen-lines l (point) t) nrepl-dict-max-message-size)) (make-button (1+ l) (point) - 'display "..." - 'action #'nrepl--expand-button - 'mouse-action #'nrepl--expand-button - 'face 'link - 'help-echo "RET: Expand dict." - 'follow-link t)))) + :type 'nrepl--collapsed-dict + ;; Workaround for bug#1568. + 'local-map '(keymap (mouse-1 . nrepl--expand-button-mouse)))))) (insert (color ")\n")))))))) (defun nrepl-messages-buffer-name (conn) |