Skip to content

Commit

Permalink
Consider eval output width when deciding how to display it
Browse files Browse the repository at this point in the history
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,
  • Loading branch information
hlissner committed Dec 28, 2019
1 parent dafa4de commit 7ef3bee
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions modules/tools/eval/autoload/eval.el
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 7ef3bee

Please sign in to comment.