]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix bug #18195 with inaccurate results from window-screen-lines.
authorEli Zaretskii <eliz@gnu.org>
Tue, 5 Aug 2014 13:34:06 +0000 (16:34 +0300)
committerEli Zaretskii <eliz@gnu.org>
Tue, 5 Aug 2014 13:34:06 +0000 (16:34 +0300)
 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.

lisp/ChangeLog
lisp/simple.el

index 3e5042a0f91c37352a30660863a765ffcd7de830..89f463a2fb0f5ed190d21342092ea7a755119b51 100644 (file)
@@ -1,3 +1,12 @@
+2014-08-05  Eli Zaretskii  <eliz@gnu.org>
+
+       * 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  <eliz@gnu.org>
 
        * tutorial.el (tutorial--display-changes): Accept punctuation
index d7f5b41830249b7b5c23ded5d9ce9210b12cbec0..1a42db816696f806f44c12223aea35902064ec37 100644 (file)
@@ -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)