From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: Assertion failure in set_iterator_to_next Date: Sun, 11 Apr 2010 06:14:48 +0300 Message-ID: <83633yznmf.fsf@gnu.org> References: Reply-To: Eli Zaretskii NNTP-Posting-Host: lo.gmane.org X-Trace: dough.gmane.org 1270955698 9332 80.91.229.12 (11 Apr 2010 03:14:58 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sun, 11 Apr 2010 03:14:58 +0000 (UTC) Cc: emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Apr 11 05:14:56 2010 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1O0ndP-0007kH-PX for ged-emacs-devel@m.gmane.org; Sun, 11 Apr 2010 05:14:56 +0200 Original-Received: from localhost ([127.0.0.1]:40518 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1O0ndO-00067b-R2 for ged-emacs-devel@m.gmane.org; Sat, 10 Apr 2010 23:14:54 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1O0ndK-00067M-Ll for emacs-devel@gnu.org; Sat, 10 Apr 2010 23:14:50 -0400 Original-Received: from [140.186.70.92] (port=59518 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1O0ndI-00067E-CN for emacs-devel@gnu.org; Sat, 10 Apr 2010 23:14:49 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1O0ndG-0007tG-Ss for emacs-devel@gnu.org; Sat, 10 Apr 2010 23:14:48 -0400 Original-Received: from mtaout20.012.net.il ([80.179.55.166]:38670) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1O0ndG-0007tA-M9 for emacs-devel@gnu.org; Sat, 10 Apr 2010 23:14:46 -0400 Original-Received: from conversion-daemon.a-mtaout20.012.net.il by a-mtaout20.012.net.il (HyperSendmail v2007.08) id <0L0O00H00ZHFI900@a-mtaout20.012.net.il> for emacs-devel@gnu.org; Sun, 11 Apr 2010 06:14:45 +0300 (IDT) Original-Received: from HOME-C4E4A596F7 ([77.127.74.198]) by a-mtaout20.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0L0O00F7YZOKO380@a-mtaout20.012.net.il>; Sun, 11 Apr 2010 06:14:45 +0300 (IDT) In-reply-to: X-012-Sender: halo1@inter.net.il X-detected-operating-system: by eggs.gnu.org: Solaris 10 (beta) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:123466 Archived-At: > From: Stefan Monnier > Date: Sat, 10 Apr 2010 20:52:45 -0400 > > 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. 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. > 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 think it->c is not always the character at IT_CHARPOS (*it). In particular, this code is under `case GET_FROM_BUFFER', so the iterator is iterating through the buffer, not through any string. But as you say, it->c still holds a character from a string. I think it->c is loaded only in get_next_display_element, which is called _after_ set_iterator_to_next advances to the next character. And if it->what is anything other than a character, it->c will not be updated at all. > 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. I don't think it's right. Can you show a simple test case where this problem happens?