From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Jim Porter Newsgroups: gmane.emacs.bugs Subject: bug#55696: 28.1; eshell fails to respect text-scale-increase Date: Fri, 3 Jun 2022 13:30:01 -0700 Message-ID: <0278e759-237b-a32b-4b1f-fbdacf39c8ef@gmail.com> References: <37af046b-4257-6370-c765-9290eae73fd4@gmail.com> <831qw6dzra.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="33128"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 55696@debbugs.gnu.org, jeff.kowalski@gmail.com To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Jun 03 22:35:55 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nxE1S-0008RO-QE for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 03 Jun 2022 22:35:54 +0200 Original-Received: from localhost ([::1]:44342 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nxE1Q-0001Lk-V6 for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 03 Jun 2022 16:35:53 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:37256) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nxDwl-0006Iy-1y for bug-gnu-emacs@gnu.org; Fri, 03 Jun 2022 16:31:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:34991) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nxDwk-000689-Mc for bug-gnu-emacs@gnu.org; Fri, 03 Jun 2022 16:31:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nxDwk-00053l-Hj for bug-gnu-emacs@gnu.org; Fri, 03 Jun 2022 16:31:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Jim Porter Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 03 Jun 2022 20:31:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 55696 X-GNU-PR-Package: emacs Original-Received: via spool by 55696-submit@debbugs.gnu.org id=B55696.165428821119384 (code B ref 55696); Fri, 03 Jun 2022 20:31:02 +0000 Original-Received: (at 55696) by debbugs.gnu.org; 3 Jun 2022 20:30:11 +0000 Original-Received: from localhost ([127.0.0.1]:57120 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nxDvu-00052Y-PX for submit@debbugs.gnu.org; Fri, 03 Jun 2022 16:30:11 -0400 Original-Received: from mail-pg1-f173.google.com ([209.85.215.173]:35603) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nxDvt-00051H-PZ for 55696@debbugs.gnu.org; Fri, 03 Jun 2022 16:30:10 -0400 Original-Received: by mail-pg1-f173.google.com with SMTP id 129so8072653pgc.2 for <55696@debbugs.gnu.org>; Fri, 03 Jun 2022 13:30:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=subject:to:cc:references:from:message-id:date:mime-version :in-reply-to:content-language:content-transfer-encoding; bh=QrvMLvyeTf7kFZggNIkvrnBghYvdNZKlXlx+484dM94=; b=ifzkBB88h1BOx5pUr2ARJBx1Z//qO33Nar89ZAOsRuxnFxMy6BxZSJNvtOuCDvurZJ tdZtKVxZ/6KHR0q5RWXX6KBGG1t41R9bsr7v36alWlMwHG9g8LX3DYL6YO0eLT93dXDR qjgLXGMRpOyrVUHIpSOQK/M5Nrgfn4GY6uHmE+2m36lEIA+GLpSc8TuXhalmHuXfrZsl 1vFercXBp1amWAzNKI/pswIe7v5E8Zp8UbfZXbFQI/PArXx2Eqyv4OjDsLWpA9japNlF HDVD/nqEcg2+4aQqYpx0LFqW7GcEtu6bNmN8QodZ8npw1bfBv9u498kUwH8e0DoRExMM +dig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=QrvMLvyeTf7kFZggNIkvrnBghYvdNZKlXlx+484dM94=; b=Y+P5c2VlsC+s2MqCNTT/m/BRUnI5WQp7g2Ag6t8Ey0cUmQoUp4ACRR41EoRpSDL0Hh Jv4yKbydNVWKHTJvQhvTBBOyyCwZNgRDskzSZ2W9aki5I9iuvA/zs2B2HNaR9l5WPCQX dPH27JZi4zyCMuzdYyR90AgbWDeNiMLxyPfTkFHBpwyX4CvuAEtHeBCcQclQEQ1/7SV7 ZgwUmyaI9sCZsNVDG7Ssc4GEbhBIgGKyHOeZCqih7JbiNxW4Ng9f96YXnG5KYk2Uz0Hk iQQwk2pajrGe9G+WJQhDp+60JpI7yDWsJKmPZOVJO/8W+kB0Ieu1jAgmeRmtu8f9bUGB cadg== X-Gm-Message-State: AOAM531EJC+lE1XoiVFvydt/OOAUBfDlHbSiUce08tjsHID7gBeU5RHB rUvfU/wDI9Wqasmd0GCi+40= X-Google-Smtp-Source: ABdhPJxDyajS3jv8y8oV8P1se1j7QcsVTETcHADUSX0cJoRuJLMMetdFZ1ARei0RK6x2Z+EHEIUV9Q== X-Received: by 2002:aa7:888f:0:b0:51b:edb5:2ec with SMTP id z15-20020aa7888f000000b0051bedb502ecmr2123602pfe.48.1654288203818; Fri, 03 Jun 2022 13:30:03 -0700 (PDT) Original-Received: from [192.168.1.2] (cpe-76-168-148-233.socal.res.rr.com. [76.168.148.233]) by smtp.googlemail.com with ESMTPSA id i4-20020aa787c4000000b0051bc581b62asm3888852pfo.121.2022.06.03.13.30.02 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 03 Jun 2022 13:30:03 -0700 (PDT) In-Reply-To: <831qw6dzra.fsf@gnu.org> Content-Language: en-US X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:233624 Archived-At: On 6/2/2022 11:31 PM, Eli Zaretskii wrote: > Thanks, but I'm not too happy with adding such a function to Emacs. I > understand why it could make sense for Eshell, or any other package > that uses fixed-size characters, like terminal emulators in term.el. > But in general, it makes no sense in Emacs to ask how many lines of a > given non-default font can fit in a window, because you cannot > guarantee that a single font will be used in the entire window -- it > is enough to have some of the text having the bold or italic face > attribute, or have some non-ASCII characters that will be displayed in > a different font, to disrupt the results. While I don't have a strong opinion that this function should exist, I think the scenario where it *could* be useful is to "make layout decisions", as the Lisp manual says (for `window-max-chars-per-line'). If you were making some UI in a Lisp program that wanted things to fit in a window all at once, you'd likely know what face would get used (and it might not be the default face). Then, you could use both `window-max-chars-per-line' and `window-max-lines' to figure out how much space you have. If that's not convincing, then let's do something more like what you suggest below. > We could perhaps make window-body-width and window-body-height > optionally pay attention to the remapping of the default face, which > should handle the case such as this one. Would that be acceptable for > you? That works fine for me. I was actually surprised that these functions didn't account for face remapping. Since window-body-(width|height) are C functions, it would be a bit more work to implement this, but I'm sure someone familiar with writing C-based Lisp functions wouldn't have much trouble. I could probably figure out how to do it myself with a bit of digging too. >> + (with-selected-window (window-normalize-window window t) >> + (let ((window-height (window-body-height window t)) >> + (font-height (window-font-height window face))) >> + (/ window-height font-height)))) > > Is integer division here really TRT? Shouldn't we round to the > nearest integer instead of truncating? I think integer division is right, but there's an argument either way. I see this function as asking the question, "How many lines can fully fit in this window without scrolling?" If I had a GUI terminal window open and it could fit 20.5 lines, I'd expect the $LINES variable in my shell to be 20. That way, a program that consults that variable would know that the 21st line is at least partly off-screen.