diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 17 | ||||
| -rw-r--r-- | src/xdisp.c | 69 |
2 files changed, 81 insertions, 5 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 9245e81a536..7352d8e0081 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,20 @@ | |||
| 1 | 2012-05-13 Eli Zaretskii <eliz@gnu.org> | ||
| 2 | |||
| 3 | * xdisp.c (handle_stop): Don't call get_overlay_strings_1 if we | ||
| 4 | already have overlays loaded. | ||
| 5 | (handle_single_display_spec): Before returning without displaying | ||
| 6 | fringe bitmap, synchronize the bidi iterator with the main display | ||
| 7 | iterator, by calling iterate_out_of_display_property. | ||
| 8 | (iterate_out_of_display_property): Detect buffer iteration by | ||
| 9 | testing that it->string is a Lisp string. | ||
| 10 | (get_next_display_element): When the current object is exhausted, | ||
| 11 | and there's something on it->stack, call set_iterator_to_next to | ||
| 12 | proceed with what's on the stack, instead of returning zero. | ||
| 13 | (set_iterator_to_next): If called at the end of a Lisp string, | ||
| 14 | proceed to consider_string_end without incrementing string | ||
| 15 | position. Don't increment display vector index past the end of | ||
| 16 | the display vector. (Bug#11417) | ||
| 17 | |||
| 1 | 2012-05-11 Eli Zaretskii <eliz@gnu.org> | 18 | 2012-05-11 Eli Zaretskii <eliz@gnu.org> |
| 2 | 19 | ||
| 3 | * xdisp.c (handle_single_display_spec): Return 1 for left-margin | 20 | * xdisp.c (handle_single_display_spec): Return 1 for left-margin |
diff --git a/src/xdisp.c b/src/xdisp.c index fd26853e09b..b1e2a925bce 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -839,6 +839,7 @@ static int try_cursor_movement (Lisp_Object, struct text_pos, int *); | |||
| 839 | static int trailing_whitespace_p (EMACS_INT); | 839 | static int trailing_whitespace_p (EMACS_INT); |
| 840 | static intmax_t message_log_check_duplicate (EMACS_INT, EMACS_INT); | 840 | static intmax_t message_log_check_duplicate (EMACS_INT, EMACS_INT); |
| 841 | static void push_it (struct it *, struct text_pos *); | 841 | static void push_it (struct it *, struct text_pos *); |
| 842 | static void iterate_out_of_display_property (struct it *); | ||
| 842 | static void pop_it (struct it *); | 843 | static void pop_it (struct it *); |
| 843 | static void sync_frame_with_window_matrix_rows (struct window *); | 844 | static void sync_frame_with_window_matrix_rows (struct window *); |
| 844 | static void select_frame_for_redisplay (Lisp_Object); | 845 | static void select_frame_for_redisplay (Lisp_Object); |
| @@ -3125,7 +3126,15 @@ handle_stop (struct it *it) | |||
| 3125 | overlays even if the actual buffer text is replaced. */ | 3126 | overlays even if the actual buffer text is replaced. */ |
| 3126 | if (!handle_overlay_change_p | 3127 | if (!handle_overlay_change_p |
| 3127 | || it->sp > 1 | 3128 | || it->sp > 1 |
| 3128 | || !get_overlay_strings_1 (it, 0, 0)) | 3129 | /* Don't call get_overlay_strings_1 if we already |
| 3130 | have overlay strings loaded, because doing so | ||
| 3131 | will load them again and push the iterator state | ||
| 3132 | onto the stack one more time, which is not | ||
| 3133 | expected by the rest of the code that processes | ||
| 3134 | overlay strings. */ | ||
| 3135 | || (it->n_overlay_strings <= 0 | ||
| 3136 | ? !get_overlay_strings_1 (it, 0, 0) | ||
| 3137 | : 0)) | ||
| 3129 | { | 3138 | { |
| 3130 | if (it->ellipsis_p) | 3139 | if (it->ellipsis_p) |
| 3131 | setup_for_ellipsis (it, 0); | 3140 | setup_for_ellipsis (it, 0); |
| @@ -4681,7 +4690,19 @@ handle_single_display_spec (struct it *it, Lisp_Object spec, Lisp_Object object, | |||
| 4681 | if (!FRAME_WINDOW_P (it->f)) | 4690 | if (!FRAME_WINDOW_P (it->f)) |
| 4682 | /* If we return here, POSITION has been advanced | 4691 | /* If we return here, POSITION has been advanced |
| 4683 | across the text with this property. */ | 4692 | across the text with this property. */ |
| 4684 | return 1; | 4693 | { |
| 4694 | /* Synchronize the bidi iterator with POSITION. This is | ||
| 4695 | needed because we are not going to push the iterator | ||
| 4696 | on behalf of this display property, so there will be | ||
| 4697 | no pop_it call to do this synchronization for us. */ | ||
| 4698 | if (it->bidi_p) | ||
| 4699 | { | ||
| 4700 | it->position = *position; | ||
| 4701 | iterate_out_of_display_property (it); | ||
| 4702 | *position = it->position; | ||
| 4703 | } | ||
| 4704 | return 1; | ||
| 4705 | } | ||
| 4685 | } | 4706 | } |
| 4686 | else if (!frame_window_p) | 4707 | else if (!frame_window_p) |
| 4687 | return 1; | 4708 | return 1; |
| @@ -4692,7 +4713,15 @@ handle_single_display_spec (struct it *it, Lisp_Object spec, Lisp_Object object, | |||
| 4692 | || !(fringe_bitmap = lookup_fringe_bitmap (value))) | 4713 | || !(fringe_bitmap = lookup_fringe_bitmap (value))) |
| 4693 | /* If we return here, POSITION has been advanced | 4714 | /* If we return here, POSITION has been advanced |
| 4694 | across the text with this property. */ | 4715 | across the text with this property. */ |
| 4695 | return 1; | 4716 | { |
| 4717 | if (it && it->bidi_p) | ||
| 4718 | { | ||
| 4719 | it->position = *position; | ||
| 4720 | iterate_out_of_display_property (it); | ||
| 4721 | *position = it->position; | ||
| 4722 | } | ||
| 4723 | return 1; | ||
| 4724 | } | ||
| 4696 | 4725 | ||
| 4697 | if (it) | 4726 | if (it) |
| 4698 | { | 4727 | { |
| @@ -5611,7 +5640,7 @@ push_it (struct it *it, struct text_pos *position) | |||
| 5611 | static void | 5640 | static void |
| 5612 | iterate_out_of_display_property (struct it *it) | 5641 | iterate_out_of_display_property (struct it *it) |
| 5613 | { | 5642 | { |
| 5614 | int buffer_p = BUFFERP (it->object); | 5643 | int buffer_p = !STRINGP (it->string); |
| 5615 | EMACS_INT eob = (buffer_p ? ZV : it->end_charpos); | 5644 | EMACS_INT eob = (buffer_p ? ZV : it->end_charpos); |
| 5616 | EMACS_INT bob = (buffer_p ? BEGV : 0); | 5645 | EMACS_INT bob = (buffer_p ? BEGV : 0); |
| 5617 | 5646 | ||
| @@ -6780,6 +6809,16 @@ get_next_display_element (struct it *it) | |||
| 6780 | && FACE_FROM_ID (it->f, face_id)->box == FACE_NO_BOX); | 6809 | && FACE_FROM_ID (it->f, face_id)->box == FACE_NO_BOX); |
| 6781 | } | 6810 | } |
| 6782 | } | 6811 | } |
| 6812 | /* If we reached the end of the object we've been iterating (e.g., a | ||
| 6813 | display string or an overlay string), and there's something on | ||
| 6814 | IT->stack, proceed with what's on the stack. It doesn't make | ||
| 6815 | sense to return zero if there's unprocessed stuff on the stack, | ||
| 6816 | because otherwise that stuff will never be displayed. */ | ||
| 6817 | if (!success_p && it->sp > 0) | ||
| 6818 | { | ||
| 6819 | set_iterator_to_next (it, 0); | ||
| 6820 | success_p = get_next_display_element (it); | ||
| 6821 | } | ||
| 6783 | 6822 | ||
| 6784 | /* Value is 0 if end of buffer or string reached. */ | 6823 | /* Value is 0 if end of buffer or string reached. */ |
| 6785 | return success_p; | 6824 | return success_p; |
| @@ -6961,7 +7000,7 @@ set_iterator_to_next (struct it *it, int reseat_p) | |||
| 6961 | display vector entry (these entries may contain faces). */ | 7000 | display vector entry (these entries may contain faces). */ |
| 6962 | it->face_id = it->saved_face_id; | 7001 | it->face_id = it->saved_face_id; |
| 6963 | 7002 | ||
| 6964 | if (it->dpvec + it->current.dpvec_index == it->dpend) | 7003 | if (it->dpvec + it->current.dpvec_index >= it->dpend) |
| 6965 | { | 7004 | { |
| 6966 | int recheck_faces = it->ellipsis_p; | 7005 | int recheck_faces = it->ellipsis_p; |
| 6967 | 7006 | ||
| @@ -6999,6 +7038,26 @@ set_iterator_to_next (struct it *it, int reseat_p) | |||
| 6999 | case GET_FROM_STRING: | 7038 | case GET_FROM_STRING: |
| 7000 | /* Current display element is a character from a Lisp string. */ | 7039 | /* Current display element is a character from a Lisp string. */ |
| 7001 | xassert (it->s == NULL && STRINGP (it->string)); | 7040 | xassert (it->s == NULL && STRINGP (it->string)); |
| 7041 | /* Don't advance past string end. These conditions are true | ||
| 7042 | when set_iterator_to_next is called at the end of | ||
| 7043 | get_next_display_element, in which case the Lisp string is | ||
| 7044 | already exhausted, and all we want is pop the iterator | ||
| 7045 | stack. */ | ||
| 7046 | if (it->current.overlay_string_index >= 0) | ||
| 7047 | { | ||
| 7048 | /* This is an overlay string, so there's no padding with | ||
| 7049 | spaces, and the number of characters in the string is | ||
| 7050 | where the string ends. */ | ||
| 7051 | if (IT_STRING_CHARPOS (*it) >= SCHARS (it->string)) | ||
| 7052 | goto consider_string_end; | ||
| 7053 | } | ||
| 7054 | else | ||
| 7055 | { | ||
| 7056 | /* Not an overlay string. There could be padding, so test | ||
| 7057 | against it->end_charpos . */ | ||
| 7058 | if (IT_STRING_CHARPOS (*it) >= it->end_charpos) | ||
| 7059 | goto consider_string_end; | ||
| 7060 | } | ||
| 7002 | if (it->cmp_it.id >= 0) | 7061 | if (it->cmp_it.id >= 0) |
| 7003 | { | 7062 | { |
| 7004 | int i; | 7063 | int i; |