all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Jim Porter <jporterbugs@gmail.com>
To: Gautier Ponsinet <gautier@gautierponsinet.xyz>, 72721@debbugs.gnu.org
Cc: eliz@gnu.org
Subject: bug#72721: 31.0.50; Visual-wrap-prefix-mode breaks Magit log buffers
Date: Mon, 19 Aug 2024 17:46:18 -0700	[thread overview]
Message-ID: <49828281-6a20-3791-91bd-9708ec51eb57@gmail.com> (raw)
In-Reply-To: <87cym4ry3e.fsf@gautierponsinet.xyz>

[-- Attachment #1: Type: text/plain, Size: 1271 bytes --]

On 8/19/2024 2:39 PM, Gautier Ponsinet wrote:
> Hello everyone,
> 
> The new visual-wrap-prefix-mode breaks the rendering of the Magit Log
> buffers.
> 
> In emacs -Q:
> * Install Magit and its dependencies and load Magit.
> * Go to a local repository (via M-x dired or M-x cd).
> * M-x global-visual-wrap-prefix-mode
> * M-x magit-log-current
> 
> Could someone please confirm/reproduce?

I can confirm this. I'm not quite sure of all the details, but it seem 
that this is due to a bad interaction between overlays and the 
'min-width' display spec. The end result was that we were calling 
'get-text-property' with a (large-ish) buffer position when the OBJECT 
arg was a string of length 1. That can happen in magit-log on the 
mostly-blank line where it's making the ASCII art just below a merge 
commit. (The leading whitespace makes 'visual-wrap-prefix-mode' do its 
thing.)

I'm not super familiar with how the display engine works, but I think we 
don't want to call 'display_min_width' when we're working with an 
overlay. See the attached patch.

Eli, I'm sure you understand this code much better than me. Does the 
above make sense? I can also try to improve the commentary in the code, 
but I'm just making some educated guesses as to what's happening here.

[-- Attachment #2: 0001-Fix-bad-interaction-between-min-width-display-spec-a.patch --]
[-- Type: text/plain, Size: 1477 bytes --]

From da02157ee69c6ae2a220a8f38a9cd8c0f7105641 Mon Sep 17 00:00:00 2001
From: Jim Porter <jporterbugs@gmail.com>
Date: Mon, 19 Aug 2024 17:38:47 -0700
Subject: [PATCH] Fix bad interaction between 'min-width' display spec and
 overlays

* src/xdisp.c (handle_display_prop): Don't handle 'min-width' when
iterating over a string (bug#72721).
---
 src/xdisp.c | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/src/xdisp.c b/src/xdisp.c
index 30771a1c83d..bd6657fe522 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -5791,14 +5791,18 @@ handle_display_prop (struct it *it)
   propval = get_char_property_and_overlay (make_fixnum (position->charpos),
 					   Qdisplay, object, &overlay);
 
-  /* Rest of the code must have OBJECT be either a string or a buffer.  */
+
   if (!STRINGP (it->string))
-    object = it->w->contents;
+    {
+      /* Rest of the code must have OBJECT be either a string or a buffer.  */
+      object = it->w->contents;
 
-  /* Handle min-width ends. */
-  if (!NILP (it->min_width_property)
-      && NILP (find_display_property (propval, Qmin_width)))
-    display_min_width (it, bufpos, object, Qnil);
+      /* Handle min-width ends.  This doesn't apply while iterating over
+	 a string.  */
+      if (!NILP (it->min_width_property)
+	  && NILP (find_display_property (propval, Qmin_width)))
+	display_min_width (it, bufpos, object, Qnil);
+    }
 
   if (NILP (propval))
     return HANDLED_NORMALLY;
-- 
2.25.1


  reply	other threads:[~2024-08-20  0:46 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 [this message]
2024-08-20 11:53   ` Eli Zaretskii
2024-08-20 17:33     ` Jim Porter
2024-08-20 19:01       ` Eli Zaretskii
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

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

  git send-email \
    --in-reply-to=49828281-6a20-3791-91bd-9708ec51eb57@gmail.com \
    --to=jporterbugs@gmail.com \
    --cc=72721@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=gautier@gautierponsinet.xyz \
    /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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.