diff options
| author | Daniel Mendler | 2026-01-07 17:39:16 +0100 |
|---|---|---|
| committer | Eli Zaretskii | 2026-01-24 13:32:44 +0200 |
| commit | e8f26d554b64ed63fe2b7f110d5247648b7322ed (patch) | |
| tree | e2ccf11382272f44ee1bca37eac42858b1180bb8 /src | |
| parent | 21455197343ff912d9544b4663ad383009a816e5 (diff) | |
| download | emacs-e8f26d554b64ed63fe2b7f110d5247648b7322ed.tar.gz emacs-e8f26d554b64ed63fe2b7f110d5247648b7322ed.zip | |
Support cons cell for 'line-spacing'
* etc/NEWS: Announce the change.
* src/dispextern.h (struct glyph_row): Add
'extra_line_spacing_above' member.
(struct it): Add 'extra_line_spacing_above' member.
* src/frame.h (struct frame): Add 'extra_line_spacing_above'
member. Update comment for 'extra_line_spacing.'
* src/buffer.c (syms_of_buffer): Update the docstring of
'line-spacing' to describe the cons cell usage.
* src/buffer.h (struct buffer): Update comment for
'extra_line_spacing'.
* src/frame.c (gui_set_line_spacing): Handle cons cell value for
'line-spacing'. Calculate and set 'extra_line_spacing_above'
for both integer and float pairs.
* src/xdisp.c (init_iterator): Initialize 'extra_line_spacing_above'
from buffer or frame 'line-spacing', handling cons cells for both
integer and float values.
(gui_produce_glyphs): Use 'extra_line_spacing_above' to distribute
spacing between ascent and descent. Update 'max_extra_line_spacing'
calculation.
(resize_mini_window): Take line spacing into account when resizing the
mini window. Pass height of a single line to 'grow_mini_window' and
'shrink_mini_window'.
* src/window.c (grow_mini_window, shrink_mini_window): Add unit
argument which defines height of a single line.
* src/window.h (grow_mini_window, shrink_mini_window): Adjust function
prototypes accordingly with unit argument.
* lisp/subr.el (total-line-spacing): New function to calculate total
spacing from a number or cons cell.
(posn-col-row): Use total-line-spacing.
* lisp/simple.el (default-line-height): Use 'total-line-spacing'.
* lisp/textmodes/picture.el (picture-mouse-set-point): Use
'total-line-spacing'.
* lisp/window.el (window-default-line-height): Use
'total-line-spacing'.
(window--resize-mini-window): Take 'line-spacing' into account.
* test/lisp/subr-tests.el (total-line-spacing): New test.
* test/src/buffer-tests.el (test-line-spacing): New test.
* doc/emacs/display.texi (Display Custom): Document that
'line-spacing' can be a cons cell.
(Line Height): Document the new cons cell format for 'line-spacing'
to allow vertical centering.
Co-authored-by: Przemysław Alexander Kamiński <alexander@kaminski.se>
Co-authored-by: Daniel Mendler <mail@daniel-mendler.de>
Diffstat (limited to 'src')
| -rw-r--r-- | src/buffer.c | 7 | ||||
| -rw-r--r-- | src/buffer.h | 5 | ||||
| -rw-r--r-- | src/dispextern.h | 7 | ||||
| -rw-r--r-- | src/frame.c | 50 | ||||
| -rw-r--r-- | src/frame.h | 9 | ||||
| -rw-r--r-- | src/window.c | 15 | ||||
| -rw-r--r-- | src/window.h | 4 | ||||
| -rw-r--r-- | src/xdisp.c | 73 |
8 files changed, 140 insertions, 30 deletions
diff --git a/src/buffer.c b/src/buffer.c index fec30d4f0e9..3d85d784f1c 100644 --- a/src/buffer.c +++ b/src/buffer.c | |||
| @@ -5875,12 +5875,15 @@ cursor's appearance is instead controlled by the variable | |||
| 5875 | `cursor-in-non-selected-windows'. */); | 5875 | `cursor-in-non-selected-windows'. */); |
| 5876 | 5876 | ||
| 5877 | DEFVAR_PER_BUFFER ("line-spacing", | 5877 | DEFVAR_PER_BUFFER ("line-spacing", |
| 5878 | &BVAR (current_buffer, extra_line_spacing), Qnumberp, | 5878 | &BVAR (current_buffer, extra_line_spacing), Qnil, |
| 5879 | doc: /* Additional space to put between lines when displaying a buffer. | 5879 | doc: /* Additional space to put between lines when displaying a buffer. |
| 5880 | The space is measured in pixels, and put below lines on graphic displays, | 5880 | The space is measured in pixels, and put below lines on graphic displays, |
| 5881 | see `display-graphic-p'. | 5881 | see `display-graphic-p'. |
| 5882 | If value is a floating point number, it specifies the spacing relative | 5882 | If value is a floating point number, it specifies the spacing relative |
| 5883 | to the default frame line height. A value of nil means add no extra space. */); | 5883 | to the default frame line height. |
| 5884 | If value is a cons cell containing a pair of floats or integers, | ||
| 5885 | it is interpreted as space above and below the line, respectively. | ||
| 5886 | A value of nil means add no extra space. */); | ||
| 5884 | 5887 | ||
| 5885 | DEFVAR_PER_BUFFER ("cursor-in-non-selected-windows", | 5888 | DEFVAR_PER_BUFFER ("cursor-in-non-selected-windows", |
| 5886 | &BVAR (current_buffer, cursor_in_non_selected_windows), Qnil, | 5889 | &BVAR (current_buffer, cursor_in_non_selected_windows), Qnil, |
diff --git a/src/buffer.h b/src/buffer.h index 34fe308b671..403b249df6f 100644 --- a/src/buffer.h +++ b/src/buffer.h | |||
| @@ -575,7 +575,10 @@ struct buffer | |||
| 575 | Lisp_Object cursor_type_; | 575 | Lisp_Object cursor_type_; |
| 576 | 576 | ||
| 577 | /* An integer > 0 means put that number of pixels below text lines | 577 | /* An integer > 0 means put that number of pixels below text lines |
| 578 | in the display of this buffer. */ | 578 | in the display of this buffer. |
| 579 | A float ~ 1.0 means add extra number of pixels below text lines | ||
| 580 | relative to the line height. | ||
| 581 | A cons means put car spacing above and cdr spacing below the line. */ | ||
| 579 | Lisp_Object extra_line_spacing_; | 582 | Lisp_Object extra_line_spacing_; |
| 580 | 583 | ||
| 581 | #ifdef HAVE_TREE_SITTER | 584 | #ifdef HAVE_TREE_SITTER |
diff --git a/src/dispextern.h b/src/dispextern.h index d325e185c5a..30785b9ccdf 100644 --- a/src/dispextern.h +++ b/src/dispextern.h | |||
| @@ -960,6 +960,9 @@ struct glyph_row | |||
| 960 | in last row when checking if row is fully visible. */ | 960 | in last row when checking if row is fully visible. */ |
| 961 | int extra_line_spacing; | 961 | int extra_line_spacing; |
| 962 | 962 | ||
| 963 | /* Part of extra_line_spacing that should go above the line. */ | ||
| 964 | int extra_line_spacing_above; | ||
| 965 | |||
| 963 | /* First position in this row. This is the text position, including | 966 | /* First position in this row. This is the text position, including |
| 964 | overlay position information etc, where the display of this row | 967 | overlay position information etc, where the display of this row |
| 965 | started, and can thus be less than the position of the first | 968 | started, and can thus be less than the position of the first |
| @@ -2772,6 +2775,10 @@ struct it | |||
| 2772 | window systems only.) */ | 2775 | window systems only.) */ |
| 2773 | int extra_line_spacing; | 2776 | int extra_line_spacing; |
| 2774 | 2777 | ||
| 2778 | /* Default amount of additional space in pixels above lines (for | ||
| 2779 | window systems only). */ | ||
| 2780 | int extra_line_spacing_above; | ||
| 2781 | |||
| 2775 | /* Max extra line spacing added in this row. */ | 2782 | /* Max extra line spacing added in this row. */ |
| 2776 | int max_extra_line_spacing; | 2783 | int max_extra_line_spacing; |
| 2777 | 2784 | ||
diff --git a/src/frame.c b/src/frame.c index 033215a76ec..ba342b15723 100644 --- a/src/frame.c +++ b/src/frame.c | |||
| @@ -5454,18 +5454,60 @@ void | |||
| 5454 | gui_set_line_spacing (struct frame *f, Lisp_Object new_value, Lisp_Object old_value) | 5454 | gui_set_line_spacing (struct frame *f, Lisp_Object new_value, Lisp_Object old_value) |
| 5455 | { | 5455 | { |
| 5456 | if (NILP (new_value)) | 5456 | if (NILP (new_value)) |
| 5457 | f->extra_line_spacing = 0; | 5457 | { |
| 5458 | f->extra_line_spacing = 0; | ||
| 5459 | f->extra_line_spacing_above = 0; | ||
| 5460 | } | ||
| 5458 | else if (RANGED_FIXNUMP (0, new_value, INT_MAX)) | 5461 | else if (RANGED_FIXNUMP (0, new_value, INT_MAX)) |
| 5459 | f->extra_line_spacing = XFIXNAT (new_value); | 5462 | { |
| 5463 | f->extra_line_spacing = XFIXNAT (new_value); | ||
| 5464 | f->extra_line_spacing_above = 0; | ||
| 5465 | } | ||
| 5460 | else if (FLOATP (new_value)) | 5466 | else if (FLOATP (new_value)) |
| 5461 | { | 5467 | { |
| 5462 | int new_spacing = XFLOAT_DATA (new_value) * FRAME_LINE_HEIGHT (f) + 0.5; | 5468 | int new_spacing = XFLOAT_DATA (new_value) * FRAME_LINE_HEIGHT (f); |
| 5463 | 5469 | ||
| 5464 | if (new_spacing >= 0) | 5470 | if (new_spacing >= 0) { |
| 5465 | f->extra_line_spacing = new_spacing; | 5471 | f->extra_line_spacing = new_spacing; |
| 5472 | f->extra_line_spacing_above = 0; | ||
| 5473 | } | ||
| 5466 | else | 5474 | else |
| 5467 | signal_error ("Invalid line-spacing", new_value); | 5475 | signal_error ("Invalid line-spacing", new_value); |
| 5468 | } | 5476 | } |
| 5477 | else if (CONSP (new_value)) | ||
| 5478 | { | ||
| 5479 | Lisp_Object above = XCAR (new_value); | ||
| 5480 | Lisp_Object below = XCDR (new_value); | ||
| 5481 | |||
| 5482 | /* Integer pair case. */ | ||
| 5483 | if (RANGED_FIXNUMP (0, above, INT_MAX) | ||
| 5484 | && RANGED_FIXNUMP (0, below, INT_MAX)) | ||
| 5485 | { | ||
| 5486 | f->extra_line_spacing = XFIXNAT (above) + XFIXNAT (below); | ||
| 5487 | f->extra_line_spacing_above = XFIXNAT (above); | ||
| 5488 | } | ||
| 5489 | |||
| 5490 | /* Float pair case. */ | ||
| 5491 | else if (FLOATP (XCAR (new_value)) | ||
| 5492 | && FLOATP (XCDR (new_value))) | ||
| 5493 | { | ||
| 5494 | int new_spacing = (XFLOAT_DATA (above) + XFLOAT_DATA (below)) * FRAME_LINE_HEIGHT (f); | ||
| 5495 | int spacing_above = XFLOAT_DATA (above) * FRAME_LINE_HEIGHT (f); | ||
| 5496 | if(new_spacing >= 0 && spacing_above >= 0) | ||
| 5497 | { | ||
| 5498 | f->extra_line_spacing = new_spacing; | ||
| 5499 | f->extra_line_spacing_above = spacing_above; | ||
| 5500 | } | ||
| 5501 | else | ||
| 5502 | signal_error ("Invalid line-spacing", new_value); | ||
| 5503 | } | ||
| 5504 | |||
| 5505 | /* Unmatched pair case. */ | ||
| 5506 | else | ||
| 5507 | { | ||
| 5508 | signal_error ("Invalid line-spacing", new_value); | ||
| 5509 | } | ||
| 5510 | } | ||
| 5469 | else | 5511 | else |
| 5470 | signal_error ("Invalid line-spacing", new_value); | 5512 | signal_error ("Invalid line-spacing", new_value); |
| 5471 | if (FRAME_VISIBLE_P (f)) | 5513 | if (FRAME_VISIBLE_P (f)) |
diff --git a/src/frame.h b/src/frame.h index c369a848b7c..091b112e8b9 100644 --- a/src/frame.h +++ b/src/frame.h | |||
| @@ -718,9 +718,16 @@ struct frame | |||
| 718 | frame parameter. 0 means don't do gamma correction. */ | 718 | frame parameter. 0 means don't do gamma correction. */ |
| 719 | double gamma; | 719 | double gamma; |
| 720 | 720 | ||
| 721 | /* Additional space to put between text lines on this frame. */ | 721 | /* Additional space to put below text lines on this frame. |
| 722 | Also takes part in line height calculation. */ | ||
| 722 | int extra_line_spacing; | 723 | int extra_line_spacing; |
| 723 | 724 | ||
| 725 | /* Amount of space (included in extra_line_spacing) that goes ABOVE | ||
| 726 | line line. | ||
| 727 | IMPORTANT: Don't use this for line height calculations. | ||
| 728 | (5 . 20) means that extra_line_spacing is 25 with 5 above. */ | ||
| 729 | int extra_line_spacing_above; | ||
| 730 | |||
| 724 | /* All display backends seem to need these two pixel values. */ | 731 | /* All display backends seem to need these two pixel values. */ |
| 725 | unsigned long background_pixel; | 732 | unsigned long background_pixel; |
| 726 | unsigned long foreground_pixel; | 733 | unsigned long foreground_pixel; |
diff --git a/src/window.c b/src/window.c index 497c587b167..c4f2e4e491f 100644 --- a/src/window.c +++ b/src/window.c | |||
| @@ -5894,11 +5894,11 @@ resize_mini_window_apply (struct window *w, int delta) | |||
| 5894 | * line of text. | 5894 | * line of text. |
| 5895 | */ | 5895 | */ |
| 5896 | void | 5896 | void |
| 5897 | grow_mini_window (struct window *w, int delta) | 5897 | grow_mini_window (struct window *w, int delta, int unit) |
| 5898 | { | 5898 | { |
| 5899 | struct frame *f = XFRAME (w->frame); | 5899 | struct frame *f = XFRAME (w->frame); |
| 5900 | int old_height = window_body_height (w, WINDOW_BODY_IN_PIXELS); | 5900 | int old_height = window_body_height (w, WINDOW_BODY_IN_PIXELS); |
| 5901 | int min_height = FRAME_LINE_HEIGHT (f); | 5901 | int min_height = unit; |
| 5902 | 5902 | ||
| 5903 | eassert (MINI_WINDOW_P (w)); | 5903 | eassert (MINI_WINDOW_P (w)); |
| 5904 | 5904 | ||
| @@ -5926,7 +5926,7 @@ grow_mini_window (struct window *w, int delta) | |||
| 5926 | resize_mini_window_apply (w, -XFIXNUM (grow)); | 5926 | resize_mini_window_apply (w, -XFIXNUM (grow)); |
| 5927 | } | 5927 | } |
| 5928 | FRAME_WINDOWS_FROZEN (f) | 5928 | FRAME_WINDOWS_FROZEN (f) |
| 5929 | = window_body_height (w, WINDOW_BODY_IN_PIXELS) > FRAME_LINE_HEIGHT (f); | 5929 | = window_body_height (w, WINDOW_BODY_IN_PIXELS) > unit; |
| 5930 | } | 5930 | } |
| 5931 | 5931 | ||
| 5932 | /** | 5932 | /** |
| @@ -5936,11 +5936,10 @@ grow_mini_window (struct window *w, int delta) | |||
| 5936 | * line of text. | 5936 | * line of text. |
| 5937 | */ | 5937 | */ |
| 5938 | void | 5938 | void |
| 5939 | shrink_mini_window (struct window *w) | 5939 | shrink_mini_window (struct window *w, int unit) |
| 5940 | { | 5940 | { |
| 5941 | struct frame *f = XFRAME (w->frame); | 5941 | struct frame *f = XFRAME (w->frame); |
| 5942 | int delta = (window_body_height (w, WINDOW_BODY_IN_PIXELS) | 5942 | int delta = (window_body_height (w, WINDOW_BODY_IN_PIXELS) - unit); |
| 5943 | - FRAME_LINE_HEIGHT (f)); | ||
| 5944 | 5943 | ||
| 5945 | eassert (MINI_WINDOW_P (w)); | 5944 | eassert (MINI_WINDOW_P (w)); |
| 5946 | 5945 | ||
| @@ -5959,10 +5958,10 @@ shrink_mini_window (struct window *w) | |||
| 5959 | else if (delta < 0) | 5958 | else if (delta < 0) |
| 5960 | /* delta can be less than zero after adding horizontal scroll | 5959 | /* delta can be less than zero after adding horizontal scroll |
| 5961 | bar. */ | 5960 | bar. */ |
| 5962 | grow_mini_window (w, -delta); | 5961 | grow_mini_window (w, -delta, unit); |
| 5963 | 5962 | ||
| 5964 | FRAME_WINDOWS_FROZEN (f) | 5963 | FRAME_WINDOWS_FROZEN (f) |
| 5965 | = window_body_height (w, WINDOW_BODY_IN_PIXELS) > FRAME_LINE_HEIGHT (f); | 5964 | = window_body_height (w, WINDOW_BODY_IN_PIXELS) > unit; |
| 5966 | } | 5965 | } |
| 5967 | 5966 | ||
| 5968 | DEFUN ("resize-mini-window-internal", Fresize_mini_window_internal, | 5967 | DEFUN ("resize-mini-window-internal", Fresize_mini_window_internal, |
diff --git a/src/window.h b/src/window.h index 5a75f62cc6e..1b4939b40a6 100644 --- a/src/window.h +++ b/src/window.h | |||
| @@ -1126,8 +1126,8 @@ extern Lisp_Object window_from_coordinates (struct frame *, int, int, | |||
| 1126 | extern void resize_frame_windows (struct frame *, int, bool); | 1126 | extern void resize_frame_windows (struct frame *, int, bool); |
| 1127 | extern void restore_window_configuration (Lisp_Object); | 1127 | extern void restore_window_configuration (Lisp_Object); |
| 1128 | extern void delete_all_child_windows (Lisp_Object); | 1128 | extern void delete_all_child_windows (Lisp_Object); |
| 1129 | extern void grow_mini_window (struct window *, int); | 1129 | extern void grow_mini_window (struct window *, int, int); |
| 1130 | extern void shrink_mini_window (struct window *); | 1130 | extern void shrink_mini_window (struct window *, int); |
| 1131 | extern int window_relative_x_coord (struct window *, enum window_part, int); | 1131 | extern int window_relative_x_coord (struct window *, enum window_part, int); |
| 1132 | 1132 | ||
| 1133 | void run_window_change_functions (void); | 1133 | void run_window_change_functions (void); |
diff --git a/src/xdisp.c b/src/xdisp.c index a295131a311..fa826c366dd 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -3316,13 +3316,50 @@ init_iterator (struct it *it, struct window *w, | |||
| 3316 | if (base_face_id == DEFAULT_FACE_ID | 3316 | if (base_face_id == DEFAULT_FACE_ID |
| 3317 | && FRAME_WINDOW_P (it->f)) | 3317 | && FRAME_WINDOW_P (it->f)) |
| 3318 | { | 3318 | { |
| 3319 | Lisp_Object line_space_above; | ||
| 3320 | Lisp_Object line_space_below; | ||
| 3321 | |||
| 3319 | if (FIXNATP (BVAR (current_buffer, extra_line_spacing))) | 3322 | if (FIXNATP (BVAR (current_buffer, extra_line_spacing))) |
| 3320 | it->extra_line_spacing = XFIXNAT (BVAR (current_buffer, extra_line_spacing)); | 3323 | { |
| 3324 | it->extra_line_spacing = XFIXNAT (BVAR (current_buffer, extra_line_spacing)); | ||
| 3325 | it->extra_line_spacing_above = 0; | ||
| 3326 | } | ||
| 3321 | else if (FLOATP (BVAR (current_buffer, extra_line_spacing))) | 3327 | else if (FLOATP (BVAR (current_buffer, extra_line_spacing))) |
| 3322 | it->extra_line_spacing = (XFLOAT_DATA (BVAR (current_buffer, extra_line_spacing)) | 3328 | { |
| 3323 | * FRAME_LINE_HEIGHT (it->f)); | 3329 | it->extra_line_spacing = (XFLOAT_DATA (BVAR (current_buffer, extra_line_spacing)) |
| 3330 | * FRAME_LINE_HEIGHT (it->f)); | ||
| 3331 | it->extra_line_spacing_above = 0; | ||
| 3332 | } | ||
| 3333 | else if (CONSP (BVAR (current_buffer, extra_line_spacing))) | ||
| 3334 | { | ||
| 3335 | line_space_above = XCAR (BVAR (current_buffer, extra_line_spacing)); | ||
| 3336 | line_space_below = XCDR (BVAR (current_buffer, extra_line_spacing)); | ||
| 3337 | /* Integer pair case. */ | ||
| 3338 | if (FIXNATP (line_space_above) && FIXNATP (line_space_below)) | ||
| 3339 | { | ||
| 3340 | int line_space_total = XFIXNAT (line_space_below) + XFIXNAT (line_space_above); | ||
| 3341 | it->extra_line_spacing = line_space_total; | ||
| 3342 | it->extra_line_spacing_above = XFIXNAT (line_space_above); | ||
| 3343 | } | ||
| 3344 | /* Float pair case. */ | ||
| 3345 | else if (FLOATP (line_space_above) && FLOATP (line_space_below)) | ||
| 3346 | { | ||
| 3347 | double line_space_total = XFLOAT_DATA (line_space_above) + XFLOAT_DATA (line_space_below); | ||
| 3348 | it->extra_line_spacing = (line_space_total * FRAME_LINE_HEIGHT (it->f)); | ||
| 3349 | it->extra_line_spacing_above = (XFLOAT_DATA (line_space_above) * FRAME_LINE_HEIGHT (it->f)); | ||
| 3350 | } | ||
| 3351 | /* Invalid cons. */ | ||
| 3352 | else | ||
| 3353 | { | ||
| 3354 | it->extra_line_spacing = 0; | ||
| 3355 | it->extra_line_spacing_above = 0; | ||
| 3356 | } | ||
| 3357 | } | ||
| 3324 | else if (it->f->extra_line_spacing > 0) | 3358 | else if (it->f->extra_line_spacing > 0) |
| 3325 | it->extra_line_spacing = it->f->extra_line_spacing; | 3359 | { |
| 3360 | it->extra_line_spacing = it->f->extra_line_spacing; | ||
| 3361 | it->extra_line_spacing_above = it->f->extra_line_spacing_above; | ||
| 3362 | } | ||
| 3326 | } | 3363 | } |
| 3327 | 3364 | ||
| 3328 | /* If realized faces have been removed, e.g. because of face | 3365 | /* If realized faces have been removed, e.g. because of face |
| @@ -13157,7 +13194,7 @@ resize_mini_window (struct window *w, bool exact_p) | |||
| 13157 | else | 13194 | else |
| 13158 | { | 13195 | { |
| 13159 | struct it it; | 13196 | struct it it; |
| 13160 | int unit = FRAME_LINE_HEIGHT (f); | 13197 | int unit; |
| 13161 | int height, max_height; | 13198 | int height, max_height; |
| 13162 | struct text_pos start; | 13199 | struct text_pos start; |
| 13163 | struct buffer *old_current_buffer = NULL; | 13200 | struct buffer *old_current_buffer = NULL; |
| @@ -13171,6 +13208,10 @@ resize_mini_window (struct window *w, bool exact_p) | |||
| 13171 | 13208 | ||
| 13172 | init_iterator (&it, w, BEGV, BEGV_BYTE, NULL, DEFAULT_FACE_ID); | 13209 | init_iterator (&it, w, BEGV, BEGV_BYTE, NULL, DEFAULT_FACE_ID); |
| 13173 | 13210 | ||
| 13211 | /* Unit includes line spacing if line spacing is added above */ | ||
| 13212 | unit = FRAME_LINE_HEIGHT (f) + | ||
| 13213 | (it.extra_line_spacing_above ? it.extra_line_spacing : 0); | ||
| 13214 | |||
| 13174 | /* Compute the max. number of lines specified by the user. */ | 13215 | /* Compute the max. number of lines specified by the user. */ |
| 13175 | if (FLOATP (Vmax_mini_window_height)) | 13216 | if (FLOATP (Vmax_mini_window_height)) |
| 13176 | max_height = XFLOAT_DATA (Vmax_mini_window_height) * windows_height; | 13217 | max_height = XFLOAT_DATA (Vmax_mini_window_height) * windows_height; |
| @@ -13203,7 +13244,10 @@ resize_mini_window (struct window *w, bool exact_p) | |||
| 13203 | } | 13244 | } |
| 13204 | else | 13245 | else |
| 13205 | height = it.current_y + it.max_ascent + it.max_descent; | 13246 | height = it.current_y + it.max_ascent + it.max_descent; |
| 13206 | height -= min (it.extra_line_spacing, it.max_extra_line_spacing); | 13247 | |
| 13248 | /* Remove final line spacing in the mini-window */ | ||
| 13249 | if (!it.extra_line_spacing_above) | ||
| 13250 | height -= min (it.extra_line_spacing, it.max_extra_line_spacing); | ||
| 13207 | 13251 | ||
| 13208 | /* Compute a suitable window start. */ | 13252 | /* Compute a suitable window start. */ |
| 13209 | if (height > max_height) | 13253 | if (height > max_height) |
| @@ -13241,13 +13285,13 @@ resize_mini_window (struct window *w, bool exact_p) | |||
| 13241 | /* Let it grow only, until we display an empty message, in which | 13285 | /* Let it grow only, until we display an empty message, in which |
| 13242 | case the window shrinks again. */ | 13286 | case the window shrinks again. */ |
| 13243 | if (height > old_height) | 13287 | if (height > old_height) |
| 13244 | grow_mini_window (w, height - old_height); | 13288 | grow_mini_window (w, height - old_height, unit); |
| 13245 | else if (height < old_height && (exact_p || BEGV == ZV)) | 13289 | else if (height < old_height && (exact_p || BEGV == ZV)) |
| 13246 | shrink_mini_window (w); | 13290 | shrink_mini_window (w, unit); |
| 13247 | } | 13291 | } |
| 13248 | else if (height != old_height) | 13292 | else if (height != old_height) |
| 13249 | /* Always resize to exact size needed. */ | 13293 | /* Always resize to exact size needed. */ |
| 13250 | grow_mini_window (w, height - old_height); | 13294 | grow_mini_window (w, height - old_height, unit); |
| 13251 | 13295 | ||
| 13252 | if (old_current_buffer) | 13296 | if (old_current_buffer) |
| 13253 | set_buffer_internal (old_current_buffer); | 13297 | set_buffer_internal (old_current_buffer); |
| @@ -24068,6 +24112,7 @@ append_space_for_newline (struct it *it, bool default_face_p) | |||
| 24068 | { | 24112 | { |
| 24069 | Lisp_Object height, total_height; | 24113 | Lisp_Object height, total_height; |
| 24070 | int extra_line_spacing = it->extra_line_spacing; | 24114 | int extra_line_spacing = it->extra_line_spacing; |
| 24115 | int extra_line_spacing_above = it->extra_line_spacing_above; | ||
| 24071 | int boff = font->baseline_offset; | 24116 | int boff = font->baseline_offset; |
| 24072 | 24117 | ||
| 24073 | if (font->vertical_centering) | 24118 | if (font->vertical_centering) |
| @@ -24109,7 +24154,7 @@ append_space_for_newline (struct it *it, bool default_face_p) | |||
| 24109 | 24154 | ||
| 24110 | if (!NILP (total_height)) | 24155 | if (!NILP (total_height)) |
| 24111 | spacing = calc_line_height_property (it, total_height, font, | 24156 | spacing = calc_line_height_property (it, total_height, font, |
| 24112 | boff, false); | 24157 | boff, false); |
| 24113 | else | 24158 | else |
| 24114 | { | 24159 | { |
| 24115 | spacing = get_it_property (it, Qline_spacing); | 24160 | spacing = get_it_property (it, Qline_spacing); |
| @@ -24121,11 +24166,13 @@ append_space_for_newline (struct it *it, bool default_face_p) | |||
| 24121 | extra_line_spacing = XFIXNUM (spacing); | 24166 | extra_line_spacing = XFIXNUM (spacing); |
| 24122 | if (!NILP (total_height)) | 24167 | if (!NILP (total_height)) |
| 24123 | extra_line_spacing -= (it->phys_ascent + it->phys_descent); | 24168 | extra_line_spacing -= (it->phys_ascent + it->phys_descent); |
| 24169 | |||
| 24124 | } | 24170 | } |
| 24125 | } | 24171 | } |
| 24126 | if (extra_line_spacing > 0) | 24172 | if (extra_line_spacing > 0) |
| 24127 | { | 24173 | { |
| 24128 | it->descent += extra_line_spacing; | 24174 | it->descent += (extra_line_spacing - extra_line_spacing_above); |
| 24175 | it->ascent += extra_line_spacing_above; | ||
| 24129 | if (extra_line_spacing > it->max_extra_line_spacing) | 24176 | if (extra_line_spacing > it->max_extra_line_spacing) |
| 24130 | it->max_extra_line_spacing = extra_line_spacing; | 24177 | it->max_extra_line_spacing = extra_line_spacing; |
| 24131 | } | 24178 | } |
| @@ -33138,6 +33185,7 @@ void | |||
| 33138 | gui_produce_glyphs (struct it *it) | 33185 | gui_produce_glyphs (struct it *it) |
| 33139 | { | 33186 | { |
| 33140 | int extra_line_spacing = it->extra_line_spacing; | 33187 | int extra_line_spacing = it->extra_line_spacing; |
| 33188 | int extra_line_spacing_above = it->extra_line_spacing_above; | ||
| 33141 | 33189 | ||
| 33142 | it->glyph_not_available_p = false; | 33190 | it->glyph_not_available_p = false; |
| 33143 | 33191 | ||
| @@ -33891,7 +33939,8 @@ gui_produce_glyphs (struct it *it) | |||
| 33891 | 33939 | ||
| 33892 | if (extra_line_spacing > 0) | 33940 | if (extra_line_spacing > 0) |
| 33893 | { | 33941 | { |
| 33894 | it->descent += extra_line_spacing; | 33942 | it->descent += extra_line_spacing - extra_line_spacing_above; |
| 33943 | it->ascent += extra_line_spacing_above; | ||
| 33895 | if (extra_line_spacing > it->max_extra_line_spacing) | 33944 | if (extra_line_spacing > it->max_extra_line_spacing) |
| 33896 | it->max_extra_line_spacing = extra_line_spacing; | 33945 | it->max_extra_line_spacing = extra_line_spacing; |
| 33897 | } | 33946 | } |