summaryrefslogtreecommitdiff
path: root/lisp/pdf-isearch.el
diff options
context:
space:
mode:
authorIllia Ostapyshyn <ilya.ostapyshyn@gmail.com>2021-05-30 13:04:00 +0200
committerVedang Manerikar <ved.manerikar@gmail.com>2021-05-31 09:22:14 +0530
commit3e1d740dee85c42cc55b1bff552c4e098e2638d3 (patch)
treefe2d3f79c7563c4b93b30a87e56fd01b71d49ad7 /lisp/pdf-isearch.el
parente1ad5b1d0468934aaa11c445cf98303092ac5304 (diff)
Explicitly pass width through `pdf-view-create-image`
This is to avoid repeatedly scaling the displayed image width when applying highlighting. Fixes #19. Closes #22. As it turns out, it wasn't only `isearch` and `occur` which were broken, but everything that includes highlighting: selection and jump to annotation (`C-c C-a l SPC`) as well. The behavior was caused by passing the value of `(pdf-view-image-size)` into the highlight functions (`pdf-info-renderpage-text-regions` and `pdf-info-renderpage-highlight`) and using the result as it is, without re-adjusting the displayed image width as it's done when displaying raw pages without any highlighted elements, see [this line](https://github.com/vedang/pdf-tools/blob/df2eea87aa84711024b48b2184b1c1ca1b2d0e7b/lisp/pdf-view.el#L935) This caused the image width to be multiplied with the `frame-scale-factor` in `pdf-info-renderpage` and the width of the returned raw image to be interpreted by `create-image` as the requested width of the image as seen in the buffer. Fixed by passing the width explicitly in every call to `pdf-view-create-image`, except for [this one](https://github.com/vedang/pdf-tools/blob/df2eea87aa84711024b48b2184b1c1ca1b2d0e7b/lisp/pdf-annot.el#L1365), which seems to be responsible for latex fragment rendering.
Diffstat (limited to 'lisp/pdf-isearch.el')
-rw-r--r--lisp/pdf-isearch.el2
1 files changed, 1 insertions, 1 deletions
diff --git a/lisp/pdf-isearch.el b/lisp/pdf-isearch.el
index 563e721..5225395 100644
--- a/lisp/pdf-isearch.el
+++ b/lisp/pdf-isearch.el
@@ -742,7 +742,7 @@ MATCH-BG LAZY-FG LAZY-BG\)."
occur-hack-p)
(eq page (pdf-view-current-page)))
(pdf-view-display-image
- (pdf-view-create-image data))))))))
+ (pdf-view-create-image data :width width))))))))
(pdf-info-renderpage-text-regions
page width t nil
`(,fg1 ,bg1 ,@(pdf-util-scale-pixel-to-relative