aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEli Zaretskii2014-08-05 16:34:06 +0300
committerEli Zaretskii2014-08-05 16:34:06 +0300
commit5818408f5029ae6c26fa329104d1126b2322b356 (patch)
treeea4152b1d4937d16b46361040038277dd9877344
parent1d58ab89ca6eb1f87a812e23ffca210e15c4fb5f (diff)
downloademacs-5818408f5029ae6c26fa329104d1126b2322b356.tar.gz
emacs-5818408f5029ae6c26fa329104d1126b2322b356.zip
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.
-rw-r--r--lisp/ChangeLog9
-rw-r--r--lisp/simple.el7
2 files changed, 12 insertions, 4 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 3e5042a0f91..89f463a2fb0 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,12 @@
12014-08-05 Eli Zaretskii <eliz@gnu.org>
2
3 * simple.el (default-line-height): A floating-point value of
4 line-spacing means a fraction of the default frame font's height,
5 not of the font currently used by the 'default' face. Truncate
6 the pixel value, like the display engine does.
7 (window-screen-lines): Use window-inside-pixel-edges for
8 determining the window height in pixels. (Bug#18195)
9
12014-07-29 Eli Zaretskii <eliz@gnu.org> 102014-07-29 Eli Zaretskii <eliz@gnu.org>
2 11
3 * tutorial.el (tutorial--display-changes): Accept punctuation 12 * 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."
5038 0) 5038 0)
5039 0))) 5039 0)))
5040 (if (floatp lsp) 5040 (if (floatp lsp)
5041 (setq lsp (* dfh lsp))) 5041 (setq lsp (truncate (* (frame-char-height) lsp))))
5042 (+ dfh lsp))) 5042 (+ dfh lsp)))
5043 5043
5044(defun window-screen-lines () 5044(defun window-screen-lines ()
@@ -5050,10 +5050,9 @@ in the window, not in units of the frame's default font, and also accounts
5050for `line-spacing', if any, defined for the window's buffer or frame. 5050for `line-spacing', if any, defined for the window's buffer or frame.
5051 5051
5052The value is a floating-point number." 5052The value is a floating-point number."
5053 (let ((canonical (window-text-height)) 5053 (let ((edges (window-inside-pixel-edges))
5054 (fch (frame-char-height))
5055 (dlh (default-line-height))) 5054 (dlh (default-line-height)))
5056 (/ (* (float canonical) fch) dlh))) 5055 (/ (float (- (nth 3 edges) (nth 1 edges))) dlh)))
5057 5056
5058;; Returns non-nil if partial move was done. 5057;; Returns non-nil if partial move was done.
5059(defun line-move-partial (arg noerror to-end) 5058(defun line-move-partial (arg noerror to-end)