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: 73600@debbugs.gnu.org, gautier@gautierponsinet.xyz
Subject: bug#73600: 31.0.50; Visual wrap prefix mode and image display
Date: Fri, 04 Oct 2024 09:28:37 +0300	[thread overview]
Message-ID: <86v7y8xtyi.fsf@gnu.org> (raw)
In-Reply-To: <57d753c5-538d-d026-2f41-2a0eaddef746@gmail.com> (message from Jim Porter on Thu, 3 Oct 2024 17:28:14 -0700)

> Date: Thu, 3 Oct 2024 17:28:14 -0700
> Cc: 73600@debbugs.gnu.org, gautier@gautierponsinet.xyz
> From: Jim Porter <jporterbugs@gmail.com>
> 
> On 10/3/2024 3:59 AM, Eli Zaretskii wrote:
> > I think image-mode is just the tip of a very large iceberg, see above:
> > visual-wrap-prefix-mode currently doesn't correctly handle text
> > covered by display properties.  I think this bug was uncovered when we
> > removed on master a few artificial restrictions on min-width, such as
> > non-support for display and overlay strings.
> 
> How about something like this? With this patch, if the start of a line 
> is in the middle of a multi-line display spec, 'visual-wrap-prefix-mode' 
> won't add any new properties. That should prevent any unwanted interference.

Something like that, yes.  But unfortunately, it's more complicated,
see below.

> --- a/lisp/visual-wrap.el
> +++ b/lisp/visual-wrap.el
> @@ -117,7 +117,16 @@ visual-wrap--apply-to-line
>    "Apply visual-wrapping properties to the logical line starting at POSITION."
>    (save-excursion
>      (goto-char position)
> -    (when-let ((first-line-prefix (fill-match-adaptive-prefix))
> +    (when-let (;; Don't add wrapping properties if we're in the middle
> +               ;; of a multi-line display spec; it could be doing
> +               ;; absolutely anything, and we don't want to interfere.
> +               ;; (For example, this could be an image containing a
> +               ;; newline-byte being displayed in `image-mode'; see
> +               ;; bug#73600.)
> +               ((or (= position (point-min))
                       ^^^^^^^^^^^^^^^^^^^^^^^^
A.k.a. (bobp), right?  Since point is already at position.

> +                    (not (eq (get-char-property position 'display)
> +                             (get-char-property (1- position) 'display)))))

I think this is too radical.  There are 'display' properties that do
not replace the text: (space PROPS), (height HEIGHT), (raise FACT),
and a few others.  These should not prevent adding the wrapping
properties, I think.  The challenge is to detect the presence of
"allowed" properties and the absence of "forbidden" ones, since a
'display' property's spec could be a list or a vector of several
separate values.  So the code will need to look inside the list/vector
and examine each element.

We could also start with the above and document that lines that begin
with any 'display' property will not be visually aligned/wrapped --
maybe this is not a severe restriction in practice.





  reply	other threads:[~2024-10-04  6:28 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-02 13:04 bug#73600: 31.0.50; Visual wrap prefix mode and image display Gautier Ponsinet
2024-10-02 15:42 ` Eli Zaretskii
2024-10-02 15:51   ` Eli Zaretskii
2024-10-02 16:37     ` Jim Porter
2024-10-03 10:59       ` Eli Zaretskii
2024-10-04  0:28         ` Jim Porter
2024-10-04  6:28           ` Eli Zaretskii [this message]
2024-10-04 19:45             ` Jim Porter
2024-10-05  6:41               ` Eli Zaretskii
2024-10-05 18:07                 ` Jim Porter
2024-10-06  0:28                   ` Jim Porter
2024-10-12 12:00                   ` Eli Zaretskii
2024-10-13  1:36                     ` Jim Porter
2024-10-13  5:36                       ` Eli Zaretskii
2024-10-13 17:38                         ` Jim Porter
2024-10-13 18:51                           ` Eli Zaretskii
2024-10-13 20:50                             ` 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=86v7y8xtyi.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=73600@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).