From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#45748: 28.0.50; fit-frame-to-buffer ignores leading spaces Date: Sat, 09 Jan 2021 19:44:19 +0200 Message-ID: <83r1mugg3w.fsf@gnu.org> References: Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="1893"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 45748@debbugs.gnu.org To: Aaron Jensen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Jan 09 18:45:09 2021 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 1kyIIX-0000OG-LV for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 09 Jan 2021 18:45:09 +0100 Original-Received: from localhost ([::1]:51904 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kyIIW-0005zs-FN for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 09 Jan 2021 12:45:08 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:44788) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kyIIQ-0005zU-Jt for bug-gnu-emacs@gnu.org; Sat, 09 Jan 2021 12:45:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:41018) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kyIIQ-0000h2-Be for bug-gnu-emacs@gnu.org; Sat, 09 Jan 2021 12:45:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kyIIQ-0003WQ-9H for bug-gnu-emacs@gnu.org; Sat, 09 Jan 2021 12:45:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 09 Jan 2021 17:45:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 45748 X-GNU-PR-Package: emacs Original-Received: via spool by 45748-submit@debbugs.gnu.org id=B45748.161021426413477 (code B ref 45748); Sat, 09 Jan 2021 17:45:02 +0000 Original-Received: (at 45748) by debbugs.gnu.org; 9 Jan 2021 17:44:24 +0000 Original-Received: from localhost ([127.0.0.1]:52564 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kyIHo-0003VJ-92 for submit@debbugs.gnu.org; Sat, 09 Jan 2021 12:44:24 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:51584) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kyIHl-0003V5-Gn for 45748@debbugs.gnu.org; Sat, 09 Jan 2021 12:44:23 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:34554) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kyIHg-0000Rm-9s; Sat, 09 Jan 2021 12:44:16 -0500 Original-Received: from 84.94.185.95.cable.012.net.il ([84.94.185.95]:4367 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1kyIHf-0001Yt-0L; Sat, 09 Jan 2021 12:44:16 -0500 In-Reply-To: (message from Aaron Jensen on Sat, 9 Jan 2021 10:27:12 -0600) 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:197561 Archived-At: > From: Aaron Jensen > Date: Sat, 9 Jan 2021 10:27:12 -0600 > > On Sat, Jan 9, 2021 at 9:57 AM Aaron Jensen wrote: > > > > I believe the problem is with: > > > > (window-text-pixel-size nil t) You mean with (window-text-pixel-size t t) right? > > The FROM of t causes window-text-pixel-size to ignore leading spaces. > > A TO of t, causes it to ignore trailing spaces. fit-frame-to-buffer > > passes both as t. This is hardcoded unless you use > > fit-frame-to-buffer-1 ??? fit-frame-to-buffer always calls fit-frame-to-buffer-1, sow hat do you mean by "unless"? > The problematic code appears to be here in window-text-pixel-size: > > else if (EQ (from, Qt)) > { > start = BEGV; > bpos = BEGV_BYTE; > while (bpos < ZV_BYTE) > { > c = fetch_char_advance (&start, &bpos); > if (!(c == ' ' || c == '\t' || c == '\n' || c == '\r')) > break; > } > while (bpos > BEGV_BYTE) > { > dec_both (&start, &bpos); > c = FETCH_BYTE (bpos); > if (!(c == ' ' || c == '\t')) > break; > } > } > > The second loop looks like it's attempting to backtrack to the > beginning of the line, but FETCH_BYTE (bpos) after a dec_both returns > the same character that the first loop ended on. No, it doesn't, it returns the byte at bpos after decrementing bpos. So it's the character before that. > In other words, start and bpos are not in sync ??? FETCH_BYTE doesn't change bpos, so if it was in sync with start before FETCH_BYTE, it is still in sync after it. So I don't think I understand what you mean here. Can you elaborate on your findings, please?