unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Kenichi Handa <handa@m17n.org>
Cc: emacs-devel@gnu.org
Subject: Re: xdisp.c problem?
Date: Fri, 31 Jan 2003 12:58:37 +0900 (JST)	[thread overview]
Message-ID: <200301310358.MAA21102@etlken.m17n.org> (raw)
In-Reply-To: <20030130.155620.107709347.Takaaki.Ota@am.sony.com> (message from Tak Ota on Thu, 30 Jan 2003 15:56:20 -0800 (PST))

In article <20030130.155620.107709347.Takaaki.Ota@am.sony.com>, Tak Ota <Takaaki.Ota@am.sony.com> writes:
> Here is the complete trace to where unwind_to_catch brings us back to
> internal_condition_case and the descending starts all over again.  The
> function set_cursor_from_row is in the trace.  It was not a simple
> loop but continuous signal generation caused by the change to
> internal_condition_case.
[...]
> unwind_to_catch() line 1172
> Fsignal(int 0x112b125c, int 0x519a46dc) line 1547 + 12 bytes
> args_out_of_range(int 0x00000000, int 0x00000000) line 140 + 35 bytes
> validate_interval_range(int 0x41942000, int * 0x0082f024, int * 0x0082f024, int 0x00000000) line 151 + 8 bytes
> Ftext_properties_at(int 0x00000000, int 0x41942000) line 585 + 16 bytes
> get_char_property_and_overlay(int 0x00000000, int 0x112d38ac, int 0x0082f030, int * 0x00000000) line 688 + 12 bytes
> Fnext_single_char_property_change(int 0x00000000, int 0x112d38ac, int 0x11297404, int 0x000006f5) line 802
> set_cursor_from_row(window * 0x019f9400, glyph_row * 0x00000000, glyph_matrix * 0x01a85000, int 0x00000000, int 0x00000000, int 0x00000000, int 0x00000000) line 9527 + 24 bytes

It seems that Fnext_single_char_property_change is called
with POS == 0 in this code:

L9525:      pos = make_number (string_buffer_position (w, glyph->object,
L9526:						 string_before_pos));
L9527:      pos = Fnext_single_char_property_change (pos, Qdisplay, Qnil, limit);

That means string_buffer_position returns 0 in your case.

