Skip to content

Commit 814692d

Browse files
committed
[Fix #1568] Mouse clicks expand collapsed dicts in nrepl-messages
1 parent fdc8d18 commit 814692d

File tree

1 file changed

+17
-6
lines changed

1 file changed

+17
-6
lines changed

nrepl-client.el

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1253,6 +1253,20 @@ Set this to nil to prevent truncation."
12531253
"Expand the text hidden under overlay BUTTON."
12541254
(delete-overlay button))
12551255

1256+
(defun nrepl--expand-button-mouse (event)
1257+
"Expand the text hidden under overlay BUTTON."
1258+
(interactive "e")
1259+
(pcase (elt event 1)
1260+
(`(,window ,_ ,_ ,_ ,_ ,point . ,_)
1261+
(with-selected-window window
1262+
(nrepl--expand-button (button-at point))))))
1263+
1264+
(define-button-type 'nrepl--collapsed-dict
1265+
'display "..."
1266+
'action #'nrepl--expand-button
1267+
'face 'link
1268+
'help-echo "RET: Expand dict.")
1269+
12561270
(defun nrepl--pp (object &optional foreground)
12571271
"Pretty print nREPL OBJECT, delimited using FOREGROUND."
12581272
(if (not (and (listp object)
@@ -1282,12 +1296,9 @@ Set this to nil to prevent truncation."
12821296
(> (count-screen-lines l (point) t)
12831297
nrepl-dict-max-message-size))
12841298
(make-button (1+ l) (point)
1285-
'display "..."
1286-
'action #'nrepl--expand-button
1287-
'mouse-action #'nrepl--expand-button
1288-
'face 'link
1289-
'help-echo "RET: Expand dict."
1290-
'follow-link t))))
1299+
:type 'nrepl--collapsed-dict
1300+
;; Workaround for bug#1568.
1301+
'local-map '(keymap (mouse-1 . nrepl--expand-button-mouse))))))
12911302
(insert (color ")\n"))))))))
12921303

12931304
(defun nrepl-messages-buffer-name (conn)

0 commit comments

Comments
 (0)