mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-06-14 12:31:25 +00:00
Use frame-pixel-width/height to determine if frame is landscape
* lisp/window.el (window--frame-landscape-p): New function. (split-window-sensibly): Call it (bug#80053).
This commit is contained in:
parent
495f6b412d
commit
4dc7d6056f
1 changed files with 11 additions and 1 deletions
|
|
@ -7584,6 +7584,16 @@ strategy."
|
|||
(with-selected-window window
|
||||
(split-window-right))))
|
||||
|
||||
(defun window--frame-landscape-p (&optional frame)
|
||||
"Non-nil if FRAME is wider than it is tall.
|
||||
|
||||
On text frames, uses a heuristic for character height and width."
|
||||
(if (display-graphic-p frame)
|
||||
(> (frame-pixel-width frame) (frame-pixel-height frame))
|
||||
;; On a terminal, displayed characters are usually roughly twice as
|
||||
;; tall as they are wide.
|
||||
(> (frame-width frame) (* 2 (frame-height frame)))))
|
||||
|
||||
(defun split-window-sensibly (&optional window)
|
||||
"Split WINDOW in a way suitable for `display-buffer'.
|
||||
The variable `split-window-preferred-direction' prescribes an order of
|
||||
|
|
@ -7624,7 +7634,7 @@ split."
|
|||
(or (if (or
|
||||
(eql split-window-preferred-direction 'horizontal)
|
||||
(and (eql split-window-preferred-direction 'longest)
|
||||
(> (frame-width) (frame-height))))
|
||||
(window--frame-landscape-p (window-frame window))))
|
||||
(or (window--try-horizontal-split window)
|
||||
(window--try-vertical-split window))
|
||||
(or (window--try-vertical-split window)
|
||||
|
|
|
|||
Loading…
Reference in a new issue