diff options
| author | Eli Zaretskii | 2011-08-25 19:33:16 +0300 |
|---|---|---|
| committer | Eli Zaretskii | 2011-08-25 19:33:16 +0300 |
| commit | fee65a97c0265c8406aa7d8c884beeb5ba712a1e (patch) | |
| tree | b93ac359005e36f7281c5a59bbee498fe8aa668f | |
| parent | 856ce114ff54a5b7801eda7eb771f02b6bb98630 (diff) | |
| download | emacs-fee65a97c0265c8406aa7d8c884beeb5ba712a1e.tar.gz emacs-fee65a97c0265c8406aa7d8c884beeb5ba712a1e.zip | |
Fix cursor motion with long continued lines near window bottom.
src/xdisp.c (try_cursor_movement): Check for the need to scroll more
accurately, and prefer exact match for point under bidi.
| -rw-r--r-- | src/ChangeLog | 2 | ||||
| -rw-r--r-- | src/xdisp.c | 30 |
2 files changed, 27 insertions, 5 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index b2f2334427c..1176c9254ea 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -7,6 +7,8 @@ | |||
| 7 | (handle_single_display_spec): If the display spec is of the form | 7 | (handle_single_display_spec): If the display spec is of the form |
| 8 | `(space ...)', and specifies display in the text area, return 2 | 8 | `(space ...)', and specifies display in the text area, return 2 |
| 9 | rather than 1. | 9 | rather than 1. |
| 10 | (try_cursor_movement): Check for the need to scroll more | ||
| 11 | accurately, and prefer exact match for point under bidi. | ||
| 10 | 12 | ||
| 11 | * dispextern.h (struct bidi_it): Rename the disp_prop_p member | 13 | * dispextern.h (struct bidi_it): Rename the disp_prop_p member |
| 12 | into disp_prop; all users changed. | 14 | into disp_prop; all users changed. |
diff --git a/src/xdisp.c b/src/xdisp.c index 5cbc7747f2f..55bbb7cf62e 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -14593,15 +14593,33 @@ try_cursor_movement (Lisp_Object window, struct text_pos startp, int *scroll_ste | |||
| 14593 | 14593 | ||
| 14594 | do | 14594 | do |
| 14595 | { | 14595 | { |
| 14596 | int at_zv_p = 0, exact_match_p = 0; | ||
| 14597 | |||
| 14596 | if (MATRIX_ROW_START_CHARPOS (row) <= PT | 14598 | if (MATRIX_ROW_START_CHARPOS (row) <= PT |
| 14597 | && PT <= MATRIX_ROW_END_CHARPOS (row) | 14599 | && PT <= MATRIX_ROW_END_CHARPOS (row) |
| 14598 | && cursor_row_p (row)) | 14600 | && cursor_row_p (row)) |
| 14599 | rv |= set_cursor_from_row (w, row, w->current_matrix, | 14601 | rv |= set_cursor_from_row (w, row, w->current_matrix, |
| 14600 | 0, 0, 0, 0); | 14602 | 0, 0, 0, 0); |
| 14601 | /* As soon as we've found the first suitable row | 14603 | /* As soon as we've found the exact match for point, |
| 14602 | whose ends_at_zv_p flag is set, we are done. */ | 14604 | or the first suitable row whose ends_at_zv_p flag |
| 14603 | if (rv | 14605 | is set, we are done. */ |
| 14604 | && MATRIX_ROW (w->current_matrix, w->cursor.vpos)->ends_at_zv_p) | 14606 | at_zv_p = |
| 14607 | MATRIX_ROW (w->current_matrix, w->cursor.vpos)->ends_at_zv_p; | ||
| 14608 | if (!at_zv_p) | ||
| 14609 | { | ||
| 14610 | struct glyph_row *candidate = | ||
| 14611 | MATRIX_ROW (w->current_matrix, w->cursor.vpos); | ||
| 14612 | struct glyph *g = | ||
| 14613 | candidate->glyphs[TEXT_AREA] + w->cursor.hpos; | ||
| 14614 | EMACS_INT endpos = MATRIX_ROW_END_CHARPOS (candidate); | ||
| 14615 | |||
| 14616 | exact_match_p = | ||
| 14617 | (BUFFERP (g->object) && g->charpos == PT) | ||
| 14618 | || (INTEGERP (g->object) | ||
| 14619 | && (g->charpos == PT | ||
| 14620 | || (g->charpos == 0 && endpos - 1 == PT))); | ||
| 14621 | } | ||
| 14622 | if (rv && (at_zv_p || exact_match_p)) | ||
| 14605 | { | 14623 | { |
| 14606 | rc = CURSOR_MOVEMENT_SUCCESS; | 14624 | rc = CURSOR_MOVEMENT_SUCCESS; |
| 14607 | break; | 14625 | break; |
| @@ -14617,7 +14635,9 @@ try_cursor_movement (Lisp_Object window, struct text_pos startp, int *scroll_ste | |||
| 14617 | loop before all the candidates were examined, signal | 14635 | loop before all the candidates were examined, signal |
| 14618 | to the caller that this method failed. */ | 14636 | to the caller that this method failed. */ |
| 14619 | if (rc != CURSOR_MOVEMENT_SUCCESS | 14637 | if (rc != CURSOR_MOVEMENT_SUCCESS |
| 14620 | && (!rv || MATRIX_ROW_CONTINUATION_LINE_P (row))) | 14638 | && !(rv |
| 14639 | && !MATRIX_ROW_CONTINUATION_LINE_P (row) | ||
| 14640 | && !row->continued_p)) | ||
| 14621 | rc = CURSOR_MOVEMENT_MUST_SCROLL; | 14641 | rc = CURSOR_MOVEMENT_MUST_SCROLL; |
| 14622 | else if (rv) | 14642 | else if (rv) |
| 14623 | rc = CURSOR_MOVEMENT_SUCCESS; | 14643 | rc = CURSOR_MOVEMENT_SUCCESS; |