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

From: Eli Zaretskii <[email-masked]>
Date: Mon, 09 Apr 2012 12:32:39 +0300

> Date: Mon, 09 Apr 2012 17:21:51 +0900
> From: YAMAMOTO Mitsuharu <[email-masked]>
> Cc: Michael Welsh Duggan <[email-masked]>,
> 	[email-masked]
> 
> 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.

Yes, that matches my observations, see my last mail today.

> 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

Looks like it.  Can you trace through set_iterator_to_next and its
subroutines, and see why it does so?  One way of doing that is to put
a breakpoint in set_iterator_to_next conditioned by the value of point
(which is available as 'current_buffer->pt').  (If you don't condition
by value of point, you will hit the breakpoint too many times.)

> or another value should be set to row->end if the subsequent row
> starts with some right-to-left text?

No, row->end always preserves the last position information of the
display iterator, no matter if the text was or wasn't reordered.  The
correct operation of the display engine when rendering the next line
depends on that.