diff options
author | Eli Zaretskii <eliz@gnu.org> | 2000-12-12 14:55:35 +0000 |
---|---|---|
committer | Eli Zaretskii <eliz@gnu.org> | 2000-12-12 14:55:35 +0000 |
commit | 440ffd67db1ddea96eef52e1cb93ce8fb267f914 (patch) | |
tree | 7025c2955a9a66650e67ce926c3592c971f97f6f | |
parent | 09cefa66eea8ff0dd30ec0258588633866b83b85 (diff) | |
download | emacs-440ffd67db1ddea96eef52e1cb93ce8fb267f914.tar.gz |
(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.
-rw-r--r-- | src/msdos.c | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/src/msdos.c b/src/msdos.c index f26ddd868a3..85ff6dd94a6 100644 --- a/src/msdos.c +++ b/src/msdos.c @@ -1360,6 +1360,11 @@ fast_find_position (struct window *w, int pos, int *hpos, int *vpos) } else if (line_start_position > 0) best_row = row; + + /* Don't overstep the last matrix row, lest we get into the + never-never land... */ + if (row->y + 1 >= yb) + break; ++row; } @@ -1456,7 +1461,7 @@ static void IT_note_mouse_highlight (struct frame *f, int x, int y) { struct display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f); - int portion; + int portion = -1; Lisp_Object window; struct window *w; @@ -1515,16 +1520,22 @@ IT_note_mouse_highlight (struct frame *f, int x, int y) && (XFASTINT (w->last_overlay_modified) == BUF_OVERLAY_MODIFF (XBUFFER (w->buffer)))) { - int pos, i, area; + int pos, i; struct glyph_row *row; struct glyph *glyph; + int nrows = w->current_matrix->nrows; /* Find the glyph under X/Y. */ glyph = NULL; - if (y < w->current_matrix->nrows) + if (y >= 0 && y < nrows) { row = MATRIX_ROW (w->current_matrix, y); - if (row->enabled_p + /* Give up if some row before the one we are looking for is + not enabled. */ + for (i = 0; i <= y; i++) + if (!MATRIX_ROW (w->current_matrix, i)->enabled_p) + break; + if (i > y /* all rows upto and including the one at Y are enabled */ && row->displays_text_p && x < window_box_width (w, TEXT_AREA)) { |