mirror of
https://github.com/doomemacs/doomemacs
synced 2025-09-02 14:53:38 -05:00
Consider eval output width when deciding how to display it
If ':tools (eval +overlay)' is enabled, eval commands display their output in a floating overlay at EOL. If the output is longer than +eval-popup-min-lines (5), it will display it in a popup window instead. With this, it also will use a popup window if the output is longer than the minibuffer can display in one line,
This commit is contained in:
@@ -5,8 +5,14 @@
|
|||||||
"Display OUTPUT in a popup buffer."
|
"Display OUTPUT in a popup buffer."
|
||||||
(if (with-temp-buffer
|
(if (with-temp-buffer
|
||||||
(insert output)
|
(insert output)
|
||||||
(>= (count-lines (point-min) (point-max))
|
(or (>= (count-lines (point-min) (point-max))
|
||||||
+eval-popup-min-lines))
|
+eval-popup-min-lines)
|
||||||
|
(> (string-width
|
||||||
|
(buffer-substring (point-min)
|
||||||
|
(save-excursion
|
||||||
|
(goto-char (point-min))
|
||||||
|
(line-end-position))))
|
||||||
|
(window-width))))
|
||||||
(let ((output-buffer (get-buffer-create "*doom eval*"))
|
(let ((output-buffer (get-buffer-create "*doom eval*"))
|
||||||
(origin (selected-window)))
|
(origin (selected-window)))
|
||||||
(with-current-buffer output-buffer
|
(with-current-buffer output-buffer
|
||||||
@@ -42,8 +48,14 @@
|
|||||||
(funcall (if (or current-prefix-arg
|
(funcall (if (or current-prefix-arg
|
||||||
(with-temp-buffer
|
(with-temp-buffer
|
||||||
(insert output)
|
(insert output)
|
||||||
(>= (count-lines (point-min) (point-max))
|
(or (>= (count-lines (point-min) (point-max))
|
||||||
+eval-popup-min-lines))
|
+eval-popup-min-lines)
|
||||||
|
(>= (string-width
|
||||||
|
(buffer-substring (point-min)
|
||||||
|
(save-excursion
|
||||||
|
(goto-char (point-min))
|
||||||
|
(line-end-position))))
|
||||||
|
(window-width))))
|
||||||
(not (require 'eros nil t)))
|
(not (require 'eros nil t)))
|
||||||
#'+eval-display-results-in-popup
|
#'+eval-display-results-in-popup
|
||||||
#'+eval-display-results-in-overlay)
|
#'+eval-display-results-in-overlay)
|
||||||
|
Reference in New Issue
Block a user