emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Using window-screen-lines in window-adjust-process-window-size (was:


From: John Shahid
Subject: Re: Using window-screen-lines in window-adjust-process-window-size (was: Re: using window-screen-lines in window-adjust-process-window-size)
Date: Tue, 30 Apr 2019 18:26:35 -0400
User-agent: mu4e 1.1.0; emacs 27.0.50

I just realized that the initial term-height didn't use floor to round
down the value of window-text-height.  This was masked by a hook I have
in my configuration.  I attached another patch that fixes the issue.

>From 92825356ddf320a480c1dd4068cac3f995043faf Mon Sep 17 00:00:00 2001
From: John Shahid <address@hidden>
Date: Sat, 27 Apr 2019 12:21:38 -0400
Subject: [PATCH] Consider line spacing and font height when deriving proc
 window size

* lisp/window.el (window-adjust-process-window-size): Use
  window-screen-lines instead of window-body-height.
* lisp/term.el (term-mode): Use window-screen-lines to set the initial
  window height.
---
 lisp/term.el   | 2 +-
 lisp/window.el | 6 ++++--
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/lisp/term.el b/lisp/term.el
index 586a887a29..8a28e6df28 100644
--- a/lisp/term.el
+++ b/lisp/term.el
@@ -1024,7 +1024,7 @@ term-mode
   (setq indent-tabs-mode nil)
   (setq buffer-display-table term-display-table)
   (set (make-local-variable 'term-home-marker) (copy-marker 0))
-  (set (make-local-variable 'term-height) (window-text-height))
+  (set (make-local-variable 'term-height) (floor (window-screen-lines)))
   (set (make-local-variable 'term-width) (window-max-chars-per-line))
   (set (make-local-variable 'term-last-input-start) (make-marker))
   (set (make-local-variable 'term-last-input-end) (make-marker))
diff --git a/lisp/window.el b/lisp/window.el
index b4f5ac5cc4..c8fc1248ab 100644
--- a/lisp/window.el
+++ b/lisp/window.el
@@ -9425,10 +9425,12 @@ window-adjust-process-window-size
 the given windows."
   (when windows
     (let ((width (window-max-chars-per-line (car windows)))
-          (height (window-body-height (car windows))))
+          (height (with-selected-window (car windows)
+                    (floor (window-screen-lines)))))
       (dolist (window (cdr windows))
         (setf width (funcall reducer width (window-max-chars-per-line window)))
-        (setf height (funcall reducer height (window-body-height window))))
+        (setf height (funcall reducer height (with-selected-window window
+                                               (floor 
(window-screen-lines))))))
       (cons width height))))
 
 (defun window-adjust-process-window-size-smallest (_process windows)
-- 
2.21.0


reply via email to

[Prev in Thread] Current Thread [Next in Thread]