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>
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>
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>
If we have already requested a page to be rendered, we don't have to request it
once again.
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
According to my compiler output and the page on glib deprecated APIs
[1], some of the stuff needed to be removed or changed.
[1] - http://developer.gnome.org/glib/2.31/glib-Deprecated-Thread-APIs.html
Signed-off-by: Ignas Anikevicius (gns_ank) <anikevicius@gmail.com>
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
A rectangle whose horizontal coordinates are x1 on the left and x2 on
the right is (x2 + 1) - x1 pixels wide, not x2 - x1.
This error caused the search result highlighting to leave a
one-pixel-wide border behind, on the right and bottom side of the
result.
See issue 242 <http://bugs.pwmt.org/issue242>.
Reported-by: Abdó Roig <abdo.roig@gmail.com>
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
There was a problem passing colors to cairo_set_source_rgb.
Should be floats between 0 and 1.
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>