[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Assertion failure in set_iterator_to_next
From: |
Stefan Monnier |
Subject: |
Re: Assertion failure in set_iterator_to_next |
Date: |
Sun, 11 Apr 2010 16:04:05 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) |
>> > No, it->len should be the length of the multibyte sequence of the
>> > character at IT_CHARPOS (*it). This is how the basic iteration works,
>> > and if the length is incorrect, we will get garbled display, in
>> > anything but pure 7-bit ASCII buffers.
>> OK, good. Can you update/complete dispextern.h correspondingly?
> Will do.
Thanks.
>> So the problem now is "why is it->len ==3 rather than ==1"?
> I think it's because it was not yet updated. It is updated only in
> the next_element_from_* functions. E.g., for a character from a
> buffer, we have this in next_element_from_buffer:
> /* Get the next character, maybe multibyte. */
> p = BYTE_POS_ADDR (IT_BYTEPOS (*it));
> if (it->multibyte_p && !ASCII_BYTE_P (*p))
> it-> c = STRING_CHAR_AND_LENGTH (p, it->len); <<<<<<<<<
> else
> it-> c = *p, it->len = 1; <<<<<<<<<
Oh, thank you very much. I searched for this spot and couldn't find it
(I grepped with a pattern like "->len =", which only caught the second
line which couldn't explain why I was getting it->len==3.
That should help me move forward.
> Since you are saying this is an ASCII buffer, are charpos and bytepos
> at least identical?
Yes, they're identical before the assignment to IT_CHARPOS and
IT_BYTEPOS, but since it->len==3 a discrepancy of 2 appears which then
triggers the subsequent xassert.
Stefan