Commit graph

1717 commits

Author SHA1 Message Date
Marwan Tanager
afd008f466 Enhancements/Cleanups for the jumplist mechansim
- Don't delete the elements on the right of the current one, when
	  appending a new jump to the jumplist, because this makes no sense at
	  all; the point of the jumplist in the first place is to remember
	  previously jumped-to positions in the document, so there is no need
	  to delete anythings except to trim the oldest entries from the
	  beginning to maintain the maximum size. This also makes us compatible
	  with the Vim way of doing things.

	- Make the jumplist mechanism functional on the same page; if we
	  followed a link to a target on the same page, remember the
	  adjustments before and after following the link. The same holds for
	  navigating search results on the same page.

	- Implement position_set and use it instead of position_set_delayed
	  when following links in order to give zathura_jumplist_save a chance
	  to record the exact adjustments of the link target. Otherwise, it
	  will always record the adjustments after going to the target page,
	  but before going to the exact position within it.

	- Don't consider movements with ^i and ^o as jumps :)

	- Don't use page_set followed by setting the adjustments in
	  sc_jumplist, because this is redundant and causes clutter when using
	  ^i and ^o, as the adjustments is set twice this way (once in page_set
	  and again in position_set_delayed).  It's enough to only update the
	  page number on the statusbar and then set the adjustments.

	- Hide implementation details (zathura_jumplist_save and
	  zathura_jumplist_append), and make things more consistent by
	  exporting and using only zathura_jumplist_add for adding new entries.

The end result: A more slick jumping experience :-)

Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-06-10 14:48:10 +02:00
Marwan Tanager
88bff5dfd2 Include backward-search commands in the history plain database
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-06-10 14:38:34 +02:00
Marwan Tanager
cc3b9aea18 More Vim-like search behavior
This patch activates the last aborted search when pressing the search shortcuts
('n' or 'N').

To avoid confusion, and to make things more predictable, I've chosen to always
reactivate an aborted search starting from the beginning (or end, in case of
'N' or '?') of the current page, as opposed to Vim which continues from the
next search term each time the search is reactivated.

Searching using '/' or '?' doesn't center the view at the current search term
like when using 'n' or 'N', so we fix this here.

