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#72721: 31.0.50; Visual-wrap-prefix-mode breaks Magit log buffers Date: Tue, 20 Aug 2024 22:01:33 +0300 Message-ID: <86r0ajuigi.fsf@gnu.org> References: <87cym4ry3e.fsf@gautierponsinet.xyz> <49828281-6a20-3791-91bd-9708ec51eb57@gmail.com> <86jzgbwgud.fsf@gnu.org> <36584786-6af4-c59f-bb3e-f3459b2904be@gmail.com> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="39876"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 72721@debbugs.gnu.org, gautier@gautierponsinet.xyz To: Jim Porter Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Aug 20 21:02:54 2024 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 1sgU85-000AAG-S8 for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 20 Aug 2024 21:02:54 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sgU7Z-0002RC-8z; Tue, 20 Aug 2024 15:02:21 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sgU7X-0002Qw-7d for bug-gnu-emacs@gnu.org; Tue, 20 Aug 2024 15:02:19 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sgU7W-00062V-Up for bug-gnu-emacs@gnu.org; Tue, 20 Aug 2024 15:02:18 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=References:In-Reply-To:From:Date:To:Subject; bh=dIEeMxm0rpKg0Lnif2z5goQ4TxsVq4xroEpuKKftnGM=; b=DU1i9PREiT5tRv7MBnk6vABYRdffKNwSJmxXarc5JNbBlYi2KzlqUBAqRDJFES1dI8CMKrC62BxIgADqhfPMg6GMqwixwqqBGGDnA9UHsB9UNf7U60thDUT286fyJJLQiR6DamUtdMZiu95IrrLmhrJ+Yri1kbRGkf/4+YD/Vo8NwGytvuzwuCgzd6DNm4Nt7GWlL1hiBwho3v4iigFxuKtJK50t7aPU4Uyphj4vE0oIBda9ToBf/uyjMFr6TdQxht+1+WLP075pqi7fFgVRzGHpvIE5ul/niFr+6RPWXazMot2HLsctRwrXv7C5C2bR4Q5ystSW8mNt/3sbdRfk/g==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sgU8D-0003B3-VA for bug-gnu-emacs@gnu.org; Tue, 20 Aug 2024 15:03:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 20 Aug 2024 19:03:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 72721 X-GNU-PR-Package: emacs Original-Received: via spool by 72721-submit@debbugs.gnu.org id=B72721.172418056112175 (code B ref 72721); Tue, 20 Aug 2024 19:03:01 +0000 Original-Received: (at 72721) by debbugs.gnu.org; 20 Aug 2024 19:02:41 +0000 Original-Received: from localhost ([127.0.0.1]:33654 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sgU7t-0003AJ-1T for submit@debbugs.gnu.org; Tue, 20 Aug 2024 15:02:41 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:51534) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sgU7q-0003A2-4d for 72721@debbugs.gnu.org; Tue, 20 Aug 2024 15:02:40 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sgU72-0005yi-3G; Tue, 20 Aug 2024 15:01:48 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=dIEeMxm0rpKg0Lnif2z5goQ4TxsVq4xroEpuKKftnGM=; b=Gm2Ns7oWVorn pLo40j0hcwbvb8JONQd6Gsw0+vT/YlkinNV18jLXEodGU0KD7CtwA2r/5dRT6jg4ZWMnmTqOtg0wU 26zQ7PDjHxFhxg7wGPyrkIWvailYtMjHLU/oP9wS2YdkYJ/dU6TDHN2qbGSdqQCh0h/y1Lr7m91qQ HZhZIxihg5DfvVd8Rd5UNdovsucsV7SPRIsaWozA7g6qdPYvvMEOCy204aa6XKpx56JpawsngNxcU 2c1RNilckXllQE8dZ3/aELVxIJykM13koN4aliSuenY75YVNh/cAQHUDzzC448nzgoC4pay/wWy6p Z8Y36njEM11GS2XmhCcWMQ==; In-Reply-To: <36584786-6af4-c59f-bb3e-f3459b2904be@gmail.com> (message from Jim Porter on Tue, 20 Aug 2024 10:33:06 -0700) 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-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:290464 Archived-At: > Date: Tue, 20 Aug 2024 10:33:06 -0700 > Cc: 72721@debbugs.gnu.org, gautier@gautierponsinet.xyz > From: Jim Porter > > > I'd appreciate a reproducer without Magit, as I don't have it > > installed and would prefer not to have to. > > Me too... I haven't been able to get a reduced test case yet since Magit > is pretty complex and I haven't figured out what it's doing exactly. It > *seems* to be due to overlays, but I only know that from examining > things in GDB. I haven't deciphered the relevant Magit code yet. M-x describe-text-properties will show you the properties and overlays at point, and it should be possible to concoct some Lisp which just reproduces those properties. > > It looks like you are breaking min-width support for display strings? > > They are used on the mode line and also in other places, and in > > general, min-width should treat buffers and strings alike. Can you > > explain the motivation for the proposed changes, and describe what you > > saw with the current code in this case? Where's the call to > > get-text-property and why did it use a buffer position instead of a > > string position? > > You're probably right. I think my patch was a little over-aggressive > (see attached for a more-surgical one). This patch may still be wrong, > but hopefully it gets a bit closer to what we want. It still doesn't feel right. But min-width is weird, so I need to look into the problem deeper to understand what is going on, and if you will be able to come up with a reproducer without Magit, it will help. > > I think this is what's happening, in a bit more detail: > magit-log-current uses overlays (I think to set up the right margin > text?). When visual-wrap-prefix-mode ("vwpm") is enabled, the display > engine goes through the buffer, finds the 'min-width' display property > from vwpm and holds onto it. Next, it starts processing an overlay. > > Eventually, that calls 'handle_display_prop' for the overlay which calls > 'display_min_width'. At this point, we have an object stored in > 'it->min_width_property' (thanks to vwpm), the local variable 'object' > is the overlay string, and 'bufpos' is the actual buffer position. > > Finally we call 'get_display_property' with the bufpos and object (which > calls 'Fget_text_property'), and kaboom: 'object' is a string of length > 1, but bufpos is much larger (~400 in my test). This sounds like we shouldn't be calling get_display_property here, or use a different OBJECT when we call it. IOW, the object and the position must match, and since here they don't, there's a disconnect somewhere. We need to find that disconnect and understand why it happens.