Subject: bug#9771: 24.0.90; Redisplay problems with control characters

From: Johan Bockgård <[email-masked]>
Date: Wed, 19 Oct 2011 03:06:09 +0200

Eli Zaretskii <[email-masked]> writes:

> Consuming the last glyph of a display vector means that the next call
> to set_iterator_to_next will detect that the display vector is
> exhausted, and will advance to the next buffer position, the one after
> the position which we just passed by consuming all the glyphs from the
> display vector used to display the character at that position. Thus,
> "buffer position reached".

It seems that BUFFER_POS_REACHED_P at least misses the opportunity to
stop immediately before *any* glyph in the display vector has been
consumed, i.e. when dpvec_index == 0. (Or the problem is not with
BUFFER_POS_REACHED_P but with how it's being used.)

[...]
> In practice, after correcting the bug that caused the assertion
> violation, I can no longer reproduce the situation where we stop in
> the middle of the ^@ character.  If you can show me a recipe for
> winding up in the middle of a display vector under these or similar
> circumstances, I will have another look.

emacs -Q

C-u 2000 C-q 0 RET

Notice that the lines visible in the window start with "@^".

Press <up> until the top of the buffer just scrolls into view.

Notice that lines before point start with "^@", and lines after
point start with "@^".

Change BUFFER_POS_REACHED_P (or something) so that dpvec_index == 0 is
an acceptable stop position and this problem doesn't happen.