Also, I managed to work around the issue of the thin rectangular margins that
show around the previously-highlighted search terms after the search is aborted
(either explicitly or as a result of following links), by redrawing the page
widget (only if it's visible) instead of redrawing the rectangles covering the
highlighted search terms.

Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-06-10 14:35:19 +02:00
Marwan Tanager
463545c3a3 Document the new show-{h, v}-scrollbar settings
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-06-02 11:45:37 +02:00
Marwan Tanager
2d9ea08729 Use show-v-scrollbar instead of show-scrollbars
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-06-02 11:45:26 +02:00
Moritz Lipp
df466eeeb2 Fix 2013-05-28 23:39:18 +02:00
Moritz Lipp
cdece59229 Fix previous commit 2013-05-28 18:12:15 +02:00
Moritz Lipp
cf96d52790 Report missing plugin/unsupported file type 2013-05-28 17:00:37 +02:00
Moritz Lipp
b17c05c960 Merge branch 'develop' 2013-05-12 23:28:29 +02:00
Moritz Lipp
e0efd8ab1e Version 0.2.3 2013-05-12 23:28:20 +02:00
Moritz Lipp
fba01633c7 Merge branch 'develop' of pwmt.org:zathura into develop 2013-05-08 18:29:03 +02:00
Moritz Lipp
87f10baffc Allow negative offsets 2013-05-08 18:28:32 +02:00
Sebastian Ramacher
7ebf15543b Use strrchr in file_get_extension
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-05-04 19:33:14 +02:00
Sebastian Ramacher
5bc7c7212d Update desktop translations
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-05-04 17:08:43 +02:00
Sebastian Ramacher
9bc82e2d7d Update translations 2013-05-04 15:37:12 +02:00
Sebastian Ramacher
ad9edf5ea2 Update translations
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-04-28 14:49:40 +02:00
Moritz Lipp
c07e7a0c39 Unref page twice (Temporary fix #274) 2013-04-17 13:42:03 +02:00
Sebastian Ramacher
fb734b48a6 Document notification-{fg,bg}
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-04-08 21:53:15 +02:00
Abdo Roig-Maranges
5563da4d91 also adjust the horizontal position in sc_bisect
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-04-02 21:46:55 +02:00
Abdo Roig-Maranges
f8b24b0331 Document new bisect functionality
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-04-02 21:22:20 +02:00
Abdo Roig-Maranges
49e5b053bf bisect functionality to navigate documents
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>
2013-04-02 21:22:20 +02:00
Abdo Roig-Maranges
d05ecc3043 added function to check whether current jump is first or last
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-04-02 21:22:20 +02:00
Abdo Roig-Maranges
1c3274bbd6 properly set horizontal position when navigating
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>
2013-04-02 20:52:46 +02:00
Abdó Roig-Maranges
8e9631946d Option to keep horizontal position when following internal links
Added config parameter "link-hadjust" with default value true. When set to false,
following internal links do not change the horizontal position of the page, only
the vertical position.

Also updates page number when following links, now.

Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-04-02 14:30:44 +02:00
Sebastian Ramacher
71680394a7 Fix some types
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-04-02 11:39:06 +02:00
Marwan Tanager
1a145c5166 Use the 64-bit variants of g_param_spec_int and g_value_set_int for installing and accessing the last-view property.
This fixes the bug of the page cache acting weird (e.g. the same cache index is
invalidated over and over again) after being used for some time. This is
because when we read the last-view property, we only get the least-significant
32 bits of the last_view private member.

Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-04-01 18:18:07 +02:00
Marwan Tanager
964bdde27f Use gint64 for view time instead of guint64.
The last_view member in zathura_page_widget_private_s is gint64, so we should
do the same here.

Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-03-29 18:33:15 +01:00
Marwan Tanager
8f695b8c52 Set the adjustment mode to ZATHURA_ADJUST_INPUTBAR before displaying or following links.
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>
2013-03-29 18:33:15 +01:00
Marwan Tanager
cd381c813d Don't set visibility, update view time, or lookup the cache, if the page is already visible.
This also has the side effect of not flooding the console with debug messages
on every change of the vertical adjustment as a result of redundant cache
lookups.

Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-03-29 18:33:15 +01:00
Sebastian Ramacher
9a00028a0d Remove some unnecessary \ns
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-03-26 15:21:03 +01:00
Sebastian Ramacher
4b7347efa7 We get an int from girara_config_get
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-03-26 13:03:07 +01:00
Sebastian Ramacher
ca2d279d10 Update translations
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-03-26 12:55:28 +01:00
Sebastian Ramacher
1440b45299 Make sure that the page size is positive
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-03-26 12:53:16 +01:00
Marwan Tanager
cb18fe8603 Replace the periodic page reclaiming code with a LRU caching algorithm.
This patch implements a page cache that is invalidated in a LRU fashion.

Pages are added to the cache as soon as they become visible. When the cache is
full and a new page that isn't in the cache becomes visible, the least recently
viewed page in the cache is evicted from memory and the new one takes it's
place.

The cache size is configurable using the page-cache-size configuration
variable, with a default value of 15 pages. Very large values for the cache
size are not recommended, though, as it will stress the system memory out.

The old periodic page reclaiming code is no longer necessary with this patch,
so I removed it.

Special thanks to Ignas Anikevičius, and Sebastian Ramacher for the
inspirations.

Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-03-26 12:45:43 +01:00
Sebastian Ramacher
cd3314b490 Save some string copies
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-03-25 02:58:37 +01:00
Marwan Tanager
e7cbd25be0 Don't render if the new surface passed to zathura_page_widget_update_surface is NULL.
I don't see any reason for queueing a redraw if the new surface is NULL.

Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-03-24 15:42:27 +01:00
Sebastian Ramacher
9c1503809a CS
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-03-23 16:12:38 +01:00
Benoît Knecht
1702fb620a Don't scroll the document when focusing the inputbar
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>
2013-03-23 16:03:11 +01:00
Benoît Knecht
c9eef95492 Use signals to readjust_view_after_zooming()
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>
2013-03-23 16:02:56 +01:00
Benoît Knecht
f5b02a9751 Revert commit ce6e735
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>
2013-03-23 16:02:56 +01:00
Sebastian Ramacher
9b1a037fe0 Merge branch 'history-io' into develop 2013-03-17 16:25:19 +01:00
Sebastian Ramacher
c20b5e25c7 Use the correct command history
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-03-17 16:25:02 +01:00
Sebastian Ramacher
92f8784605 Implement input history IO in plain database
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-03-17 16:19:10 +01:00
Benoît Knecht
f4b17f3389 Add 'q' and 'BackSpace' shortcuts in fullscreen mode
Now by default, 'q' quits zathura even in fullscreen mode, and
'BackSpace' does the reverse of 'space', i.e. go back one page.

Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-03-17 14:15:11 +01:00
Benoît Knecht
e13ae4cfb7 Update French translation
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-03-17 14:15:00 +01:00
Benoît Knecht
ea6fa95074 Update translations
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-03-17 14:14:35 +01:00
Benoît Knecht
27c291758e Add a '--page' option to open at the specified page
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>
2013-03-17 11:30:22 +01:00
Sebastian Ramacher
fd07d3f5cf Merge branch 'develop' of pwmt.org:zathura into develop 2013-03-14 22:41:57 +01:00
Sebastian Ramacher
47eddd0e86 Implement sqlite backend for input history
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-03-14 22:20:51 +01:00
Sebastian Ramacher
b5dbe9ff6d Drop zathura_db_free
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-03-14 21:30:40 +01:00