1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-11-26 07:33:47 +00:00

Adapt doc-view to latest image-mode changes

The functions image-scroll-down, image-scroll-up, image-next-line, and
image-previous-line now return pixel values instead of multiples of
character height as of commit 9c66b09950.

* lisp/doc-view.el (doc-view-scroll-up-or-next-page):
(doc-view-scroll-down-or-previous-page):
(doc-view-next-line-or-next-page):
(doc-view-previous-line-or-previous-page):
(doc-view-insert-image): Adapt to image-scroll-up/down and
image-next/previous-line now returning pixel values instead of
multiples of character heights.  Fixes bug#37874.
This commit is contained in:
Tassilo Horn 2019-10-25 22:07:39 +02:00
parent 25ed447b7b
commit a0f7ea5999

View File

@ -598,7 +598,7 @@ Otherwise, goto next page only on typing SPC (ARG is nil)."
(if (or doc-view-continuous (null arg))
(let ((hscroll (window-hscroll))
(cur-page (doc-view-current-page)))
(when (= (window-vscroll) (image-scroll-up arg))
(when (= (window-vscroll nil t) (image-scroll-up arg))
(doc-view-next-page)
(when (/= cur-page (doc-view-current-page))
(image-bob)
@ -615,7 +615,7 @@ Otherwise, goto previous page only on typing DEL (ARG is nil)."
(if (or doc-view-continuous (null arg))
(let ((hscroll (window-hscroll))
(cur-page (doc-view-current-page)))
(when (= (window-vscroll) (image-scroll-down arg))
(when (= (window-vscroll nil t) (image-scroll-down arg))
(doc-view-previous-page)
(when (/= cur-page (doc-view-current-page))
(image-eob)
@ -631,7 +631,7 @@ at the bottom edge of the page moves to the next page."
(if doc-view-continuous
(let ((hscroll (window-hscroll))
(cur-page (doc-view-current-page)))
(when (= (window-vscroll) (image-next-line arg))
(when (= (window-vscroll nil t) (image-next-line arg))
(doc-view-next-page)
(when (/= cur-page (doc-view-current-page))
(image-bob)
@ -647,7 +647,7 @@ at the top edge of the page moves to the previous page."
(if doc-view-continuous
(let ((hscroll (window-hscroll))
(cur-page (doc-view-current-page)))
(when (= (window-vscroll) (image-previous-line arg))
(when (= (window-vscroll nil t) (image-previous-line arg))
(doc-view-previous-page)
(when (/= cur-page (doc-view-current-page))
(image-eob)
@ -1429,7 +1429,7 @@ ARGS is a list of image descriptors."
(vscroll (image-mode-window-get 'vscroll win)))
;; Reset scroll settings, in case they were changed.
(if hscroll (set-window-hscroll win hscroll))
(if vscroll (set-window-vscroll win vscroll)))))))))
(if vscroll (set-window-vscroll win vscroll t)))))))))
(defun doc-view-sort (a b)
"Return non-nil if A should be sorted before B.