Subject: bug#59727: Problems with displaying long lines

From: Juri Linkov <[email-masked]>
Date: Wed, 30 Nov 2022 20:11:14 +0200

>> but the cursor motion is not visible.
>>
>> > If you window is auto-hscrolled as result, then there is indeed hard limit:
>> > the X coordinate of a screen line is an 'int', so MAX_INT divided by the
>> > pixel-width of your default font is as far as we can go.
>>
>> Maybe this limitation of auto-hscrolling should be documented?
>
> We could document them, indeed.  But where? maybe in PROBLEMS?

Not sure how to document this limitation because it still works
to some extent: when lines are not truncated, and point can be
moved to the end of a 1 GB buffer, then after toggling line truncation
while point is at the end of the buffer, cursor motion is shown
correctly with auto-hscrolling near the end of the buffer.

>> >> 2. after starting Isearch at a large column number,
>> >>    Emacs hangs up indefinitely, e.g. with
>> >>    'M-g TAB 10000000 RET C-s' then even C-g doesn't get out.
>> >>    Debugging shows that the problem is in 'isearch-update'
>> >>    where the call to 'pos-visible-in-window-group-p' doesn't return.
>> >>    When this call is removed, the search is instantaneous.
>> >>    (Optimizing lazy-highlight is a separate problem in bug#56815.)
>> >
>> > I thought we agreed that calling pos-visible-in-window-p is not a good idea
>> > in this situation, since it will always think any position is visible?
>>
>> Does pos-visible-in-window-p fail only on long lines?
>
> Not long, truncated ones.  It doesn't understand that positions that are to
> the left or to the right of the viewport are not "visible".

I don't know how it works but the docstring of pos-visible-in-window-p
says:

  If POS is only out of view because of horizontal scrolling, return non-nil.