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:
parent
dafa4deef4
commit
7ef3bee851
1 changed files with 16 additions and 4 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue