diff options
| author | Kim F. Storm | 2004-07-26 23:16:48 +0000 |
|---|---|---|
| committer | Kim F. Storm | 2004-07-26 23:16:48 +0000 |
| commit | 3553184981479cadb0af5e64f55f7ebe00415f25 (patch) | |
| tree | 7fac8f2251650885fc85ce22adde03a42f2d2598 /src | |
| parent | 3f911c94a230f144e410d790892acfab5bc2d757 (diff) | |
| download | emacs-3553184981479cadb0af5e64f55f7ebe00415f25.tar.gz emacs-3553184981479cadb0af5e64f55f7ebe00415f25.zip | |
(move_it_in_display_line_to): Check BUFFER_POS_REACHED_P after
we have ensured that the glyph fits on the current line (or returned
MOVE_LINE_CONTINUED otherwise).
Diffstat (limited to 'src')
| -rw-r--r-- | src/xdisp.c | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/src/xdisp.c b/src/xdisp.c index 071e85ae29d..7a727938a2c 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -5649,9 +5649,13 @@ move_it_in_display_line_to (it, to_charpos, to_x, op) | |||
| 5649 | { | 5649 | { |
| 5650 | int x, i, ascent = 0, descent = 0; | 5650 | int x, i, ascent = 0, descent = 0; |
| 5651 | 5651 | ||
| 5652 | /* Stop when ZV or TO_CHARPOS reached. */ | 5652 | /* Stop when ZV reached. |
| 5653 | We used to stop here when TO_CHARPOS reached as well, but that is | ||
| 5654 | too soon if this glyph does not fit on this line. So we handle it | ||
| 5655 | explicitly below. */ | ||
| 5653 | if (!get_next_display_element (it) | 5656 | if (!get_next_display_element (it) |
| 5654 | || BUFFER_POS_REACHED_P ()) | 5657 | || (it->truncate_lines_p |
| 5658 | && BUFFER_POS_REACHED_P ())) | ||
| 5655 | { | 5659 | { |
| 5656 | result = MOVE_POS_MATCH_OR_ZV; | 5660 | result = MOVE_POS_MATCH_OR_ZV; |
| 5657 | break; | 5661 | break; |
| @@ -5711,6 +5715,8 @@ move_it_in_display_line_to (it, to_charpos, to_x, op) | |||
| 5711 | /* We want to leave anything reaching TO_X to the caller. */ | 5715 | /* We want to leave anything reaching TO_X to the caller. */ |
| 5712 | if ((op & MOVE_TO_X) && new_x > to_x) | 5716 | if ((op & MOVE_TO_X) && new_x > to_x) |
| 5713 | { | 5717 | { |
| 5718 | if (BUFFER_POS_REACHED_P ()) | ||
| 5719 | goto buffer_pos_reached; | ||
| 5714 | it->current_x = x; | 5720 | it->current_x = x; |
| 5715 | result = MOVE_X_REACHED; | 5721 | result = MOVE_X_REACHED; |
| 5716 | break; | 5722 | break; |
| @@ -5772,6 +5778,8 @@ move_it_in_display_line_to (it, to_charpos, to_x, op) | |||
| 5772 | result = MOVE_LINE_CONTINUED; | 5778 | result = MOVE_LINE_CONTINUED; |
| 5773 | break; | 5779 | break; |
| 5774 | } | 5780 | } |
| 5781 | else if (BUFFER_POS_REACHED_P ()) | ||
| 5782 | goto buffer_pos_reached; | ||
| 5775 | else if (new_x > it->first_visible_x) | 5783 | else if (new_x > it->first_visible_x) |
| 5776 | { | 5784 | { |
| 5777 | /* Glyph is visible. Increment number of glyphs that | 5785 | /* Glyph is visible. Increment number of glyphs that |
| @@ -5788,6 +5796,15 @@ move_it_in_display_line_to (it, to_charpos, to_x, op) | |||
| 5788 | if (result != MOVE_UNDEFINED) | 5796 | if (result != MOVE_UNDEFINED) |
| 5789 | break; | 5797 | break; |
| 5790 | } | 5798 | } |
| 5799 | else if (BUFFER_POS_REACHED_P ()) | ||
| 5800 | { | ||
| 5801 | buffer_pos_reached: | ||
| 5802 | it->current_x = x; | ||
| 5803 | it->max_ascent = ascent; | ||
| 5804 | it->max_descent = descent; | ||
| 5805 | result = MOVE_POS_MATCH_OR_ZV; | ||
| 5806 | break; | ||
| 5807 | } | ||
| 5791 | else if ((op & MOVE_TO_X) && it->current_x >= to_x) | 5808 | else if ((op & MOVE_TO_X) && it->current_x >= to_x) |
| 5792 | { | 5809 | { |
| 5793 | /* Stop when TO_X specified and reached. This check is | 5810 | /* Stop when TO_X specified and reached. This check is |