Skip to content

Commit ac38d36

Browse files
authored
Preserve the font size as one navigates through the CIDER inspector (#3530)
Fixes #3527
1 parent 55e5d22 commit ac38d36

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
- Example string that is now trimmed away: `(java.lang.Long is in module java.base of loader 'bootstrap'; clojure.lang.IObj is in unnamed module of loader 'app')`
1010
- [#3522](https://github.com/clojure-emacs/cider/issues/3522): Introduce a new possible value for [`cider-use-overlays`](https://docs.cider.mx/cider/usage/code_evaluation.html#overlays): `errors-only`.
1111
- If specified, only errors will result in an overlay being shown.
12+
- [#3527](https://github.com/clojure-emacs/cider/issues/3527): Preserve the font size as one navigates through the CIDER inspector.
1213

1314
## 1.8.2 (2023-10-15)
1415

cider-inspector.el

+10-3
Original file line numberDiff line numberDiff line change
@@ -388,8 +388,13 @@ MAX-COLL-SIZE if non nil."
388388
;; Render Inspector from Structured Values
389389
(defun cider-inspector--render-value (value)
390390
"Render VALUE."
391-
(cider-make-popup-buffer cider-inspector-buffer 'cider-inspector-mode 'ancillary)
392-
(cider-inspector-render cider-inspector-buffer value)
391+
(let ((font-size (when-let ((b (get-buffer cider-inspector-buffer)))
392+
;; The font size is lost between inspector 'screens',
393+
;; because on each re-rendering, we wipe everything, including the mode.
394+
;; Enabling cider-inspector-mode is the specific step that loses the font size.
395+
(buffer-local-value 'text-scale-mode-amount b))))
396+
(cider-make-popup-buffer cider-inspector-buffer 'cider-inspector-mode 'ancillary)
397+
(cider-inspector-render cider-inspector-buffer value font-size))
393398
(cider-popup-buffer-display cider-inspector-buffer cider-inspector-auto-select-buffer)
394399
(when cider-inspector-fill-frame (delete-other-windows))
395400
(ignore-errors (cider-inspector-next-inspectable-object 1))
@@ -408,10 +413,12 @@ MAX-COLL-SIZE if non nil."
408413
(when cider-inspector-page-location-stack
409414
(goto-char (pop cider-inspector-page-location-stack))))))
410415

411-
(defun cider-inspector-render (buffer str)
416+
(defun cider-inspector-render (buffer str &optional font-size)
412417
"Render STR in BUFFER."
413418
(with-current-buffer buffer
414419
(cider-inspector-mode)
420+
(when font-size
421+
(text-scale-set font-size))
415422
(let ((inhibit-read-only t))
416423
(condition-case nil
417424
(cider-inspector-render* (car (read-from-string str)))

0 commit comments

Comments
 (0)