Subject: Re: bug#31666: Bad interaction between visual-line-mode and wrap-prefix on long lines

From: Clément Pit-Claudel <[email-masked]>
Date: Thu, 31 May 2018 19:16:12 -0400

On 2018-05-31 11:06, Eli Zaretskii wrote:
> …
> I'm not sure I understand/agree that the above describes the same
> issue as your example.  But let's deal with the example first:
> …
> I don't see why you shouldn't expect that.  Visual Line mode breaks
> long lines on whitespace characters, and the 15 spaces with which you
> start each line provide ample opportunity for that.  

That's a good point, the behavior that I dislike doesn't even require adaptive-wrap or a wrap-prefix property.  Just having a few spaces at the beginning of a line and a very long word is enough.

> ...
> Are you saying that you expected this instead:
> 
> xxxxxxxxxxxxxxx AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
>                 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
> 
> ?  That would be Visual Line mode missing an opportunity to break a
> long line on whitespace characters, no?

Yes, I think that's correct. If I understand correctly, the purpose of visual-line-mode is to break between word to avoid having to break inside words.  If breaking before a word doesn't prevent that word from being broken, it would seem better to not break before it.  In other words, assuming 9 columns:

Here breaking at ' ' is useful:

  Input:
  123456789
  xxx aaaaaaa

  Visual-line mode (good)
  123456789
  xxx
  aaaaaaa

But not here:

  Input
  123456789
  xxx aaaaaaaaaaaaa

  Visual-line mode (bad):
  123456789
  xxx
  aaaaaaaaa
  aaaa

  What I'd expect:
  123456789
  xxx aaaaa
  aaaaaaaa

Does this make sense?
Clément.