comparison src/redisplay.c @ 5486:58e320bde005

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.
author Mike Kupfer <mike.kupfer@xemacs.org>
date Sat, 30 Apr 2011 13:30:47 +0900
parents 0af042a0c116
children 56144c8593a8
comparison
equal deleted inserted replaced
5485:661aba8350af 5486:58e320bde005
9163 UPDATE_CACHE_RETURN; 9163 UPDATE_CACHE_RETURN;
9164 } 9164 }
9165 9165
9166 for (*col = 0; *col <= Dynarr_length (db->runes); (*col)++) 9166 for (*col = 0; *col <= Dynarr_length (db->runes); (*col)++)
9167 { 9167 {
9168 int past_end = (*col == Dynarr_length (db->runes)); 9168 if (*col == Dynarr_length (db->runes))
9169
9170 if (!past_end)
9171 rb = Dynarr_atp (db->runes, *col);
9172
9173 if (past_end ||
9174 (rb->xpos <= x_coord && x_coord < rb->xpos + rb->width))
9175 { 9169 {
9176 if (past_end) 9170 /* We've run out of runes to look at. Treat the same as
9177 { 9171 the case below where we failed to find a non-glyph
9178 (*col)--; 9172 character. */
9179 rb = Dynarr_atp (db->runes, *col); 9173 if (dl->modeline)
9180 } 9174 *modeline_closest = dl->end_charpos + dl->offset;
9175 else
9176 *closest = dl->end_charpos + dl->offset;
9177
9178 if (check_margin_glyphs)
9179 get_position_object (dl, obj1, obj2, x_coord,
9180 &low_x_coord, &high_x_coord);
9181
9182 UPDATE_CACHE_RETURN;
9183 }
9184
9185 rb = Dynarr_atp (db->runes, *col);
9186
9187 if (rb->xpos <= x_coord && x_coord < rb->xpos + rb->width)
9188 {
9181 9189
9182 *charpos = rb->charpos + dl->offset; 9190 *charpos = rb->charpos + dl->offset;
9183 low_x_coord = rb->xpos; 9191 low_x_coord = rb->xpos;
9184 high_x_coord = rb->xpos + rb->width; 9192 high_x_coord = rb->xpos + rb->width;
9185 9193
9249 *obj2 = Qnil; 9257 *obj2 = Qnil;
9250 } 9258 }
9251 9259
9252 UPDATE_CACHE_RETURN; 9260 UPDATE_CACHE_RETURN;
9253 } 9261 }
9254 else if (past_end 9262 else if (rb->type == RUNE_CHAR
9255 || (rb->type == RUNE_CHAR 9263 && rb->object.chr.ch == '\n')
9256 && rb->object.chr.ch == '\n'))
9257 { 9264 {
9258 (*row)--; 9265 (*row)--;
9259 /* At this point we may have glyphs in the right 9266 /* At this point we may have glyphs in the right
9260 inside margin. */ 9267 inside margin. */
9261 if (check_margin_glyphs) 9268 if (check_margin_glyphs)