branch: externals/dired-preview
commit a3dd67d46f30fa84bf0af6e74aa5c172be29f80e
Author: Protesilaos Stavrou <[email protected]>
Commit: Protesilaos Stavrou <[email protected]>
Refine dired-preview-get-window-size
Thanks to Bruno Boal[1] for testing this with me. It was done in a
private channel and the information is shared with permission.
[1] <https://git.sr.ht/~bboal>
---
dired-preview.el | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/dired-preview.el b/dired-preview.el
index 656fe7a7a7..4ca4efd163 100644
--- a/dired-preview.el
+++ b/dired-preview.el
@@ -217,7 +217,10 @@ DIMENSION is either a `:width' or `:height' keyword. It is
checked against `split-width-threshold' or
`split-height-threshold'"
(pcase dimension
- (:width fill-column)
+ (:width (if-let ((window-width (floor (window-total-width) 2))
+ ((> window-width fill-column)))
+ window-width
+ fill-column))
(:height (floor (window-height) 2))))
(defun dired-preview-display-action-side ()