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 20:56:35 -0600 Message-ID: References: <01d09a7b-09b0-9221-5bf3-8454f94704f7@gmx.at> <83k0smgeq8.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="000000000000a4ce5b05b882f083" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="9450"; mail-complaints-to="usenet@ciao.gmane.io" Cc: martin rudalics , 45748@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Jan 10 03:57: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 1kyQuj-0002Me-Ox for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 10 Jan 2021 03:57:09 +0100 Original-Received: from localhost ([::1]:57848 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kyQui-0003n8-9Y for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 09 Jan 2021 21:57:08 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:38038) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kyQuc-0003mv-7m for bug-gnu-emacs@gnu.org; Sat, 09 Jan 2021 21:57:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:41395) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kyQuc-0006JP-0r for bug-gnu-emacs@gnu.org; Sat, 09 Jan 2021 21:57:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kyQub-0008Qg-W9 for bug-gnu-emacs@gnu.org; Sat, 09 Jan 2021 21:57: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: Sun, 10 Jan 2021 02:57: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.161024741332388 (code B ref 45748); Sun, 10 Jan 2021 02:57:01 +0000 Original-Received: (at 45748) by debbugs.gnu.org; 10 Jan 2021 02:56:53 +0000 Original-Received: from localhost ([127.0.0.1]:52941 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kyQuS-0008QJ-To for submit@debbugs.gnu.org; Sat, 09 Jan 2021 21:56:53 -0500 Original-Received: from mail-yb1-f182.google.com ([209.85.219.182]:45246) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kyQuR-0008Q5-Rr for 45748@debbugs.gnu.org; Sat, 09 Jan 2021 21:56:52 -0500 Original-Received: by mail-yb1-f182.google.com with SMTP id k78so13417494ybf.12 for <45748@debbugs.gnu.org>; Sat, 09 Jan 2021 18:56:51 -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=/DyS8CPk6LgCtsUaxTxuZt7x3v4LWM0feo9N7dD/YWM=; b=VetM3y1YplqDK8jucNEsyIcFx7A7ENX8SkM5f44Tgc8BkLbMA1D1Px/lS6W7h5K6+w w/ttCfQYIwprBjTK2Sem+4UiYzadwexVzQjt8x+Eg4j9yLHgzcjad0MKbw3UEvf0lZks 4n2waF+JtoUYjy4cJOAbvApuu8lG/fsApyx4w4U8Rz8/86it3/CXW2toTXbL4WpPSRlY 0WLPueUYIUVGlg/3u5Op7flNqOqBY7+b8ucKbKoTbCB99Co9TEXUKH4TBF22GdnaUiT0 Uy4OsIbC95Qi8/GkdmTZN/6GYNadw58rRkJYjGLcdBjsj218qcA0Wi57kcwfW7WESfXO S4sw== 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=/DyS8CPk6LgCtsUaxTxuZt7x3v4LWM0feo9N7dD/YWM=; b=WSMHAnwtKTzMUKH7uIIOXcJR/qV/Rp9BpSKK2/T6+rBnbK/dI4xYXtIKwU+TKGwQno rTAybruJ+VXTq35GqIeIVU+gFUGNfYQH8wq4kJIJpEDOkAsVDutnZhd8VpKvFmY1Vgag mX23LTjgHg2ca6kZRLEzVjvd7Pz96KZB6hEFfpEd6oFXjowHVWL6ar0BEwpodP9VS0vP V2LAHauIcZXIC8lHHjYxlZY5cFPKIYVBlJQ53MqwAwNs0YHTWiiuNqOydzYhPEum9eAn VpEStJ0QFEW+bHcr6FV81APqYxUbSnhqTYS63H+O/lmlKegJ7ESOpn03ynKF1yrWBlv9 rWoA== X-Gm-Message-State: AOAM532icfBj1w20xtkxua/oXNPQjka0YFO4qanhNF91Yh7PmH/ZjtUT gvpGV3tTVW9ERabmzhVfk+7Clif8HWZ/Pnmst+k= X-Google-Smtp-Source: ABdhPJw58nPf8iRG9FRcmCu9f3gnad/5eHSikG7zp/3NFJlnsQa6VwIonp1mDH9RPe1U7lCmVqFGKWP+i7fYndcKjxc= X-Received: by 2002:a25:aaee:: with SMTP id t101mr14934749ybi.517.1610247406132; Sat, 09 Jan 2021 18:56:46 -0800 (PST) In-Reply-To: <83k0smgeq8.fsf@gnu.org> 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:197581 Archived-At: --000000000000a4ce5b05b882f083 Content-Type: text/plain; charset="UTF-8" On Sat, Jan 9, 2021 at 12:14 PM Eli Zaretskii wrote: > Yes, probably. > > But before we do any changes here, we need a test suite. Would you > mind adding the necessary tests to test/src/xdisp-tests.el? Okay, I added a few basic tests for this case. I don't know if that's the best way to test it, but it's what I could figure out. The implementation bypasses the extra backtrack for the FROM, but the algorithm for the TO is the same as I first submitted. In that case, it's not really an extra backtrack since I have to dec to read the byte. If I had access to dec_bytepos declared in syntax.c, I think I could use that to avoid the extra backtrack (I'd fetch the dec_bytepos (bpos)) and test that and then only move the pointers if not breaking from the loop. I left the fetch_char_advance in the TO algorithm since it didn't seem necessary to replace it with separate fetch/inc_both. This could be done w/o the backtracking entirely by keeping two pointers, but that's more complicated, probably not much more efficient (if at all) and this will likely never be called in a tight loop. Let me know how this looks and if you want me to make any tweaks. --000000000000a4ce5b05b882f083 Content-Type: application/octet-stream; name="0001-Fix-window-text-pixel-size-with-leading-trailing-spa.patch" Content-Disposition: attachment; filename="0001-Fix-window-text-pixel-size-with-leading-trailing-spa.patch" Content-Transfer-Encoding: base64 Content-ID: X-Attachment-Id: f_kjqjkk1x0 RnJvbSA1OTU5MzcyNjNkNzdiZjM5MmEzMjk2MTExOWUwY2U3Zjg3NTQ1MjViIE1vbiBTZXAgMTcg MDA6MDA6MDAgMjAwMQpGcm9tOiBBYXJvbiBKZW5zZW4gPGFhcm9uamVuc2VuQGdtYWlsLmNvbT4K RGF0ZTogU2F0LCA5IEphbiAyMDIxIDIwOjQzOjMyIC0wNjAwClN1YmplY3Q6IFtQQVRDSF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ZQotLSAKMi4yOC4wCgo= --000000000000a4ce5b05b882f083--