Subject: Re: bug#79241: [PATCH v2] Fix incorrect handling of overlays in `vertical-motion'

From: Sergio Pastor Pérez <[email-masked]>
Date: Sun, 24 Aug 2025 20:36:22 +0200

Eli Zaretskii <[email-masked]> writes:

>> From: Sergio Pastor Pérez <[email-masked]>
>> Cc: [email-masked]
>> Date: Sun, 24 Aug 2025 19:58:47 +0200
>> 
>> Eli Zaretskii <[email-masked]> writes:
>> 
>> >> +	  if (it.method == GET_FROM_STRING)
>> >> +	    reseat_at_previous_visible_line_start(&it);
>> >> +
>> >>  	  move_it_in_display_line (&it, ZV, first_x + to_x, MOVE_TO_X);
>> >>  	  /* If we find ourselves in the middle of an overlay string
>> >>  	     which includes a newline after current string position,
>> >
>> > Is this needed only for overlays?  What about 'display' text
>> > properties?  (There are also other cases when it.method could be
>> > GET_FROM_STRING.)  If this is only for overlay strings, we need to use
>> >
>> >   if (it.method == GET_FROM_STRING && !NILP (it.from_overlay))
>> >
>> > instead.  Please test this at least with 'display' property strings
>> > instead of overlay strings, and see if the same problem happens in
>> > that case.  Then we will be able to decide how to write the condition
>> > in this case.
>> 
>> So I've tested this behavior with this display property:
>> --8<---------------cut here---------------start------------->8---
>> (let* ((start (point))
>>        (end (1+ (point)))
>>        (ov (make-overlay start end)))
>>   (overlay-put ov 'display "--->HELLO\nAnother message\nDONE<---"))
>> --8<---------------cut here---------------end--------------->8---
>
> No, this is not what I meant.  I meant to test 'display' text
> property, not overlay property.

Oh, understood. I've sent version 3 so it only affects overlays, for
display text properties we have the same convoluted behavior I described
in the previous mail. With v2 of the patch, at least the target column
is corrected but has the line skip issue, what I said in the previous
mail still holds.