# HG changeset patch # User Mike Kupfer # Date 1304137847 -32400 # Node ID 58e320bde005995452b464b99c25e96b8b100d78 # Parent 661aba8350af6f26ea2e4d62146851f961ff91d6 Handle redisplay edge case. With motion events when entering a frame and the minibuffer is active, row and column can be zero, and there aren't any runes. diff -r 661aba8350af -r 58e320bde005 src/ChangeLog --- a/src/ChangeLog Sat Apr 30 13:24:10 2011 +0900 +++ b/src/ChangeLog Sat Apr 30 13:30:47 2011 +0900 @@ -1,3 +1,10 @@ +2010-12-31 Mike Kupfer + + * redisplay.c (pixel_to_glyph_translation): + Handle redisplay edge case. + With motion events when entering a frame and the minibuffer is + active, row and column can be zero, and there aren't any runes. + 2011-04-30 Stephen J. Turnbull * specifier.c (Fspecifier_matching_instance): diff -r 661aba8350af -r 58e320bde005 src/redisplay.c --- a/src/redisplay.c Sat Apr 30 13:24:10 2011 +0900 +++ b/src/redisplay.c Sat Apr 30 13:30:47 2011 +0900 @@ -9165,19 +9165,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; @@ -9251,9 +9259,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