This uses the jumplist to implement a bisect functionality between the
last two jump points. ^j and ^k are bound to bisect forward and backward
respectively.
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
Call cb_view_hadjustment_changed to set horizontal position in
navigation shortcuts: sc_navigate, sc_goto.
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
This will not scroll the document when pressing 'f' or 'F', just to make the
behavior consistent with activating the inputbar using ':'.
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
Add a new adjust mode that is set when focusing the inputbar and
disables adjusting the vertical scrollbar. As a result, focusing the
inputbar doesn't scroll the document, leading to better results when
changing pages from the inputbar (e.g. using bookmarks).
Reported-by: Marwan Tanager <marwan.tngr@gmail.com>
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
Instead of guesstimating the values of the scrollbars adjustments after
a change in zoom level, connect callbacks to the "changed" GtkAdjustment
event (which is emitted when the bounds or page_size of the adjustment
change, e.g. when the zoom level changes), and compute the new values
from there.
The previous adjustment values are tracked in zathura->ui.hadjustment
and zathura->ui.vadjustment (and updated by signal handlers as well), so
that the view's position can be maintained while zooming.
cb_view_hadjustment_changed() centers the page horizontally if a
"best-fit" or "width" zoom is being performed, or if "zoom-center" is
true; otherwise, it keeps the view horizontally centered around the same
area of the page.
cb_view_vadjustment_changed() always keeps the view vertically centered
around the same area of the page.
Many thanks to Marwan Tanager for thoroughly reviewing the various
stages of this patch, and actually coming up with a working solution.
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
This wasn't correct. Padding is already accounted for:
scale = (width - (pages_per_row - 1) * padding) /
(pages_per_row * cell_width)
If you add padding on the denominator, you end up with black margins on
the sides of the window, which isn't what padding is for (i.e. insert a
gap between rendered pages), and defeats the purpose of a "best-fit".
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
If '--page [number]' (or '-P [number]') is given on the command-line,
the document is opened at the specified page number. Negative numbers
are allowed, and denote a page number starting from the end of the
document.
See issue 275 <http://bugs.pwmt.org/issue275>.
Reported-by: bob <sean258@gmail.com>
The width of the vertical scrollbar (if there is one) needs to be
substracted from the width of the GtkScrolledWindow in order to obtain
the correct dimensions of the view area.
See issue 27 <http://bugs.pwmt.org/issue27>.
It also deals better with documents where pages don't all have the same
size.
Reported-by: Andreas Weinlich <business@weinlich.org>
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
This is useful when the text of the link doesn't match its target. The
default key is set to 'F'.
See issue 266 <http://bugs.pwmt.org/issue266>.
Reported-by: Iron <o380770@rtrtr.com>
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
The scroll-wrap option used to only change the behavior of 'J' and 'K'
(i.e. moving one page forward/backward).
Now, if scroll-wrap is true and the top of the first page is shown,
pressing 'k' will show the bottom of the last page; conversely, when at
the bottom of the last page, pressing 'j' will show the top of the first
page.
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
When set to true, it used to _not_ wrap around the begining/end. Now it
wraps if set to true, and it doesn't if set to false.
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
if scroll-page-aware is set, scrolling by full and half pages stops at
page boundaries (as djview4 does it on <space> and <backspace>).
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
zathura records jumps through searches, index, links, etc. and enables to go
back and forth via ^o ^i.
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
There are two causes of the problem:
- page_ratio should be defined differently
This is because the usefull page ratio is max_height/total_width
or max_width/total_height. This then changes accordingly if
pages_per_row != 1, otherwise, if the pages are of the same
size, the page ratios will not change, which screws up the
resizing.
- Sometimes we need to do height or width division diferently.
This is because not always total_height or total_width is
meaningful in BESTFIT condition.
This commit also should fix the bug #0000226.
Signed-off-by: Ignas Anikevicius (gns_ank) <anikevicius@gmail.com>
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
1) zoom-center :: bool
zoom-center = false
If zoom-center = false nothing changes.
If zoom-center = true zooming respects the horizontal center of the
pageview. That is, the vertical line dividing the displayed part of
the document doesn't move within the document.
Reasoning: When viewing a pdf with a margin we usually want to hide the
margin at both sides by zooming in.
2) scroll-hstep :: float
scroll-hstep = -1
If scroll-hstep < 0 nothing changes.
If scroll-hstep >= 0 then scroll-hstep defines the scroll step in the
horizontal direction.
Reasoning: This allows us to make finer adjustments in the horizontal
direction without the mouse and without loosing the ablility to
navigate quickly through the document.
3) search-hadjust :: bool
search-hadjust = true
If search-hadjust = true nothing changes.
If search-hadjust = false searching does not adjust the horizontal
center of the document when showing search results.
Reasoning: When viewing a pdf with a margin we usually want to hide
the margin at both sides by zooming in. The horizontal adjustment
sometimes hides parts of the document by moving the horizontal
center.