From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: John Shahid Newsgroups: gmane.emacs.devel 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 Message-ID: <87muk7yvs4.fsf@gmail.com> References: <87va64lguo.fsf@gmail.com> <87tvi8r8w4.fsf@gmail.com> <87wojfvidf.fsf@gmail.com> <83wojfvi0p.fsf@gnu.org> <87imuw8uk2.fsf@gmail.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="30368"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: mu4e 1.1.0; emacs 27.0.50 Cc: emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed May 01 00:27:23 2019 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hLbDe-0007lU-SR for ged-emacs-devel@m.gmane.org; Wed, 01 May 2019 00:27:22 +0200 Original-Received: from localhost ([127.0.0.1]:54446 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hLbDd-0004EL-Kr for ged-emacs-devel@m.gmane.org; Tue, 30 Apr 2019 18:27:21 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:52446) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hLbCz-0004EG-EI for emacs-devel@gnu.org; Tue, 30 Apr 2019 18:26:42 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hLbCy-0007kQ-Cu for emacs-devel@gnu.org; Tue, 30 Apr 2019 18:26:41 -0400 Original-Received: from mail-qt1-x835.google.com ([2607:f8b0:4864:20::835]:34705) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hLbCy-0007k5-2h; Tue, 30 Apr 2019 18:26:40 -0400 Original-Received: by mail-qt1-x835.google.com with SMTP id j6so18334506qtq.1; Tue, 30 Apr 2019 15:26:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=references:user-agent:from:to:cc:subject:in-reply-to:date :message-id:mime-version; bh=YorQKwRbbtKPSv54kUp4TtQla5YDU5kf+Ettvyj7pwc=; b=IIp6CGFuyLYg/JVcFSDg9YP0bok5nEzb2Ev7jzMJKvuadVANoLOnRX4AVcqtI0ASTo aKWOmDIRYGoDiI563TU6GKnh2ba1XDTYOKzQlBf9qbZea9gE7fROlyQ5j0r3eQ2wMe6A eN2kTne+eQf6Vy7lEBg4ypFdYvDH//RBtSn5U5St0iwhW6fH8SoOoxINkhhuYoaBWhzj E9Rv1sRndDh9CEtEDcwgKGv4TlC5kFRRj+yRhwGNgiNdofj9tvivJFtYm+zlr0mj0axx z7tJCGxr0lHrbridM2TKWH8yeu/c7m0OPNoPt1vZgDZr7bQHLtGnyN2IpMzYVBR+xHwm lSow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:references:user-agent:from:to:cc:subject :in-reply-to:date:message-id:mime-version; bh=YorQKwRbbtKPSv54kUp4TtQla5YDU5kf+Ettvyj7pwc=; b=Kb4vKFsenpeXfQGreQOImnmXrnr1epUO8zaE+EzMm0S0qj+rMrSWPywNXo/fxRmG9h wU1DhRZJjDER8l9+zAaVPH+bxxGD6fJ+Pqox7+QQAsWzGxrmKFB3Bq04Edn/zkaPRhX5 taeX/QB/CTAJMs+Ka+Aq9zBf0QB5qdN38jeOTnd0uGn4GiE10vvCCkZf9B2WpuKLpu/2 y51RvYKQGNkxT7KwHpCmWGp+yqwKNpr4fSRTUsqQaYTcWIcZoQSwgqqd+Az1UP+xTB9c zVrpB2s4rDxWQNN0TOU5M/KGCyBHBxdWCb6zAqO7DYlmah8BzvUVDnwpuKLlilaVBlPp F3XQ== X-Gm-Message-State: APjAAAW9AhOw2fdoS8bWwVvUT1i03bNtCPBdGeXBzirRN64sbibq/Vel Qj+VaAu5uh7cqKS6lKux23UFnwoz X-Google-Smtp-Source: APXvYqz8RbtaLhtfbaM6EKS548pHnAmpVs1JbRNSmn8NF8wgyvWZc2FEqPqLgABZuqjsVzK0IQHKDg== X-Received: by 2002:a0c:d1da:: with SMTP id k26mr4821594qvh.117.1556663198860; Tue, 30 Apr 2019 15:26:38 -0700 (PDT) Original-Received: from amun (cpe-104-162-85-46.nyc.res.rr.com. [104.162.85.46]) by smtp.gmail.com with ESMTPSA id d127sm9976022qkf.8.2019.04.30.15.26.36 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 30 Apr 2019 15:26:36 -0700 (PDT) In-reply-to: <87imuw8uk2.fsf@gmail.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::835 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:236079 Archived-At: --=-=-= Content-Type: text/plain 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. --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-Consider-line-spacing-and-font-height-when-deriving-.patch >From 92825356ddf320a480c1dd4068cac3f995043faf Mon Sep 17 00:00:00 2001 From: John Shahid 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 --=-=-=--