unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Assertion failure in set_iterator_to_next
@ 2010-04-11  0:52 Stefan Monnier
  2010-04-11  3:14 ` Eli Zaretskii
  0 siblings, 1 reply; 7+ messages in thread
From: Stefan Monnier @ 2010-04-11  0:52 UTC (permalink / raw)
  To: emacs-devel

While playing with my nhexl-mode.el I bumped into some assertion failure
in the redisplay code.  More specifically the assertion

	  xassert (IT_BYTEPOS (*it) == CHAR_TO_BYTE (IT_CHARPOS (*it)));

at line 6183.
I think the problem is that the non-bidi code above that line uses
it->len assuming it holds the length of the char at point (well, at
IT_CHARPOS(it)), whereas IIUC it holds the length of "the" glyph.
In my case it->c holds sometimes the "lf symbol" char (u240a) which comes
from a display property and it->len is then 3, which is obviously not
the length of the char at IT_CHARPOS since the buffer I was looking at
only happens to contain ASCII chars.

I use the quick patch below, which seems to fix the problem, but I don't
know enough of the redisplay to know whether that's the right fix, or
whether the right fix is to make sure it->len holds some other value.


        Stefan


--- src/xdisp.c 2010-04-06 16:00:42 +0000
+++ src/xdisp.c 2010-04-10 01:35:11 +0000
@@ -6151,7 +6151,8 @@
 
          if (!it->bidi_p)
            {
-             IT_BYTEPOS (*it) += it->len;
+             IT_BYTEPOS (*it)
+               += BYTES_BY_CHAR_HEAD (*BUF_BYTE_ADDRESS (XBUFFER (it->object), IT_BYTEPOS (*it)));
              IT_CHARPOS (*it) += 1;
            }
          else




^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2010-04-19 15:30 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-04-11  0:52 Assertion failure in set_iterator_to_next Stefan Monnier
2010-04-11  3:14 ` Eli Zaretskii
2010-04-11 15:02   ` Stefan Monnier
2010-04-11 18:14     ` Eli Zaretskii
2010-04-11 20:04       ` Stefan Monnier
2010-04-11 21:12         ` Eli Zaretskii
2010-04-19 15:30         ` Eli Zaretskii

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).