unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Jim Porter <jporterbugs@gmail.com>
Cc: 72721@debbugs.gnu.org, gautier@gautierponsinet.xyz
Subject: bug#72721: 31.0.50; Visual-wrap-prefix-mode breaks Magit log buffers
Date: Tue, 20 Aug 2024 22:01:33 +0300	[thread overview]
Message-ID: <86r0ajuigi.fsf@gnu.org> (raw)
In-Reply-To: <36584786-6af4-c59f-bb3e-f3459b2904be@gmail.com> (message from Jim Porter on Tue, 20 Aug 2024 10:33:06 -0700)

> Date: Tue, 20 Aug 2024 10:33:06 -0700
> Cc: 72721@debbugs.gnu.org, gautier@gautierponsinet.xyz
> From: Jim Porter <jporterbugs@gmail.com>
> 
> > 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.





  reply	other threads:[~2024-08-20 19:01 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-19 21:39 bug#72721: 31.0.50; Visual-wrap-prefix-mode breaks Magit log buffers Gautier Ponsinet
2024-08-20  0:46 ` Jim Porter
2024-08-20 11:53   ` Eli Zaretskii
2024-08-20 17:33     ` Jim Porter
2024-08-20 19:01       ` Eli Zaretskii [this message]
2024-08-21  3:15         ` Jim Porter
2024-08-21  5:18           ` Jim Porter
2024-08-21 19:12             ` Jim Porter
2024-08-22 12:54               ` Eli Zaretskii
2024-08-22  9:59             ` Eli Zaretskii
2024-08-22  9:53           ` Eli Zaretskii
2024-08-22 16:19             ` Jim Porter
2024-08-25  7:29               ` Eli Zaretskii
2024-08-25 16:26                 ` Jim Porter
2024-08-25 17:39                   ` Eli Zaretskii
2024-08-25 18:41                     ` Jim Porter
2024-08-29 11:47                       ` Eli Zaretskii
2024-08-30  5:01                         ` Jim Porter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=86r0ajuigi.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=72721@debbugs.gnu.org \
    --cc=gautier@gautierponsinet.xyz \
    --cc=jporterbugs@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).