Skip to content

Commit

Permalink
Limit the maximum string size to be displayed in echo area
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-yakushev committed May 13, 2024
1 parent b421bbb commit 2da9dcd
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
- [#3626](https://github.com/clojure-emacs/cider/issues/3626): `cider-ns-refresh`: jump to the relevant file/line on errors.
- [#3628](https://github.com/clojure-emacs/cider/issues/3628): `cider-ns-refresh`: summarize errors as an overlay.
- [#3660](https://github.com/clojure-emacs/cider/issues/3660): Fix `cider-inspector-def-current-val` always defining in `user` namespace.
- [#3661](https://github.com/clojure-emacs/cider/issues/3661): Truncate echo area output ahead of time.
- Bump the injected `enrich-classpath` to [1.19.3](https://github.com/clojure-emacs/enrich-classpath/compare/v1.19.0...v1.19.3).
- Bump the injected nREPL to [1.1.1](https://github.com/nrepl/nrepl/blob/v1.1.1/CHANGELOG.md#111-2024-02-20).
- Bump the injected `cider-nrepl` to [0.47.0](https://github.com/clojure-emacs/cider-nrepl/blob/v0.47.0/CHANGELOG.md#0470-2024-03-10).
Expand Down
13 changes: 9 additions & 4 deletions cider-overlays.el
Original file line number Diff line number Diff line change
Expand Up @@ -304,10 +304,10 @@ Note that, while POINT can be a number, it's preferable to be a marker, as
that will better handle some corner cases where the original buffer is not
focused."
(cl-assert (symbolp value-type)) ;; We assert because for avoiding confusion with the optional args.
(let* ((font-value (if cider-result-use-clojure-font-lock
(let* ((value (string-trim-right value))
(font-value (if cider-result-use-clojure-font-lock
(cider-font-lock-as-clojure value)
value))
(font-value (string-trim-right font-value))
(used-overlay (when (and point
cider-use-overlays
(if (equal 'error value-type)
Expand All @@ -316,10 +316,15 @@ focused."
(cider--make-result-overlay font-value
:where point
:duration cider-eval-result-duration
:prepend-face (or overlay-face 'cider-result-overlay-face)))))
:prepend-face (or overlay-face 'cider-result-overlay-face))))
(msg (format "%s%s" cider-eval-result-prefix value))
(max-msg-length (* (floor (max-mini-window-lines)) (frame-width)))
(msg (if (> (string-width msg) max-msg-length)
(format "%s..." (substring msg 0 (- max-msg-length 3)))
msg)))
(message
"%s"
(propertize (format "%s%s" cider-eval-result-prefix font-value)
(propertize msg
;; The following hides the message from the echo-area, but
;; displays it in the Messages buffer. We only hide the message
;; if the user wants to AND if the overlay succeeded.
Expand Down

0 comments on commit 2da9dcd

Please sign in to comment.