From: Eli Zaretskii Date: Tue, 5 Aug 2014 13:34:06 +0000 (+0300) Subject: Fix bug #18195 with inaccurate results from window-screen-lines. X-Git-Tag: emacs-24.3.93~20 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=5818408f5029ae6c26fa329104d1126b2322b356;p=emacs.git Fix bug #18195 with inaccurate results from window-screen-lines. lisp/simple.el (default-line-height): A floating-point value of line-spacing means a fraction of the default frame font's height, not of the font currently used by the 'default' face. Truncate the pixel value, like the display engine does. (window-screen-lines): Use window-inside-pixel-edges for determining the window height in pixels. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 3e5042a0f91..89f463a2fb0 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,12 @@ +2014-08-05 Eli Zaretskii + + * simple.el (default-line-height): A floating-point value of + line-spacing means a fraction of the default frame font's height, + not of the font currently used by the 'default' face. Truncate + the pixel value, like the display engine does. + (window-screen-lines): Use window-inside-pixel-edges for + determining the window height in pixels. (Bug#18195) + 2014-07-29 Eli Zaretskii * tutorial.el (tutorial--display-changes): Accept punctuation diff --git a/lisp/simple.el b/lisp/simple.el index d7f5b418302..1a42db81669 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -5038,7 +5038,7 @@ or the frame." 0) 0))) (if (floatp lsp) - (setq lsp (* dfh lsp))) + (setq lsp (truncate (* (frame-char-height) lsp)))) (+ dfh lsp))) (defun window-screen-lines () @@ -5050,10 +5050,9 @@ in the window, not in units of the frame's default font, and also accounts for `line-spacing', if any, defined for the window's buffer or frame. The value is a floating-point number." - (let ((canonical (window-text-height)) - (fch (frame-char-height)) + (let ((edges (window-inside-pixel-edges)) (dlh (default-line-height))) - (/ (* (float canonical) fch) dlh))) + (/ (float (- (nth 3 edges) (nth 1 edges))) dlh))) ;; Returns non-nil if partial move was done. (defun line-move-partial (arg noerror to-end)