From 5dc8a629877b040a5dd5904815ed885949614948 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Wed, 17 Jul 2013 19:47:49 +0300 Subject: [PATCH] Fix bug #14881 with scrolling images smaller than the window height. lisp/simple.el (line-move-partial, line-move): Don't start vscroll or scroll-up if the current line is not taller than the window. --- lisp/ChangeLog | 6 ++++++ lisp/simple.el | 15 ++++++++++----- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index b88f66f98d0..25fd3e6171e 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,9 @@ +2013-07-17 Eli Zaretskii + + * simple.el (line-move-partial, line-move): Don't start vscroll or + scroll-up if the current line is not taller than the window. + (Bug#14881) + 2013-07-16 Dmitry Gutov * progmodes/ruby-mode.el (ruby-font-lock-keywords): Do not diff --git a/lisp/simple.el b/lisp/simple.el index bcce938df73..4b158d31f36 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -4800,6 +4800,8 @@ The value is a floating-point number." (this-ypos (nth 2 this-lh)) (dlh (default-line-height)) (wslines (window-screen-lines)) + (edges (window-inside-pixel-edges)) + (winh (- (nth 3 edges) (nth 1 edges) 1)) py vs last-line) (if (> (mod wslines 1.0) 0.0) (setq wslines (round (+ wslines 0.5)))) @@ -4848,7 +4850,7 @@ The value is a floating-point number." nil) ;; If cursor is not in the bottom scroll margin, and the ;; current line is is not too tall, move forward. - ((and (or (null this-height) (<= this-height dlh)) + ((and (or (null this-height) (<= this-height winh)) vpos (> vpos 0) (< py last-line)) @@ -4865,7 +4867,7 @@ The value is a floating-point number." (> vpos 0) (= py last-line)) ;; Don't vscroll if the partially-visible line at window - ;; bottom has the default height (a.k.a. "just one more text + ;; bottom is not too tall (a.k.a. "just one more text ;; line"): in that case, we do want redisplay to behave ;; normally, i.e. recenter or whatever. ;; @@ -4874,7 +4876,7 @@ The value is a floating-point number." ;; partially-visible glyph row at the end of the window. As ;; we are dealing with floats, we disregard sub-pixel ;; discrepancies between that and DLH. - (if (and rowh rbot (>= (- (+ rowh rbot) dlh) 1)) + (if (and rowh rbot (>= (- (+ rowh rbot) winh) 1)) (set-window-vscroll nil dlh t)) (line-move-1 arg noerror to-end) t) @@ -4918,10 +4920,13 @@ The value is a floating-point number." ;; If we moved into a tall line, set vscroll to make ;; scrolling through tall images more smooth. (let ((lh (line-pixel-height)) - (dlh (default-line-height))) + (edges (window-inside-pixel-edges)) + (dlh (default-line-height)) + winh) + (setq winh (- (nth 3 edges) (nth 1 edges) 1)) (if (and (< arg 0) (< (point) (window-start)) - (> lh dlh)) + (> lh winh)) (set-window-vscroll nil (- lh dlh) t)))) -- 2.39.2