Subject: Re: bug#11199: 24.0.95; killing right-to-left text at eob leads to inconsistent state

From: YAMAMOTO Mitsuharu <[email-masked]>
Date: Mon, 09 Apr 2012 17:21:51 +0900

>>>>> On Mon, 09 Apr 2012 00:07:42 +0300, Eli Zaretskii <[email-masked]> said:

> Well, it would help if you could find out how does row->end get out
> of sync with row->maxpos, for this specific row.  Both end and
> maxpos are set near the end of display_line, around line 19480 of
> xdisp.c.  They are identical when bidi-display-reordering is turned
> off, but different when it's on (because maxpos-1 gives the largest
> buffer position of the characters in the row, while end-1 gives the
> buffer position of the rightmost character on display).  In this
> case, it looks like row->end came from a totally different screen
> line, the one that was killed by C-k.  I wonder how could that
> happen and which code is responsible.  Perhaps some code tries to
> reuse existing rows, and goofs.

It seems that row->end gets "out of sync" much earlier than C-k,
actually just after C-x C-e in Step 4 in the original recipe.  It is
set at the part you mentioned above in display_line:

 19473	  row->end = it->current;

and it->current has been updated by

 19379		  /* Consume the line end.  This skips over invisible lines.  */
 19380		  set_iterator_to_next (it, 1);

Maybe set_iterator_to_next has skipped too much, or another value
should be set to row->end if the subsequent row starts with some
right-to-left text?

			     YAMAMOTO Mitsuharu
			[email-masked]