Mercurial > emacs
comparison src/msdos.c @ 34483:eccf7d43bead
(fast_find_position): Don't overstep the last window row.
(IT_note_mouse_highlight): Initialize portion to -1. Remove
unused variable `area'. When looking for a row under (X,Y), give
up if some of the previous rows is not enabled.
author | Eli Zaretskii <eliz@gnu.org> |
---|---|
date | Tue, 12 Dec 2000 14:55:35 +0000 |
parents | 5d98418d7b78 |
children | 62530d6f561d |
comparison
equal
deleted
inserted
replaced
34482:0238666bb0bc | 34483:eccf7d43bead |
---|---|
1358 maybe_next_line_p = 1; | 1358 maybe_next_line_p = 1; |
1359 break; | 1359 break; |
1360 } | 1360 } |
1361 else if (line_start_position > 0) | 1361 else if (line_start_position > 0) |
1362 best_row = row; | 1362 best_row = row; |
1363 | |
1364 /* Don't overstep the last matrix row, lest we get into the | |
1365 never-never land... */ | |
1366 if (row->y + 1 >= yb) | |
1367 break; | |
1363 | 1368 |
1364 ++row; | 1369 ++row; |
1365 } | 1370 } |
1366 | 1371 |
1367 /* Find the right column within BEST_ROW. */ | 1372 /* Find the right column within BEST_ROW. */ |
1454 X and Y can be negative or out of range. */ | 1459 X and Y can be negative or out of range. */ |
1455 static void | 1460 static void |
1456 IT_note_mouse_highlight (struct frame *f, int x, int y) | 1461 IT_note_mouse_highlight (struct frame *f, int x, int y) |
1457 { | 1462 { |
1458 struct display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f); | 1463 struct display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f); |
1459 int portion; | 1464 int portion = -1; |
1460 Lisp_Object window; | 1465 Lisp_Object window; |
1461 struct window *w; | 1466 struct window *w; |
1462 | 1467 |
1463 /* When a menu is active, don't highlight because this looks odd. */ | 1468 /* When a menu is active, don't highlight because this looks odd. */ |
1464 if (mouse_preempted) | 1469 if (mouse_preempted) |
1513 && EQ (w->window_end_valid, w->buffer) | 1518 && EQ (w->window_end_valid, w->buffer) |
1514 && XFASTINT (w->last_modified) == BUF_MODIFF (XBUFFER (w->buffer)) | 1519 && XFASTINT (w->last_modified) == BUF_MODIFF (XBUFFER (w->buffer)) |
1515 && (XFASTINT (w->last_overlay_modified) | 1520 && (XFASTINT (w->last_overlay_modified) |
1516 == BUF_OVERLAY_MODIFF (XBUFFER (w->buffer)))) | 1521 == BUF_OVERLAY_MODIFF (XBUFFER (w->buffer)))) |
1517 { | 1522 { |
1518 int pos, i, area; | 1523 int pos, i; |
1519 struct glyph_row *row; | 1524 struct glyph_row *row; |
1520 struct glyph *glyph; | 1525 struct glyph *glyph; |
1526 int nrows = w->current_matrix->nrows; | |
1521 | 1527 |
1522 /* Find the glyph under X/Y. */ | 1528 /* Find the glyph under X/Y. */ |
1523 glyph = NULL; | 1529 glyph = NULL; |
1524 if (y < w->current_matrix->nrows) | 1530 if (y >= 0 && y < nrows) |
1525 { | 1531 { |
1526 row = MATRIX_ROW (w->current_matrix, y); | 1532 row = MATRIX_ROW (w->current_matrix, y); |
1527 if (row->enabled_p | 1533 /* Give up if some row before the one we are looking for is |
1534 not enabled. */ | |
1535 for (i = 0; i <= y; i++) | |
1536 if (!MATRIX_ROW (w->current_matrix, i)->enabled_p) | |
1537 break; | |
1538 if (i > y /* all rows upto and including the one at Y are enabled */ | |
1528 && row->displays_text_p | 1539 && row->displays_text_p |
1529 && x < window_box_width (w, TEXT_AREA)) | 1540 && x < window_box_width (w, TEXT_AREA)) |
1530 { | 1541 { |
1531 glyph = row->glyphs[TEXT_AREA]; | 1542 glyph = row->glyphs[TEXT_AREA]; |
1532 if (x >= row->used[TEXT_AREA]) | 1543 if (x >= row->used[TEXT_AREA]) |