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 11:44:46 -0600 Message-ID: References: <01d09a7b-09b0-9221-5bf3-8454f94704f7@gmx.at> 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="6584"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 45748@debbugs.gnu.org To: martin rudalics Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Jan 09 18:46:13 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 1kyIJX-0001b9-VJ for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 09 Jan 2021 18:46:11 +0100 Original-Received: from localhost ([::1]:52730 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kyIJX-0006US-0z for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 09 Jan 2021 12:46:11 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:44904) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kyIJO-0006Sn-04 for bug-gnu-emacs@gnu.org; Sat, 09 Jan 2021 12:46:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:41022) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kyIJN-000157-O3 for bug-gnu-emacs@gnu.org; Sat, 09 Jan 2021 12:46:01 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kyIJN-0003YG-Me for bug-gnu-emacs@gnu.org; Sat, 09 Jan 2021 12:46:01 -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 17:46:01 +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.161021430413575 (code B ref 45748); Sat, 09 Jan 2021 17:46:01 +0000 Original-Received: (at 45748) by debbugs.gnu.org; 9 Jan 2021 17:45:04 +0000 Original-Received: from localhost ([127.0.0.1]:52568 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kyIIS-0003Wt-Iu for submit@debbugs.gnu.org; Sat, 09 Jan 2021 12:45:04 -0500 Original-Received: from mail-yb1-f178.google.com ([209.85.219.178]:35426) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kyIIQ-0003W1-U7 for 45748@debbugs.gnu.org; Sat, 09 Jan 2021 12:45:03 -0500 Original-Received: by mail-yb1-f178.google.com with SMTP id u203so12681962ybb.2 for <45748@debbugs.gnu.org>; Sat, 09 Jan 2021 09:45:02 -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 :cc; bh=0vXHhAhr4s7UtZWA6UFb73WW0ddAo3BDwlGGwDhIiw0=; b=RZTSop9tadXNlnjglBK65sjvfE8yMRJFZtKS+5z+aGAcFDPAgzq/7/nZPTjZdB6sUO jWSxpgLq7EICV3aBBhvO4hVX85ve4V7lcQiJX6aorHNhQUx7bpiKYFYAqvS/IqNXRm6X YA45GbZ//dX/YpGmzOeGajXmmL+QP4CGnuTs79QSqtwy0pPCbl8q5Erh0rarMCXQD9Tc OZ46PdJPiADI+ZE2LCOtfRxrGmcePkxzSG9vIwlc8HiaiHZKP6AzzIPFZ0gPz+LdHDOP Tpf/qEnbv5qMvXF8lzFz0YCKizWpGC2GabNLS6pBZenPvGADu6hwkgdJK8/CLFEaiP4l vnjA== 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:cc; bh=0vXHhAhr4s7UtZWA6UFb73WW0ddAo3BDwlGGwDhIiw0=; b=YOgEWZhlZzQscbCiaF7Ne0hdCnZNCg84s5PdNEjKr9Guf3anqYk1GILE+8GlIlUICG 96qIZ0y333lnoVlc/RrJdf8AuYKqlALXuwAQIF11a5czuzKPsQyu/Yc+n35QV3opU9UU 2cpgh2DHGyeMvIZfy5V1ipLYzfXk07G/oG2KcrSgNTbAVLFHp45C+8XFILVfkWSbuhkI neHRtTdaqQk+ZSER03N3PaJrw20cc7cvPcyKXJw8Yi6ySBpI+ApbpsXybeT9CyQ4HRUr JXa30bD0dr28wd1bWgVos4bsUWsClz3N6niIlyZ+6vDxN5nDD52YuY3kxLfPT9hzXdmD sXgQ== X-Gm-Message-State: AOAM532FDqgWj9RrO9VbKTwS2Ss2zqnGLNhaFKgU0Vx+COooahVp6zzz 6xPGeQu6pRg2sGLyVLT7gU7nARo8k6u3DOapErg= X-Google-Smtp-Source: ABdhPJw6nK4YdhZ9PgGUhN/qh6npomA47LY4yyE7iM/az6+AEB0C80GNAzCRch1Ixm45ojPSB91iWpBdNI5DwpbOIc4= X-Received: by 2002:a25:497:: with SMTP id 145mr12954886ybe.275.1610214297109; Sat, 09 Jan 2021 09:44:57 -0800 (PST) In-Reply-To: <01d09a7b-09b0-9221-5bf3-8454f94704f7@gmx.at> 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:197562 Archived-At: On Sat, Jan 9, 2021 at 11:07 AM martin rudalics wrote: > Do you mean the first dec_both skips too much or not enough? That code > was broken when I wrote it initially, someone fixed the char/byte issue > later and now I'm too silly to understand it. It doesn't skip enough. I believe this fixes both the leading and trailing space problems: diff --git a/src/xdisp.c b/src/xdisp.c index 6a4304d194..20e7ca3a1e 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -10652,7 +10652,10 @@ DEFUN ("window-text-pixel-size", Fwindow_text_pixel_size, Swindow_text_pixel_siz { c = fetch_char_advance (&start, &bpos); if (!(c == ' ' || c == '\t' || c == '\n' || c == '\r')) - break; + { + dec_both (&start, &bpos); + break; + } } while (bpos > BEGV_BYTE) { @@ -10680,12 +10683,17 @@ DEFUN ("window-text-pixel-size", Fwindow_text_pixel_size, Swindow_text_pixel_siz { dec_both (&end, &bpos); c = FETCH_BYTE (bpos); if (!(c == ' ' || c == '\t' || c == '\n' || c == '\r')) - break; + { + inc_both (&end, &bpos); + break; + } } while (bpos < ZV_BYTE) { c = fetch_char_advance (&end, &bpos); if (!(c == ' ' || c == '\t')) break; } The problem is that the first loop leaves the pointer pointing to the next character and it's only back tracked once.