diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 9 | ||||
| -rw-r--r-- | src/xdisp.c | 68 |
2 files changed, 51 insertions, 26 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 3d4e320b5fb..44772144feb 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,12 @@ | |||
| 1 | 2004-04-25 Kim F. Storm <storm@cua.dk> | ||
| 2 | |||
| 3 | * xdisp.c (append_space_for_newline): Rename from append_space. | ||
| 4 | Remove DEFAULT_FACE_P arg; always use current face. Callers changed. | ||
| 5 | (x_produce_glyphs): Handle line-spacing property on newline char. | ||
| 6 | If value is t, adjust ascent and descent to fit current row height. | ||
| 7 | If value is an integer or float, set extra_line_spacing to integer | ||
| 8 | value, or to float value x current line height. | ||
| 9 | |||
| 1 | 2004-04-23 Kenichi Handa <handa@m17n.org> | 10 | 2004-04-23 Kenichi Handa <handa@m17n.org> |
| 2 | 11 | ||
| 3 | * fontset.c (Finternal_char_font): If POSITION is nil, return | 12 | * fontset.c (Finternal_char_font): If POSITION is nil, return |
diff --git a/src/xdisp.c b/src/xdisp.c index f51727d34db..e8c403d8046 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -850,7 +850,7 @@ static void insert_left_trunc_glyphs P_ ((struct it *)); | |||
| 850 | static struct glyph_row *get_overlay_arrow_glyph_row P_ ((struct window *, | 850 | static struct glyph_row *get_overlay_arrow_glyph_row P_ ((struct window *, |
| 851 | Lisp_Object)); | 851 | Lisp_Object)); |
| 852 | static void extend_face_to_end_of_line P_ ((struct it *)); | 852 | static void extend_face_to_end_of_line P_ ((struct it *)); |
| 853 | static int append_space P_ ((struct it *, int)); | 853 | static int append_space_for_newline P_ ((struct it *)); |
| 854 | static int make_cursor_line_fully_visible P_ ((struct window *, int)); | 854 | static int make_cursor_line_fully_visible P_ ((struct window *, int)); |
| 855 | static int try_scrolling P_ ((Lisp_Object, int, EMACS_INT, EMACS_INT, int, int)); | 855 | static int try_scrolling P_ ((Lisp_Object, int, EMACS_INT, EMACS_INT, int, int)); |
| 856 | static int try_cursor_movement P_ ((Lisp_Object, struct text_pos, int *)); | 856 | static int try_cursor_movement P_ ((Lisp_Object, struct text_pos, int *)); |
| @@ -14145,8 +14145,7 @@ compute_line_metrics (it) | |||
| 14145 | 14145 | ||
| 14146 | 14146 | ||
| 14147 | /* Append one space to the glyph row of iterator IT if doing a | 14147 | /* Append one space to the glyph row of iterator IT if doing a |
| 14148 | window-based redisplay. DEFAULT_FACE_P non-zero means let the | 14148 | window-based redisplay. The space has the same face as |
| 14149 | space have the default face, otherwise let it have the same face as | ||
| 14150 | IT->face_id. Value is non-zero if a space was added. | 14149 | IT->face_id. Value is non-zero if a space was added. |
| 14151 | 14150 | ||
| 14152 | This function is called to make sure that there is always one glyph | 14151 | This function is called to make sure that there is always one glyph |
| @@ -14158,9 +14157,8 @@ compute_line_metrics (it) | |||
| 14158 | end of the line if the row ends in italic text. */ | 14157 | end of the line if the row ends in italic text. */ |
| 14159 | 14158 | ||
| 14160 | static int | 14159 | static int |
| 14161 | append_space (it, default_face_p) | 14160 | append_space_for_newline (it) |
| 14162 | struct it *it; | 14161 | struct it *it; |
| 14163 | int default_face_p; | ||
| 14164 | { | 14162 | { |
| 14165 | if (FRAME_WINDOW_P (it->f)) | 14163 | if (FRAME_WINDOW_P (it->f)) |
| 14166 | { | 14164 | { |
| @@ -14172,7 +14170,7 @@ append_space (it, default_face_p) | |||
| 14172 | /* Save some values that must not be changed. | 14170 | /* Save some values that must not be changed. |
| 14173 | Must save IT->c and IT->len because otherwise | 14171 | Must save IT->c and IT->len because otherwise |
| 14174 | ITERATOR_AT_END_P wouldn't work anymore after | 14172 | ITERATOR_AT_END_P wouldn't work anymore after |
| 14175 | append_space has been called. */ | 14173 | append_space_for_newline has been called. */ |
| 14176 | enum display_element_type saved_what = it->what; | 14174 | enum display_element_type saved_what = it->what; |
| 14177 | int saved_c = it->c, saved_len = it->len; | 14175 | int saved_c = it->c, saved_len = it->len; |
| 14178 | int saved_x = it->current_x; | 14176 | int saved_x = it->current_x; |
| @@ -14190,9 +14188,7 @@ append_space (it, default_face_p) | |||
| 14190 | it->c = ' '; | 14188 | it->c = ' '; |
| 14191 | it->len = 1; | 14189 | it->len = 1; |
| 14192 | 14190 | ||
| 14193 | if (default_face_p) | 14191 | if (it->face_before_selective_p) |
| 14194 | it->face_id = DEFAULT_FACE_ID; | ||
| 14195 | else if (it->face_before_selective_p) | ||
| 14196 | it->face_id = it->saved_face_id; | 14192 | it->face_id = it->saved_face_id; |
| 14197 | face = FACE_FROM_ID (it->f, it->face_id); | 14193 | face = FACE_FROM_ID (it->f, it->face_id); |
| 14198 | it->face_id = FACE_FOR_CHAR (it->f, face, 0); | 14194 | it->face_id = FACE_FOR_CHAR (it->f, face, 0); |
| @@ -14484,7 +14480,7 @@ display_line (it) | |||
| 14484 | row->exact_window_width_line_p = 1; | 14480 | row->exact_window_width_line_p = 1; |
| 14485 | else | 14481 | else |
| 14486 | #endif /* HAVE_WINDOW_SYSTEM */ | 14482 | #endif /* HAVE_WINDOW_SYSTEM */ |
| 14487 | if ((append_space (it, 1) && row->used[TEXT_AREA] == 1) | 14483 | if ((append_space_for_newline (it) && row->used[TEXT_AREA] == 1) |
| 14488 | || row->used[TEXT_AREA] == 0) | 14484 | || row->used[TEXT_AREA] == 0) |
| 14489 | { | 14485 | { |
| 14490 | row->glyphs[TEXT_AREA]->charpos = -1; | 14486 | row->glyphs[TEXT_AREA]->charpos = -1; |
| @@ -14726,7 +14722,7 @@ display_line (it) | |||
| 14726 | /* Add a space at the end of the line that is used to | 14722 | /* Add a space at the end of the line that is used to |
| 14727 | display the cursor there. */ | 14723 | display the cursor there. */ |
| 14728 | if (!IT_OVERFLOW_NEWLINE_INTO_FRINGE (it)) | 14724 | if (!IT_OVERFLOW_NEWLINE_INTO_FRINGE (it)) |
| 14729 | append_space (it, 0); | 14725 | append_space_for_newline (it); |
| 14730 | #endif /* HAVE_WINDOW_SYSTEM */ | 14726 | #endif /* HAVE_WINDOW_SYSTEM */ |
| 14731 | 14727 | ||
| 14732 | /* Extend the face to the end of the line. */ | 14728 | /* Extend the face to the end of the line. */ |
| @@ -18515,6 +18511,8 @@ void | |||
| 18515 | x_produce_glyphs (it) | 18511 | x_produce_glyphs (it) |
| 18516 | struct it *it; | 18512 | struct it *it; |
| 18517 | { | 18513 | { |
| 18514 | int extra_line_spacing = it->extra_line_spacing; | ||
| 18515 | |||
| 18518 | it->glyph_not_available_p = 0; | 18516 | it->glyph_not_available_p = 0; |
| 18519 | 18517 | ||
| 18520 | if (it->what == IT_CHARACTER) | 18518 | if (it->what == IT_CHARACTER) |
| @@ -18624,6 +18622,7 @@ x_produce_glyphs (it) | |||
| 18624 | } | 18622 | } |
| 18625 | it->phys_ascent = min (it->phys_ascent, it->ascent); | 18623 | it->phys_ascent = min (it->phys_ascent, it->ascent); |
| 18626 | it->phys_descent = min (it->phys_descent, it->descent); | 18624 | it->phys_descent = min (it->phys_descent, it->descent); |
| 18625 | extra_line_spacing = 0; | ||
| 18627 | } | 18626 | } |
| 18628 | 18627 | ||
| 18629 | /* If this is a space inside a region of text with | 18628 | /* If this is a space inside a region of text with |
| @@ -18696,31 +18695,48 @@ x_produce_glyphs (it) | |||
| 18696 | But if previous part of the line set a height, don't | 18695 | But if previous part of the line set a height, don't |
| 18697 | increase that height */ | 18696 | increase that height */ |
| 18698 | 18697 | ||
| 18698 | Lisp_Object lsp; | ||
| 18699 | |||
| 18699 | it->pixel_width = 0; | 18700 | it->pixel_width = 0; |
| 18700 | it->nglyphs = 0; | 18701 | it->nglyphs = 0; |
| 18701 | 18702 | ||
| 18703 | lsp = Fget_text_property (IT_CHARPOS (*it), Qline_spacing, it->w->buffer); | ||
| 18704 | |||
| 18702 | it->ascent = FONT_BASE (font) + boff; | 18705 | it->ascent = FONT_BASE (font) + boff; |
| 18703 | it->descent = FONT_DESCENT (font) - boff; | 18706 | it->descent = FONT_DESCENT (font) - boff; |
| 18704 | 18707 | ||
| 18705 | if (it->max_ascent > 0 || it->max_descent > 0) | 18708 | if (EQ (lsp, Qt)) |
| 18706 | { | 18709 | { |
| 18707 | it->ascent = it->descent = 0; | 18710 | if (it->descent > it->max_descent) |
| 18711 | { | ||
| 18712 | it->ascent += it->descent - it->max_descent; | ||
| 18713 | it->descent = it->max_descent; | ||
| 18714 | } | ||
| 18715 | if (it->ascent> it->max_ascent) | ||
| 18716 | { | ||
| 18717 | it->descent = min (it->max_descent, it->descent + it->ascent - it->max_ascent); | ||
| 18718 | it->ascent = it->max_ascent; | ||
| 18719 | } | ||
| 18720 | it->phys_ascent = min (it->phys_ascent, it->ascent); | ||
| 18721 | it->phys_descent = min (it->phys_descent, it->descent); | ||
| 18722 | extra_line_spacing = 0; | ||
| 18708 | } | 18723 | } |
| 18709 | else | 18724 | else |
| 18710 | { | 18725 | { |
| 18711 | it->ascent = FONT_BASE (font) + boff; | 18726 | it->phys_ascent = it->ascent; |
| 18712 | it->descent = FONT_DESCENT (font) - boff; | 18727 | it->phys_descent = it->descent; |
| 18713 | } | ||
| 18714 | |||
| 18715 | it->phys_ascent = it->ascent; | ||
| 18716 | it->phys_descent = it->descent; | ||
| 18717 | 18728 | ||
| 18718 | if ((it->max_ascent > 0 || it->max_descent > 0) | 18729 | if ((it->max_ascent > 0 || it->max_descent > 0) |
| 18719 | && face->box != FACE_NO_BOX | 18730 | && face->box != FACE_NO_BOX |
| 18720 | && face->box_line_width > 0) | 18731 | && face->box_line_width > 0) |
| 18721 | { | 18732 | { |
| 18722 | it->ascent += face->box_line_width; | 18733 | it->ascent += face->box_line_width; |
| 18723 | it->descent += face->box_line_width; | 18734 | it->descent += face->box_line_width; |
| 18735 | } | ||
| 18736 | if (INTEGERP (lsp)) | ||
| 18737 | extra_line_spacing = XINT (lsp); | ||
| 18738 | else if (FLOATP (lsp)) | ||
| 18739 | extra_line_spacing = (it->phys_ascent + it->phys_descent) * XFLOAT_DATA (lsp); | ||
| 18724 | } | 18740 | } |
| 18725 | } | 18741 | } |
| 18726 | else if (it->char_to_display == '\t') | 18742 | else if (it->char_to_display == '\t') |
| @@ -19098,7 +19114,7 @@ x_produce_glyphs (it) | |||
| 19098 | if (it->area == TEXT_AREA) | 19114 | if (it->area == TEXT_AREA) |
| 19099 | it->current_x += it->pixel_width; | 19115 | it->current_x += it->pixel_width; |
| 19100 | 19116 | ||
| 19101 | it->descent += it->extra_line_spacing; | 19117 | it->descent += extra_line_spacing; |
| 19102 | 19118 | ||
| 19103 | it->max_ascent = max (it->max_ascent, it->ascent); | 19119 | it->max_ascent = max (it->max_ascent, it->ascent); |
| 19104 | it->max_descent = max (it->max_descent, it->descent); | 19120 | it->max_descent = max (it->max_descent, it->descent); |