diff options
| author | Kim F. Storm | 2006-07-17 14:25:05 +0000 |
|---|---|---|
| committer | Kim F. Storm | 2006-07-17 14:25:05 +0000 |
| commit | 062e20358f97d3b5f7b097ad9c05de75a418ca2e (patch) | |
| tree | 0dcfde6f219db2c2ed189a4f3204ec3ecd8f5715 /src | |
| parent | 55dc982c6cf980690aa1c26d2add91664c76db93 (diff) | |
| download | emacs-062e20358f97d3b5f7b097ad9c05de75a418ca2e.tar.gz emacs-062e20358f97d3b5f7b097ad9c05de75a418ca2e.zip | |
(handle_single_display_spec): Ensure the right value of
it->position is saved by push_it.
(pop_it): Restore it->object for GET_FROM_BUFFER and GET_FROM_STRING.
(reseat_1): Don't setup it->object twice.
(set_iterator_to_next): No need to set it->object after pop_it.
(move_it_to): Explicitly check to see if last move reached to_charpos.
Diffstat (limited to 'src')
| -rw-r--r-- | src/xdisp.c | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/src/xdisp.c b/src/xdisp.c index 9c6c18df435..22be60f7eb8 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -3880,7 +3880,7 @@ handle_single_display_spec (it, spec, object, position, | |||
| 3880 | { | 3880 | { |
| 3881 | Lisp_Object form; | 3881 | Lisp_Object form; |
| 3882 | Lisp_Object location, value; | 3882 | Lisp_Object location, value; |
| 3883 | struct text_pos start_pos; | 3883 | struct text_pos start_pos, save_pos; |
| 3884 | int valid_p; | 3884 | int valid_p; |
| 3885 | 3885 | ||
| 3886 | /* If SPEC is a list of the form `(when FORM . VALUE)', evaluate FORM. | 3886 | /* If SPEC is a list of the form `(when FORM . VALUE)', evaluate FORM. |
| @@ -4097,7 +4097,10 @@ handle_single_display_spec (it, spec, object, position, | |||
| 4097 | /* Save current settings of IT so that we can restore them | 4097 | /* Save current settings of IT so that we can restore them |
| 4098 | when we are finished with the glyph property value. */ | 4098 | when we are finished with the glyph property value. */ |
| 4099 | 4099 | ||
| 4100 | save_pos = it->position; | ||
| 4101 | it->position = *position; | ||
| 4100 | push_it (it); | 4102 | push_it (it); |
| 4103 | it->position = save_pos; | ||
| 4101 | 4104 | ||
| 4102 | it->area = TEXT_AREA; | 4105 | it->area = TEXT_AREA; |
| 4103 | it->what = IT_IMAGE; | 4106 | it->what = IT_IMAGE; |
| @@ -4171,7 +4174,10 @@ handle_single_display_spec (it, spec, object, position, | |||
| 4171 | { | 4174 | { |
| 4172 | /* Save current settings of IT so that we can restore them | 4175 | /* Save current settings of IT so that we can restore them |
| 4173 | when we are finished with the glyph property value. */ | 4176 | when we are finished with the glyph property value. */ |
| 4177 | save_pos = it->position; | ||
| 4178 | it->position = *position; | ||
| 4174 | push_it (it); | 4179 | push_it (it); |
| 4180 | it->position = save_pos; | ||
| 4175 | 4181 | ||
| 4176 | if (NILP (location)) | 4182 | if (NILP (location)) |
| 4177 | it->area = TEXT_AREA; | 4183 | it->area = TEXT_AREA; |
| @@ -4983,6 +4989,12 @@ pop_it (it) | |||
| 4983 | case GET_FROM_STRETCH: | 4989 | case GET_FROM_STRETCH: |
| 4984 | it->object = p->u.comp.object; | 4990 | it->object = p->u.comp.object; |
| 4985 | break; | 4991 | break; |
| 4992 | case GET_FROM_BUFFER: | ||
| 4993 | it->object = it->w->buffer; | ||
| 4994 | break; | ||
| 4995 | case GET_FROM_STRING: | ||
| 4996 | it->object = it->string; | ||
| 4997 | break; | ||
| 4986 | } | 4998 | } |
| 4987 | it->end_charpos = p->end_charpos; | 4999 | it->end_charpos = p->end_charpos; |
| 4988 | it->string_nchars = p->string_nchars; | 5000 | it->string_nchars = p->string_nchars; |
| @@ -5302,7 +5314,6 @@ reseat_1 (it, pos, set_stop_p) | |||
| 5302 | xassert (CHARPOS (pos) >= BEGV && CHARPOS (pos) <= ZV); | 5314 | xassert (CHARPOS (pos) >= BEGV && CHARPOS (pos) <= ZV); |
| 5303 | 5315 | ||
| 5304 | it->current.pos = it->position = pos; | 5316 | it->current.pos = it->position = pos; |
| 5305 | XSETBUFFER (it->object, current_buffer); | ||
| 5306 | it->end_charpos = ZV; | 5317 | it->end_charpos = ZV; |
| 5307 | it->dpvec = NULL; | 5318 | it->dpvec = NULL; |
| 5308 | it->current.dpvec_index = -1; | 5319 | it->current.dpvec_index = -1; |
| @@ -5800,14 +5811,12 @@ set_iterator_to_next (it, reseat_p) | |||
| 5800 | { | 5811 | { |
| 5801 | IT_STRING_BYTEPOS (*it) += it->len; | 5812 | IT_STRING_BYTEPOS (*it) += it->len; |
| 5802 | IT_STRING_CHARPOS (*it) += it->cmp_len; | 5813 | IT_STRING_CHARPOS (*it) += it->cmp_len; |
| 5803 | it->object = it->string; | ||
| 5804 | goto consider_string_end; | 5814 | goto consider_string_end; |
| 5805 | } | 5815 | } |
| 5806 | else if (it->method == GET_FROM_BUFFER) | 5816 | else if (it->method == GET_FROM_BUFFER) |
| 5807 | { | 5817 | { |
| 5808 | IT_BYTEPOS (*it) += it->len; | 5818 | IT_BYTEPOS (*it) += it->len; |
| 5809 | IT_CHARPOS (*it) += it->cmp_len; | 5819 | IT_CHARPOS (*it) += it->cmp_len; |
| 5810 | it->object = it->w->buffer; | ||
| 5811 | } | 5820 | } |
| 5812 | break; | 5821 | break; |
| 5813 | 5822 | ||
| @@ -6047,9 +6056,7 @@ next_element_from_string (it) | |||
| 6047 | } | 6056 | } |
| 6048 | } | 6057 | } |
| 6049 | 6058 | ||
| 6050 | /* Record what we have and where it came from. Note that we store a | 6059 | /* Record what we have and where it came from. */ |
| 6051 | buffer position in IT->position although it could arguably be a | ||
| 6052 | string position. */ | ||
| 6053 | it->what = IT_CHARACTER; | 6060 | it->what = IT_CHARACTER; |
| 6054 | it->object = it->string; | 6061 | it->object = it->string; |
| 6055 | it->position = position; | 6062 | it->position = position; |
| @@ -6764,6 +6771,10 @@ move_it_to (it, to_charpos, to_x, to_y, to_vpos, op) | |||
| 6764 | if (reached) | 6771 | if (reached) |
| 6765 | break; | 6772 | break; |
| 6766 | } | 6773 | } |
| 6774 | else if (BUFFERP (it->object) | ||
| 6775 | && it->method == GET_FROM_BUFFER | ||
| 6776 | && IT_CHARPOS (*it) >= to_charpos) | ||
| 6777 | skip = MOVE_POS_MATCH_OR_ZV; | ||
| 6767 | else | 6778 | else |
| 6768 | skip = move_it_in_display_line_to (it, to_charpos, -1, MOVE_TO_POS); | 6779 | skip = move_it_in_display_line_to (it, to_charpos, -1, MOVE_TO_POS); |
| 6769 | 6780 | ||