Mike Kupfer wrote:
> I guess I'll go off and study redisplay.c some more...
Okay, after reviewing the redisplay and events code, plus some sessions
with gdb, I came up with the following patch. I want to test it some
more, but I thought I'd post it now in case someone sees something
obviously bogus with it.
mike
PS. I wonder if the ChangeLog entry could use some tweaking. In
particular, I wonder if the root cause was that the minibuffer was
active in frame A, but the motion event was for frame B. (I use
click-to-type to set input focus.)
2010-12-31 Mike Kupfer <mike.kupfer(a)xemacs.org>
* redisplay.c (pixel_to_glyph_translation): Handle the case where
row and column are zero, and there aren't any runes. This can
happen with motion events when entering a frame and the minibuffer
is active.
diff --git a/src/redisplay.c b/src/redisplay.c
--- a/src/redisplay.c
+++ b/src/redisplay.c
@@ -9154,19 +9154,27 @@
for (*col = 0; *col <= Dynarr_length (db->runes); (*col)++)
{
- int past_end = (*col == Dynarr_length (db->runes));
-
- if (!past_end)
- rb = Dynarr_atp (db->runes, *col);
-
- if (past_end ||
- (rb->xpos <= x_coord && x_coord < rb->xpos + rb->width))
+ if (*col == Dynarr_length (db->runes))
{
- if (past_end)
- {
- (*col)--;
- rb = Dynarr_atp (db->runes, *col);
- }
+ /* We've run out of runes to look at. Treat the same as
+ the case below where we failed to find a non-glyph
+ character. */
+ if (dl->modeline)
+ *modeline_closest = dl->end_charpos + dl->offset;
+ else
+ *closest = dl->end_charpos + dl->offset;
+
+ if (check_margin_glyphs)
+ get_position_object (dl, obj1, obj2, x_coord,
+ &low_x_coord, &high_x_coord);
+
+ UPDATE_CACHE_RETURN;
+ }
+
+ rb = Dynarr_atp (db->runes, *col);
+
+ if (rb->xpos <= x_coord && x_coord < rb->xpos +
rb->width)
+ {
*charpos = rb->charpos + dl->offset;
low_x_coord = rb->xpos;
@@ -9240,9 +9248,8 @@
UPDATE_CACHE_RETURN;
}
- else if (past_end
- || (rb->type == RUNE_CHAR
- && rb->object.chr.ch == '\n'))
+ else if (rb->type == RUNE_CHAR
+ && rb->object.chr.ch == '\n')
{
(*row)--;
/* At this point we may have glyphs in the right
_______________________________________________
XEmacs-Beta mailing list
XEmacs-Beta(a)xemacs.org
http://lists.xemacs.org/mailman/listinfo/xemacs-beta
Could reproduce the crash, but your patch fails to apply with both
hunks. Have a very recent mercurial version.
--
thomas
_______________________________________________
XEmacs-Beta mailing list
XEmacs-Beta(a)xemacs.org