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/buffer.h | |
| 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/buffer.h')
| -rw-r--r-- | src/buffer.h | 5 |
1 files changed, 4 insertions, 1 deletions
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 |