Hmmm, as this function checks only `display' property, that
is a likely result if the buffer contains overlay string.

I've just installed the attached patch to skip such glyphs
that come from overlay string.  Please try again.

---
Ken'ichi HANDA
handa@m17n.org

2003-01-31  Kenichi Handa  <handa@m17n.org>

	* xdisp.c (SKIP_GLYPHS): New macro.
	(set_cursor_from_row): Skip all glyphs that comes from overlay
	string.

*** xdisp.c.~1.803.~	Wed Jan 29 21:55:18 2003
--- xdisp.c	Fri Jan 31 11:43:08 2003
***************
*** 9447,9452 ****
--- 9447,9465 ----
    return Qnil;
  }
  \f
+ 
+ /* Increment GLYPH until it reaches END or CONDITION fails while
+    adding (GLYPH)->pixel_width to X. */
+ 
+ #define SKIP_GLYPHS(glyph, end, x, condition)	\
+   do						\
+     {						\
+       (x) += (glyph)->pixel_width;		\
+       ++(glyph);				\
+     }						\
+   while ((glyph) < (end) && (condition))
+ 
+ 
  /* Set cursor position of W.  PT is assumed to be displayed in ROW.
     DELTA is the number of bytes by which positions recorded in ROW
     differ from current buffer positions.  */
***************
*** 9501,9512 ****
  	  string_start = glyph;
  	  string_start_x = x;
  	  /* Skip all glyphs from string.  */
! 	  do
! 	    {
! 	      x += glyph->pixel_width;
! 	      ++glyph;
! 	    }
! 	  while (glyph < end && STRINGP (glyph->object));
  	}
      }
  
--- 9514,9520 ----
  	  string_start = glyph;
  	  string_start_x = x;
  	  /* Skip all glyphs from string.  */
! 	  SKIP_GLYPHS (glyph, end, x, STRINGP (glyph->object));
  	}
      }
  
***************
*** 9517,9544 ****
  	 are from string.  As there's no easy way to know the
  	 character position of the current glyph, find the correct
  	 glyph on point by scanning from string_start again.  */
!       Lisp_Object pos, limit;
  
!       limit = make_number (MATRIX_ROW_END_CHARPOS (row) + delta);
        glyph = string_start;
        x = string_start_x;
!       pos = make_number (string_buffer_position (w, glyph->object,
! 						 string_before_pos));
!       pos = Fnext_single_char_property_change (pos, Qdisplay, Qnil, limit);
!       while (XINT (pos) <= pt_old)
  	{
  	  /* Skip glyphs from the same string.  */
! 	  do
  	    {
! 	      x += glyph->pixel_width;
! 	      ++glyph;
  	    }
- 	  while (glyph < end
- 		 && EQ (glyph->object, string_start->object));
- 	  if (glyph == end || !STRINGP (glyph->object))
- 	    break;
- 	  string_start = glyph;
- 	  pos = Fnext_single_char_property_change (pos, Qdisplay, Qnil, limit);
  	}
      }
  
--- 9525,9566 ----
  	 are from string.  As there's no easy way to know the
  	 character position of the current glyph, find the correct
  	 glyph on point by scanning from string_start again.  */
!       Lisp_Object limit;
!       Lisp_Object string;
!       int pos;
  
!       limit = make_number (pt_old + 1);
!       end = glyph;
        glyph = string_start;
        x = string_start_x;
!       string = glyph->object;
!       pos = string_buffer_position (w, string, string_before_pos);
!       /* If STRING is from overlay, LAST_POS == 0.  We skip such glyphs
! 	 because we always put cursor after overlay strings.  */
!       while (pos == 0 && glyph < end)
! 	{
! 	  string = glyph->object;
! 	  SKIP_GLYPHS (glyph, end, x, EQ (glyph->object, string));
! 	  if (glyph < end)
! 	    pos = string_buffer_position (w, glyph->object, string_before_pos);
! 	}
! 
!       while (glyph < end)
  	{
+ 	  pos = XINT (Fnext_single_char_property_change
+ 		      (make_number (pos), Qdisplay, Qnil, limit));
+ 	  if (pos > pt_old)
+ 	    break;
  	  /* Skip glyphs from the same string.  */
! 	  string = glyph->object;
! 	  SKIP_GLYPHS (glyph, end, x, EQ (glyph->object, string));
! 	  /* Skip glyphs from an overlay.  */
! 	  while (glyph < end
! 		 && ! string_buffer_position (w, glyph->object, pos))
  	    {
! 	      string = glyph->object;
! 	      SKIP_GLYPHS (glyph, end, x, EQ (glyph->object, string));
  	    }
  	}
      }

  reply	other threads:[~2003-01-31  3:58 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-01-29 23:33 xdisp.c problem? Tak Ota
2003-01-30  0:00 ` Kenichi Handa
2003-01-30  1:41   ` Tak Ota
2003-01-30  3:51     ` Kenichi Handa
2003-01-30 17:39       ` Tak Ota
2003-01-30 21:13       ` Tak Ota
2003-01-30 23:56         ` Tak Ota
2003-01-31  3:58           ` Kenichi Handa [this message]
2003-01-31  2:47             ` Masatake YAMATO
2003-01-31  6:05               ` Kenichi Handa
2003-01-31  6:01                 ` Masatake YAMATO
2003-01-31 17:34             ` Tak Ota
2003-01-31 19:19           ` Richard Stallman
2003-01-30 16:57     ` Masatake YAMATO
2003-01-31  0:35       ` Tak Ota
2003-01-31  2:16         ` Masatake YAMATO

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200301310358.MAA21102@etlken.m17n.org \
    --to=handa@m17n.org \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).