diff options
| author | Kim F. Storm | 2006-05-28 20:19:07 +0000 |
|---|---|---|
| committer | Kim F. Storm | 2006-05-28 20:19:07 +0000 |
| commit | a4f3f618ebf3f27c79ddce6e28fca7a04eae1616 (patch) | |
| tree | 30891fe915a1b8b8fa3b1fd9af75e565722a421a | |
| parent | 794033ae3c7e6a9c3d3e822a22dd5ea62d5c034b (diff) | |
| download | emacs-a4f3f618ebf3f27c79ddce6e28fca7a04eae1616.tar.gz emacs-a4f3f618ebf3f27c79ddce6e28fca7a04eae1616.zip | |
(set_cursor_from_row): If cursor cannot be set in row,
don't update w->cursor and return 0. Return 1 on success.
(try_cursor_movement): Repeat set_cursor_from_row on successive rows
until it succeeds.
| -rw-r--r-- | src/xdisp.c | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/src/xdisp.c b/src/xdisp.c index 6ebc64bf9f5..aa0625532ab 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -11620,9 +11620,11 @@ redisplay_window_1 (window) | |||
| 11620 | 11620 | ||
| 11621 | /* Set cursor position of W. PT is assumed to be displayed in ROW. | 11621 | /* Set cursor position of W. PT is assumed to be displayed in ROW. |
| 11622 | DELTA is the number of bytes by which positions recorded in ROW | 11622 | DELTA is the number of bytes by which positions recorded in ROW |
| 11623 | differ from current buffer positions. */ | 11623 | differ from current buffer positions. |
| 11624 | 11624 | ||
| 11625 | void | 11625 | Return 0 if cursor is not on this row. 1 otherwise. */ |
| 11626 | |||
| 11627 | int | ||
| 11626 | set_cursor_from_row (w, row, matrix, delta, delta_bytes, dy, dvpos) | 11628 | set_cursor_from_row (w, row, matrix, delta, delta_bytes, dy, dvpos) |
| 11627 | struct window *w; | 11629 | struct window *w; |
| 11628 | struct glyph_row *row; | 11630 | struct glyph_row *row; |
| @@ -11772,6 +11774,11 @@ set_cursor_from_row (w, row, matrix, delta, delta_bytes, dy, dvpos) | |||
| 11772 | SKIP_GLYPHS (glyph, end, x, EQ (glyph->object, string)); | 11774 | SKIP_GLYPHS (glyph, end, x, EQ (glyph->object, string)); |
| 11773 | } | 11775 | } |
| 11774 | } | 11776 | } |
| 11777 | |||
| 11778 | /* If we reached the end of the line, and end was from a string, | ||
| 11779 | cursor is not on this line. */ | ||
| 11780 | if (glyph == end) | ||
| 11781 | return 0; | ||
| 11775 | } | 11782 | } |
| 11776 | 11783 | ||
| 11777 | w->cursor.hpos = glyph - row->glyphs[TEXT_AREA]; | 11784 | w->cursor.hpos = glyph - row->glyphs[TEXT_AREA]; |
| @@ -11805,6 +11812,8 @@ set_cursor_from_row (w, row, matrix, delta, delta_bytes, dy, dvpos) | |||
| 11805 | else | 11812 | else |
| 11806 | CHARPOS (this_line_start_pos) = 0; | 11813 | CHARPOS (this_line_start_pos) = 0; |
| 11807 | } | 11814 | } |
| 11815 | |||
| 11816 | return 1; | ||
| 11808 | } | 11817 | } |
| 11809 | 11818 | ||
| 11810 | 11819 | ||
| @@ -12488,8 +12497,18 @@ try_cursor_movement (window, startp, scroll_step) | |||
| 12488 | rc = CURSOR_MOVEMENT_MUST_SCROLL; | 12497 | rc = CURSOR_MOVEMENT_MUST_SCROLL; |
| 12489 | else | 12498 | else |
| 12490 | { | 12499 | { |
| 12491 | set_cursor_from_row (w, row, w->current_matrix, 0, 0, 0, 0); | 12500 | do |
| 12492 | rc = CURSOR_MOVEMENT_SUCCESS; | 12501 | { |
| 12502 | if (set_cursor_from_row (w, row, w->current_matrix, 0, 0, 0, 0)) | ||
| 12503 | { | ||
| 12504 | rc = CURSOR_MOVEMENT_SUCCESS; | ||
| 12505 | break; | ||
| 12506 | } | ||
| 12507 | ++row; | ||
| 12508 | } | ||
| 12509 | while (MATRIX_ROW_BOTTOM_Y (row) < last_y | ||
| 12510 | && MATRIX_ROW_START_CHARPOS (row) == PT | ||
| 12511 | && cursor_row_p (w, row)); | ||
| 12493 | } | 12512 | } |
| 12494 | } | 12513 | } |
| 12495 | } | 12514 | } |