From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Aaron Jensen Newsgroups: gmane.emacs.bugs Subject: bug#45748: 28.0.50; fit-frame-to-buffer ignores leading spaces Date: Sat, 9 Jan 2021 10:27:12 -0600 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="27556"; mail-complaints-to="usenet@ciao.gmane.io" To: 45748@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Jan 09 17:28:15 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 1kyH67-00075L-JT for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 09 Jan 2021 17:28:15 +0100 Original-Received: from localhost ([::1]:38798 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kyH66-0003zS-KH for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 09 Jan 2021 11:28:14 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:60290) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kyH5z-0003z4-Um for bug-gnu-emacs@gnu.org; Sat, 09 Jan 2021 11:28:07 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:40955) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kyH5u-0005LF-ED for bug-gnu-emacs@gnu.org; Sat, 09 Jan 2021 11:28:07 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kyH5u-0001cA-B1 for bug-gnu-emacs@gnu.org; Sat, 09 Jan 2021 11:28:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Aaron Jensen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 09 Jan 2021 16:28: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.16102096546167 (code B ref 45748); Sat, 09 Jan 2021 16:28:02 +0000 Original-Received: (at 45748) by debbugs.gnu.org; 9 Jan 2021 16:27:34 +0000 Original-Received: from localhost ([127.0.0.1]:52501 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kyH5S-0001bP-4C for submit@debbugs.gnu.org; Sat, 09 Jan 2021 11:27:34 -0500 Original-Received: from mail-yb1-f169.google.com ([209.85.219.169]:34504) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kyH5N-0001b4-IO for 45748@debbugs.gnu.org; Sat, 09 Jan 2021 11:27:32 -0500 Original-Received: by mail-yb1-f169.google.com with SMTP id v67so12570016ybi.1 for <45748@debbugs.gnu.org>; Sat, 09 Jan 2021 08:27:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=ylL5ylZiv2O/5byw/ecGGgB6LDgF9cmpNrr6AXA1PBE=; b=EXKz7aSqFdBULxpZJWipx1DIasafgk6BDc6GQI4rbO1P8FSNITsQ10pV6k9336uY6C e5shUfVxNTWW/ayLrJm5MIksko5TunZIXd1SJvpdkGuGXLwqiTfXUzjXf+fOcvkO3qRw 9Cm+zYM31Viov02+DZqnzFR+wg5d7lIHCUK6VTbgcwo5JeokSEFQfZkcalOcR69+aVhc hTsNzH2hNXkBdv/wXtuKgc4rOTnXu7AXW0az6Pkyj5VKAOvyCEcAdBEx5kYkkzGLMuBm HhQ7+s9FgUV7A2ONPvgWGrGBZ3tNw9Eki2fbEROpeA8TxbYdgeUTXJdDJcflAcg49Qnb Bgxg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=ylL5ylZiv2O/5byw/ecGGgB6LDgF9cmpNrr6AXA1PBE=; b=hZ3gz7yfTl7FwXbb9yPk1ZvZs2fddvBfiSjAlwhXTxvxt7RsGHzWxib92kuvKnn4QD ll3kmttNZ/+XLO+sxyjFZs3YHVw3EO7XPIa2Ck/De25k73ki62H5y7RPcFZtmgSjpBqC 4YerDwNvPhPw1375bmRY55H3PyTpr1XyKTXG7slueLpH6NBnWTgRMEph/IlXqPw5hMaR +ZeLF8JPZ+Gcz5oV8rpyLIdcNplccDxtS95WlUbvs1mIareRMPzl77FT3fVewdYfx+Kt bMR5eySYgaXDK4VCMfqifV5LFRAcUpkZcwzPnnMwKJrj90UoMKD7XxsayZ0hP0cvvqFZ vU+g== X-Gm-Message-State: AOAM532Qu6bxVupOnX26Q6S0Nzpwoeaz2MU6sNEuub2xHEjs3ouqYg4n +QXyYc52GPpIt7cANpoYgUTz1xMsY9PbJLt2sYV/J9Z9J2iHXw== X-Google-Smtp-Source: ABdhPJwxN9HuXLs3rByxcc4xheQD1rwJLwwYFGXShIaq10356beutpY1w7kpOlqxdG8OZ2I0FOLkbe1OfrRk9H6fdwg= X-Received: by 2002:a25:497:: with SMTP id 145mr12630145ybe.275.1610209643634; Sat, 09 Jan 2021 08:27:23 -0800 (PST) In-Reply-To: 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:197555 Archived-At: On Sat, Jan 9, 2021 at 9:57 AM Aaron Jensen wrote: > > I believe the problem is with: > > (window-text-pixel-size nil t) > > 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 > > I can't say if window-text-pixel-size is behaving as expected or not. 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. In other words, start and bpos are not in sync, or the way that FETCH_BYTE works is different. If I subtract 1 from bpos when calling FETCH_BYTE, it works as expected.