From d048e1e6bd3f634ca8308003e67967f134098c6c Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Fri, 23 Dec 2011 16:51:51 +0200 Subject: [PATCH] Fix assertion violation in pop_it when org-indent-mode is used. src/xdisp.c (handle_invisible_prop): Handle correctly an invisible property that ends at ZV, so that the bidi iteration could be resumed from there (after widening). --- src/ChangeLog | 6 ++++++ src/xdisp.c | 11 ++++++----- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 87750228f43..a3521bcd031 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2011-12-23 Eli Zaretskii + + * xdisp.c (handle_invisible_prop): Handle correctly an invisible + property that ends at ZV, so that the bidi iteration could be + resumed from there (after widening). + 2011-12-22 Jan Djärv * nsfont.m (ns_spec_to_descriptor): Do not autorelease fdesc. diff --git a/src/xdisp.c b/src/xdisp.c index 41d393a65a7..90375ba1a33 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -4090,10 +4090,11 @@ handle_invisible_prop (struct it *it) while (invis_p); /* The position newpos is now either ZV or on visible text. */ - if (it->bidi_p && newpos < ZV) + if (it->bidi_p) { EMACS_INT bpos = CHAR_TO_BYTE (newpos); - int on_newline = FETCH_BYTE (bpos) == '\n'; + int on_newline = + bpos == ZV_BYTE || FETCH_BYTE (bpos) == '\n'; int after_newline = newpos <= BEGV || FETCH_BYTE (bpos - 1) == '\n'; @@ -4111,16 +4112,16 @@ handle_invisible_prop (struct it *it) SET_TEXT_POS (tpos, newpos, bpos); reseat_1 (it, tpos, 0); - /* If we reseat on a newline, we need to prep the + /* If we reseat on a newline/ZV, we need to prep the bidi iterator for advancing to the next character - after the newline, keeping the current paragraph + after the newline/EOB, keeping the current paragraph direction (so that PRODUCE_GLYPHS does TRT wrt prepending/appending glyphs to a glyph row). */ if (on_newline) { it->bidi_it.first_elt = 0; it->bidi_it.paragraph_dir = pdir; - it->bidi_it.ch = '\n'; + it->bidi_it.ch = (bpos == ZV_BYTE) ? -1 : '\n'; it->bidi_it.nchars = 1; it->bidi_it.ch_len = 1; } -- 2.39.2