Subject: bug#56393: Actually fix the long lines display bug

From: Eli Zaretskii <[email-masked]>
Date: Sat, 09 Jul 2022 13:41:24 +0300

> Date: Sat, 09 Jul 2022 10:20:51 +0000
> From: Gregory Heytings <[email-masked]>
> cc: [email-masked], [email-masked], [email-masked]
> 
> > That's awesome, thanks.  I guess we will only need more measures if some 
> > situations are reported where this is not fast enough, or causes some 
> > other problems.
> >
> 
> I don't think it's possible to make it faster.  I forgot to mention that 
> C-s works instantly, too.
> 
> To anticipate one possible criticism: this feature comes at a (IMO) very 
> little price, namely that inside long lines (and only inside long lines) 
> line-move-visual does always not work as expected, point sometimes moves 
> to another column (but in most cases does not).  That's the only 
> compromise I did, and it is unavoidable.

I'm playing with the branch, and I see some problems.  I fixed a
couple, but that's just a band-aid, I think.

Try this:

  emacs -Q
  C-x C-f src/xdisp.c RET
  M->
  C-u 37100 C-p

This signals an error "Beginning of buffer".  And if I use M-v instead
of C-p, I don't get an error message, but I don't get to the line I
wanted, either: it silently stops much earlier.

I think this is because find_newline_no_quit is not allowed to move
back far enough.  Actually detecting whether the buffer has long lines
will help to avoid this in "normal" files, but I'm not sure yet what
to do with buffers that really have long lines, or whether it matters.

Also, are you running with assertions enabled?  If not, please
configure --enable-checking='yes,glyphs', because some problems are
detected much earlier then (the ones I fixed were such problems).