diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 13 | ||||
| -rw-r--r-- | src/xdisp.c | 117 |
2 files changed, 108 insertions, 22 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 9d9002ed77b..0a2af0472a9 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,16 @@ | |||
| 1 | 2012-12-11 Eli Zaretskii <eliz@gnu.org> | ||
| 2 | |||
| 3 | * xdisp.c (handle_face_prop): Fix logic of computing | ||
| 4 | it->start_of_box_run_p. | ||
| 5 | (append_space_for_newline): If the glyph row is R2L, reset the | ||
| 6 | iterator's end_of_box_run_p flag before prepending the space glyph. | ||
| 7 | (extend_face_to_end_of_line): If the glyph row is R2L, reset the | ||
| 8 | iterator's start_of_box_run_p flag before prepending the stretch. | ||
| 9 | (append_glyph, produce_image_glyph, append_composite_glyph) | ||
| 10 | (append_stretch_glyph, append_glyphless_glyph): Reverse the | ||
| 11 | left_box_line_p and right_box_line_p flags of the glyph for R2L | ||
| 12 | glyph rows. (Bug#13011) | ||
| 13 | |||
| 1 | 2012-12-11 Dmitry Antipov <dmantipov@yandex.ru> | 14 | 2012-12-11 Dmitry Antipov <dmantipov@yandex.ru> |
| 2 | 15 | ||
| 3 | * buffer.c (Fset_buffer_multibyte): Do not force redisplay | 16 | * buffer.c (Fset_buffer_multibyte): Do not force redisplay |
diff --git a/src/xdisp.c b/src/xdisp.c index ccd0bb07487..c6f4b440e74 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -3760,18 +3760,26 @@ handle_face_prop (struct it *it) | |||
| 3760 | if (new_face_id != it->face_id) | 3760 | if (new_face_id != it->face_id) |
| 3761 | { | 3761 | { |
| 3762 | struct face *new_face = FACE_FROM_ID (it->f, new_face_id); | 3762 | struct face *new_face = FACE_FROM_ID (it->f, new_face_id); |
| 3763 | /* If it->face_id is -1, old_face below will be NULL, see | ||
| 3764 | the definition of FACE_FROM_ID. This will happen if this | ||
| 3765 | is the initial call that gets the face. */ | ||
| 3766 | struct face *old_face = FACE_FROM_ID (it->f, it->face_id); | ||
| 3763 | 3767 | ||
| 3764 | /* If new face has a box but old face has not, this is | 3768 | /* If the value of face_id of the iterator is -1, we have to |
| 3765 | the start of a run of characters with box, i.e. it has | 3769 | look in front of IT's position and see whether there is a |
| 3766 | a shadow on the left side. The value of face_id of the | 3770 | face there that's different from new_face_id. */ |
| 3767 | iterator will be -1 if this is the initial call that gets | 3771 | if (!old_face && IT_CHARPOS (*it) > BEG) |
| 3768 | the face. In this case, we have to look in front of IT's | 3772 | { |
| 3769 | position and see whether there is a face != new_face_id. */ | 3773 | int prev_face_id = face_before_it_pos (it); |
| 3770 | it->start_of_box_run_p | 3774 | |
| 3771 | = (new_face->box != FACE_NO_BOX | 3775 | old_face = FACE_FROM_ID (it->f, prev_face_id); |
| 3772 | && (it->face_id >= 0 | 3776 | } |
| 3773 | || IT_CHARPOS (*it) == BEG | 3777 | |
| 3774 | || new_face_id != face_before_it_pos (it))); | 3778 | /* If the new face has a box, but the old face does not, |
| 3779 | this is the start of a run of characters with box face, | ||
| 3780 | i.e. this character has a shadow on the left side. */ | ||
| 3781 | it->start_of_box_run_p = (new_face->box != FACE_NO_BOX | ||
| 3782 | && (old_face == NULL || !old_face->box)); | ||
| 3775 | it->face_box_p = new_face->box != FACE_NO_BOX; | 3783 | it->face_box_p = new_face->box != FACE_NO_BOX; |
| 3776 | } | 3784 | } |
| 3777 | } | 3785 | } |
| @@ -18718,6 +18726,7 @@ append_space_for_newline (struct it *it, int default_face_p) | |||
| 18718 | int saved_char_to_display = it->char_to_display; | 18726 | int saved_char_to_display = it->char_to_display; |
| 18719 | int saved_x = it->current_x; | 18727 | int saved_x = it->current_x; |
| 18720 | int saved_face_id = it->face_id; | 18728 | int saved_face_id = it->face_id; |
| 18729 | int saved_box_end = it->end_of_box_run_p; | ||
| 18721 | struct text_pos saved_pos; | 18730 | struct text_pos saved_pos; |
| 18722 | Lisp_Object saved_object; | 18731 | Lisp_Object saved_object; |
| 18723 | struct face *face; | 18732 | struct face *face; |
| @@ -18739,6 +18748,16 @@ append_space_for_newline (struct it *it, int default_face_p) | |||
| 18739 | it->face_id = it->saved_face_id; | 18748 | it->face_id = it->saved_face_id; |
| 18740 | face = FACE_FROM_ID (it->f, it->face_id); | 18749 | face = FACE_FROM_ID (it->f, it->face_id); |
| 18741 | it->face_id = FACE_FOR_CHAR (it->f, face, 0, -1, Qnil); | 18750 | it->face_id = FACE_FOR_CHAR (it->f, face, 0, -1, Qnil); |
| 18751 | /* In R2L rows, we will prepend a stretch glyph that will | ||
| 18752 | have the end_of_box_run_p flag set for it, so there's no | ||
| 18753 | need for the appended newline glyph to have that flag | ||
| 18754 | set. */ | ||
| 18755 | if (it->glyph_row->reversed_p | ||
| 18756 | /* But if the appended newline glyph goes all the way to | ||
| 18757 | the end of the row, there will be no stretch glyph, | ||
| 18758 | so leave the box flag set. */ | ||
| 18759 | && saved_x + FRAME_COLUMN_WIDTH (it->f) < it->last_visible_x) | ||
| 18760 | it->end_of_box_run_p = 0; | ||
| 18742 | 18761 | ||
| 18743 | PRODUCE_GLYPHS (it); | 18762 | PRODUCE_GLYPHS (it); |
| 18744 | 18763 | ||
| @@ -18752,6 +18771,7 @@ append_space_for_newline (struct it *it, int default_face_p) | |||
| 18752 | it->len = saved_len; | 18771 | it->len = saved_len; |
| 18753 | it->c = saved_c; | 18772 | it->c = saved_c; |
| 18754 | it->char_to_display = saved_char_to_display; | 18773 | it->char_to_display = saved_char_to_display; |
| 18774 | it->end_of_box_run_p = saved_box_end; | ||
| 18755 | return 1; | 18775 | return 1; |
| 18756 | } | 18776 | } |
| 18757 | } | 18777 | } |
| @@ -18841,7 +18861,7 @@ extend_face_to_end_of_line (struct it *it) | |||
| 18841 | struct glyph *g; | 18861 | struct glyph *g; |
| 18842 | int row_width, stretch_ascent, stretch_width; | 18862 | int row_width, stretch_ascent, stretch_width; |
| 18843 | struct text_pos saved_pos; | 18863 | struct text_pos saved_pos; |
| 18844 | int saved_face_id, saved_avoid_cursor; | 18864 | int saved_face_id, saved_avoid_cursor, saved_box_start; |
| 18845 | 18865 | ||
| 18846 | for (row_width = 0, g = row_start; g < row_end; g++) | 18866 | for (row_width = 0, g = row_start; g < row_end; g++) |
| 18847 | row_width += g->pixel_width; | 18867 | row_width += g->pixel_width; |
| @@ -18856,6 +18876,7 @@ extend_face_to_end_of_line (struct it *it) | |||
| 18856 | saved_avoid_cursor = it->avoid_cursor_p; | 18876 | saved_avoid_cursor = it->avoid_cursor_p; |
| 18857 | it->avoid_cursor_p = 1; | 18877 | it->avoid_cursor_p = 1; |
| 18858 | saved_face_id = it->face_id; | 18878 | saved_face_id = it->face_id; |
| 18879 | saved_box_start = it->start_of_box_run_p; | ||
| 18859 | /* The last row's stretch glyph should get the default | 18880 | /* The last row's stretch glyph should get the default |
| 18860 | face, to avoid painting the rest of the window with | 18881 | face, to avoid painting the rest of the window with |
| 18861 | the region face, if the region ends at ZV. */ | 18882 | the region face, if the region ends at ZV. */ |
| @@ -18863,11 +18884,13 @@ extend_face_to_end_of_line (struct it *it) | |||
| 18863 | it->face_id = default_face->id; | 18884 | it->face_id = default_face->id; |
| 18864 | else | 18885 | else |
| 18865 | it->face_id = face->id; | 18886 | it->face_id = face->id; |
| 18887 | it->start_of_box_run_p = 0; | ||
| 18866 | append_stretch_glyph (it, make_number (0), stretch_width, | 18888 | append_stretch_glyph (it, make_number (0), stretch_width, |
| 18867 | it->ascent + it->descent, stretch_ascent); | 18889 | it->ascent + it->descent, stretch_ascent); |
| 18868 | it->position = saved_pos; | 18890 | it->position = saved_pos; |
| 18869 | it->avoid_cursor_p = saved_avoid_cursor; | 18891 | it->avoid_cursor_p = saved_avoid_cursor; |
| 18870 | it->face_id = saved_face_id; | 18892 | it->face_id = saved_face_id; |
| 18893 | it->start_of_box_run_p = saved_box_start; | ||
| 18871 | } | 18894 | } |
| 18872 | } | 18895 | } |
| 18873 | #endif /* HAVE_WINDOW_SYSTEM */ | 18896 | #endif /* HAVE_WINDOW_SYSTEM */ |
| @@ -23901,8 +23924,18 @@ append_glyph (struct it *it) | |||
| 23901 | glyph->type = CHAR_GLYPH; | 23924 | glyph->type = CHAR_GLYPH; |
| 23902 | glyph->avoid_cursor_p = it->avoid_cursor_p; | 23925 | glyph->avoid_cursor_p = it->avoid_cursor_p; |
| 23903 | glyph->multibyte_p = it->multibyte_p; | 23926 | glyph->multibyte_p = it->multibyte_p; |
| 23904 | glyph->left_box_line_p = it->start_of_box_run_p; | 23927 | if (it->glyph_row->reversed_p && area == TEXT_AREA) |
| 23905 | glyph->right_box_line_p = it->end_of_box_run_p; | 23928 | { |
| 23929 | /* In R2L rows, the left and the right box edges need to be | ||
| 23930 | drawn in reverse direction. */ | ||
| 23931 | glyph->right_box_line_p = it->start_of_box_run_p; | ||
| 23932 | glyph->left_box_line_p = it->end_of_box_run_p; | ||
| 23933 | } | ||
| 23934 | else | ||
| 23935 | { | ||
| 23936 | glyph->left_box_line_p = it->start_of_box_run_p; | ||
| 23937 | glyph->right_box_line_p = it->end_of_box_run_p; | ||
| 23938 | } | ||
| 23906 | glyph->overlaps_vertically_p = (it->phys_ascent > it->ascent | 23939 | glyph->overlaps_vertically_p = (it->phys_ascent > it->ascent |
| 23907 | || it->phys_descent > it->descent); | 23940 | || it->phys_descent > it->descent); |
| 23908 | glyph->glyph_not_available_p = it->glyph_not_available_p; | 23941 | glyph->glyph_not_available_p = it->glyph_not_available_p; |
| @@ -23976,8 +24009,18 @@ append_composite_glyph (struct it *it) | |||
| 23976 | } | 24009 | } |
| 23977 | glyph->avoid_cursor_p = it->avoid_cursor_p; | 24010 | glyph->avoid_cursor_p = it->avoid_cursor_p; |
| 23978 | glyph->multibyte_p = it->multibyte_p; | 24011 | glyph->multibyte_p = it->multibyte_p; |
| 23979 | glyph->left_box_line_p = it->start_of_box_run_p; | 24012 | if (it->glyph_row->reversed_p && area == TEXT_AREA) |
| 23980 | glyph->right_box_line_p = it->end_of_box_run_p; | 24013 | { |
| 24014 | /* In R2L rows, the left and the right box edges need to be | ||
| 24015 | drawn in reverse direction. */ | ||
| 24016 | glyph->right_box_line_p = it->start_of_box_run_p; | ||
| 24017 | glyph->left_box_line_p = it->end_of_box_run_p; | ||
| 24018 | } | ||
| 24019 | else | ||
| 24020 | { | ||
| 24021 | glyph->left_box_line_p = it->start_of_box_run_p; | ||
| 24022 | glyph->right_box_line_p = it->end_of_box_run_p; | ||
| 24023 | } | ||
| 23981 | glyph->overlaps_vertically_p = (it->phys_ascent > it->ascent | 24024 | glyph->overlaps_vertically_p = (it->phys_ascent > it->ascent |
| 23982 | || it->phys_descent > it->descent); | 24025 | || it->phys_descent > it->descent); |
| 23983 | glyph->padding_p = 0; | 24026 | glyph->padding_p = 0; |
| @@ -24154,8 +24197,18 @@ produce_image_glyph (struct it *it) | |||
| 24154 | glyph->type = IMAGE_GLYPH; | 24197 | glyph->type = IMAGE_GLYPH; |
| 24155 | glyph->avoid_cursor_p = it->avoid_cursor_p; | 24198 | glyph->avoid_cursor_p = it->avoid_cursor_p; |
| 24156 | glyph->multibyte_p = it->multibyte_p; | 24199 | glyph->multibyte_p = it->multibyte_p; |
| 24157 | glyph->left_box_line_p = it->start_of_box_run_p; | 24200 | if (it->glyph_row->reversed_p && area == TEXT_AREA) |
| 24158 | glyph->right_box_line_p = it->end_of_box_run_p; | 24201 | { |
| 24202 | /* In R2L rows, the left and the right box edges need to be | ||
| 24203 | drawn in reverse direction. */ | ||
| 24204 | glyph->right_box_line_p = it->start_of_box_run_p; | ||
| 24205 | glyph->left_box_line_p = it->end_of_box_run_p; | ||
| 24206 | } | ||
| 24207 | else | ||
| 24208 | { | ||
| 24209 | glyph->left_box_line_p = it->start_of_box_run_p; | ||
| 24210 | glyph->right_box_line_p = it->end_of_box_run_p; | ||
| 24211 | } | ||
| 24159 | glyph->overlaps_vertically_p = 0; | 24212 | glyph->overlaps_vertically_p = 0; |
| 24160 | glyph->padding_p = 0; | 24213 | glyph->padding_p = 0; |
| 24161 | glyph->glyph_not_available_p = 0; | 24214 | glyph->glyph_not_available_p = 0; |
| @@ -24297,8 +24350,18 @@ append_stretch_glyph (struct it *it, Lisp_Object object, | |||
| 24297 | glyph->type = STRETCH_GLYPH; | 24350 | glyph->type = STRETCH_GLYPH; |
| 24298 | glyph->avoid_cursor_p = it->avoid_cursor_p; | 24351 | glyph->avoid_cursor_p = it->avoid_cursor_p; |
| 24299 | glyph->multibyte_p = it->multibyte_p; | 24352 | glyph->multibyte_p = it->multibyte_p; |
| 24300 | glyph->left_box_line_p = it->start_of_box_run_p; | 24353 | if (it->glyph_row->reversed_p && area == TEXT_AREA) |
| 24301 | glyph->right_box_line_p = it->end_of_box_run_p; | 24354 | { |
| 24355 | /* In R2L rows, the left and the right box edges need to be | ||
| 24356 | drawn in reverse direction. */ | ||
| 24357 | glyph->right_box_line_p = it->start_of_box_run_p; | ||
| 24358 | glyph->left_box_line_p = it->end_of_box_run_p; | ||
| 24359 | } | ||
| 24360 | else | ||
| 24361 | { | ||
| 24362 | glyph->left_box_line_p = it->start_of_box_run_p; | ||
| 24363 | glyph->right_box_line_p = it->end_of_box_run_p; | ||
| 24364 | } | ||
| 24302 | glyph->overlaps_vertically_p = 0; | 24365 | glyph->overlaps_vertically_p = 0; |
| 24303 | glyph->padding_p = 0; | 24366 | glyph->padding_p = 0; |
| 24304 | glyph->glyph_not_available_p = 0; | 24367 | glyph->glyph_not_available_p = 0; |
| @@ -24750,8 +24813,18 @@ append_glyphless_glyph (struct it *it, int face_id, int for_no_font, int len, | |||
| 24750 | glyph->slice.glyphless.lower_yoff = lower_yoff; | 24813 | glyph->slice.glyphless.lower_yoff = lower_yoff; |
| 24751 | glyph->avoid_cursor_p = it->avoid_cursor_p; | 24814 | glyph->avoid_cursor_p = it->avoid_cursor_p; |
| 24752 | glyph->multibyte_p = it->multibyte_p; | 24815 | glyph->multibyte_p = it->multibyte_p; |
| 24753 | glyph->left_box_line_p = it->start_of_box_run_p; | 24816 | if (it->glyph_row->reversed_p && area == TEXT_AREA) |
| 24754 | glyph->right_box_line_p = it->end_of_box_run_p; | 24817 | { |
| 24818 | /* In R2L rows, the left and the right box edges need to be | ||
| 24819 | drawn in reverse direction. */ | ||
| 24820 | glyph->right_box_line_p = it->start_of_box_run_p; | ||
| 24821 | glyph->left_box_line_p = it->end_of_box_run_p; | ||
| 24822 | } | ||
| 24823 | else | ||
| 24824 | { | ||
| 24825 | glyph->left_box_line_p = it->start_of_box_run_p; | ||
| 24826 | glyph->right_box_line_p = it->end_of_box_run_p; | ||
| 24827 | } | ||
| 24755 | glyph->overlaps_vertically_p = (it->phys_ascent > it->ascent | 24828 | glyph->overlaps_vertically_p = (it->phys_ascent > it->ascent |
| 24756 | || it->phys_descent > it->descent); | 24829 | || it->phys_descent > it->descent); |
| 24757 | glyph->padding_p = 0; | 24830 | glyph->padding_p = 0; |