emacs/test/src
Daniel Mendler e8f26d554b 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>
2026-01-24 13:32:44 +02:00
..
comp-resources ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
emacs-module-resources ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
lread-resources Make force-load-doc-strings work again 2022-08-07 10:25:03 +02:00
regex-resources * src/regex-emacs.c (analyze_first): Fix incorrect optimization 2023-09-27 13:29:50 -04:00
syntax-resources Enhance syntax-tests.el to test nestable comments (Lisp style) 2020-11-17 16:51:49 +00:00
alloc-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
buffer-tests.el Support cons cell for 'line-spacing' 2026-01-24 13:32:44 +02:00
callint-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
callproc-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
casefiddle-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
character-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
charset-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
chartab-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
cmds-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
coding-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
comp-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
data-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
decompress-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
doc-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
editfns-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
emacs-module-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
emacs-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
eval-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
fileio-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
filelock-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
floatfns-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
fns-tests.el ; Fix simple logic in OpenBSD's random test 2026-01-04 11:25:50 +02:00
font-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
image-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
indent-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
inotify-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
json-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
keyboard-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
keymap-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
lcms-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
lread-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
marker-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
minibuf-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
print-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
process-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
profiler-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
regex-emacs-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
search-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
sqlite-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
syntax-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
textprop-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
thread-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
timefns-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
treesit-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
undo-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
xdisp-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
xfaces-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
xml-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00