diff options
| author | Richard M. Stallman | 2002-12-09 01:56:05 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 2002-12-09 01:56:05 +0000 |
| commit | 5cce13ddd745a4952bf1cdcab348c8db69482ecc (patch) | |
| tree | d41d7693fa67723fa774bd4b83e9553378a14bd9 | |
| parent | eca79530b77b2003fd939e4f5bdf576f1c8ed0fa (diff) | |
| download | emacs-5cce13ddd745a4952bf1cdcab348c8db69482ecc.tar.gz emacs-5cce13ddd745a4952bf1cdcab348c8db69482ecc.zip | |
(row_containing_pos): Check more carefully
whether charpos is really in the row before returning it.
| -rw-r--r-- | src/xdisp.c | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/src/xdisp.c b/src/xdisp.c index 38df34d7c53..bfe9d4f9637 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -11509,25 +11509,27 @@ row_containing_pos (w, charpos, start, end, dy) | |||
| 11509 | 11509 | ||
| 11510 | last_y = window_text_bottom_y (w) - dy; | 11510 | last_y = window_text_bottom_y (w) - dy; |
| 11511 | 11511 | ||
| 11512 | while ((end == NULL || row < end) | 11512 | while (1) |
| 11513 | && MATRIX_ROW_BOTTOM_Y (row) < last_y | 11513 | { |
| 11514 | && (MATRIX_ROW_END_CHARPOS (row) < charpos | 11514 | /* Give up if we have gone too far. */ |
| 11515 | if (end && row >= end) | ||
| 11516 | return NULL; | ||
| 11517 | if (MATRIX_ROW_BOTTOM_Y (row) >= last_y) | ||
| 11518 | return NULL; | ||
| 11519 | |||
| 11520 | /* If it is in this row, return this row. */ | ||
| 11521 | if (! (MATRIX_ROW_END_CHARPOS (row) < charpos | ||
| 11515 | || (MATRIX_ROW_END_CHARPOS (row) == charpos | 11522 | || (MATRIX_ROW_END_CHARPOS (row) == charpos |
| 11516 | /* The end position of a row equals the start | 11523 | /* The end position of a row equals the start |
| 11517 | position of the next row. If CHARPOS is there, we | 11524 | position of the next row. If CHARPOS is there, we |
| 11518 | would rather display it in the next line, except | 11525 | would rather display it in the next line, except |
| 11519 | when this line ends in ZV. */ | 11526 | when this line ends in ZV. */ |
| 11520 | && !row->ends_at_zv_p | 11527 | && !row->ends_at_zv_p |
| 11521 | && !MATRIX_ROW_ENDS_IN_MIDDLE_OF_CHAR_P (row)))) | 11528 | && !MATRIX_ROW_ENDS_IN_MIDDLE_OF_CHAR_P (row))) |
| 11522 | ++row; | 11529 | && charpos >= MATRIX_ROW_START_CHARPOS (row)) |
| 11523 | 11530 | return row; | |
| 11524 | /* Give up if CHARPOS not found. */ | 11531 | ++row; |
| 11525 | if ((end && row >= end) | 11532 | } |
| 11526 | || charpos < MATRIX_ROW_START_CHARPOS (row) | ||
| 11527 | || charpos > MATRIX_ROW_END_CHARPOS (row)) | ||
| 11528 | row = NULL; | ||
| 11529 | |||
| 11530 | return row; | ||
| 11531 | } | 11533 | } |
| 11532 | 11534 | ||
| 11533 | 11535 | ||