emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Tracking down assertion failure


From: Eli Zaretskii
Subject: Re: Tracking down assertion failure
Date: Thu, 13 Mar 2008 00:06:15 +0200

> From: Stefan Monnier <address@hidden>
> Date: Wed, 12 Mar 2008 15:18:29 -0400
> 
>         /* Skip from tlbufpos to PT and see where it is.  Note that
>            PT may be in invisible text.  If so, we will end at the
>            next visible position.  */
>         init_iterator (&it, w, CHARPOS (tlbufpos), BYTEPOS (tlbufpos),
>                        NULL, DEFAULT_FACE_ID);
>         xassert (IT_BYTEPOS (it) == CHAR_TO_BYTE (IT_CHARPOS (it)));
> 
> the problem is that as I keep adding such assertions earlier and earlier
> in the code I seem to start hitting another problem: I'm not sure at
> which point this condition should be true and and at which point it's OK
> for it not to be true (because the charpos and bytepos recorded refer
> to out-of-data data which will/should simply not be used).
> 
> Can someone help me out?  

I may be forgetting something, but isn't the iterator moving by
characters?  It uses the pair

      IT_BYTEPOS (*it) += it->len;
      IT_CHARPOS (*it) += 1;

to advance, so IT_BYTEPOS and IT_CHARPOS should always be in sync,
right?  Am I missing something?




reply via email to

[Prev in Thread] Current Thread [Next in Thread]