emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/cider 8b2ef5fc73: Limit the maximum string size to be disp


From: ELPA Syncer
Subject: [nongnu] elpa/cider 8b2ef5fc73: Limit the maximum string size to be displayed in echo area
Date: Mon, 13 May 2024 15:59:29 -0400 (EDT)

branch: elpa/cider
commit 8b2ef5fc731e2b07956c5d10486d866bb37c5bf3
Author: Oleksandr Yakushev <alex@bytopia.org>
Commit: Oleksandr Yakushev <alex@bytopia.org>

    Limit the maximum string size to be displayed in echo area
---
 CHANGELOG.md      |  1 +
 cider-overlays.el | 13 +++++++++----
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 8dec7138bb..caa3245147 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -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).
diff --git a/cider-overlays.el b/cider-overlays.el
index 6310bb0d32..7332581662 100644
--- a/cider-overlays.el
+++ b/cider-overlays.el
@@ -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)
@@ -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.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]