From 5b9ee5b913b031fca6f424170d9b61addb090294 Mon Sep 17 00:00:00 2001 From: Ingo Lohmar Date: Tue, 1 Oct 2019 09:27:55 +0200 Subject: [PATCH] Fix frame height calculation from max-height When `fit-frame-to-buffer' is given a non-nil `max-height' argument, we need to work not with the char-height, but with the line-height including `line-spacing' (Bug#37563). * lisp/window.el (fit-frame-to-buffer): Account for line-spacing in height. --- lisp/window.el | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lisp/window.el b/lisp/window.el index 620eacdd29..21b58495fa 100644 --- a/lisp/window.el +++ b/lisp/window.el @@ -8637,7 +8637,10 @@ fit-frame-to-buffer (setq frame (window-normalize-frame frame)) (when (window-live-p (frame-root-window frame)) (let* ((char-width (frame-char-width frame)) - (char-height (frame-char-height frame)) + (char-height (+ (frame-char-height frame) + ;; Add line-spacing in the selected window's buffer. + (buffer-local-value 'line-spacing + (window-buffer (car (window-list)))))) ;; WINDOW is FRAME's root window. (window (frame-root-window frame)) (parent (frame-parent frame)) -- 2.23.0