mirror of
https://github.com/doomemacs/doomemacs
synced 2025-08-29 14:33:34 -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."
|
||||
(if (with-temp-buffer
|
||||
(insert output)
|
||||
(>= (count-lines (point-min) (point-max))
|
||||
+eval-popup-min-lines))
|
||||
(or (>= (count-lines (point-min) (point-max))
|
||||
+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*"))
|
||||
(origin (selected-window)))
|
||||
(with-current-buffer output-buffer
|
||||
@@ -42,8 +48,14 @@
|
||||
(funcall (if (or current-prefix-arg
|
||||
(with-temp-buffer
|
||||
(insert output)
|
||||
(>= (count-lines (point-min) (point-max))
|
||||
+eval-popup-min-lines))
|
||||
(or (>= (count-lines (point-min) (point-max))
|
||||
+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)))
|
||||
#'+eval-display-results-in-popup
|
||||
#'+eval-display-results-in-overlay)
|
||||
|
Reference in New Issue
Block a user