[prev in list] [next in list] [prev in thread] [next in thread]
List: elinks-dev
Subject: [elinks-dev] [PATCH 2/2] Add
From: Fabienne Ducroquet <fabiduc () gmail ! com>
Date: 2010-08-14 19:24:21
Message-ID: 1281813861-907-3-git-send-email-fabiduc () gmail ! com
[Download RAW message or body]
Add an option to specify the number of overlapping lines when scrolling
page by page (0 by default because this is ELinks' current behaviour).
Signed-off-by: Fabienne Ducroquet <fabiduc@gmail.com>
---
src/config/options.inc | 5 +++++
src/viewer/text/view.c | 14 ++++++++++----
2 files changed, 15 insertions(+), 4 deletions(-)
diff --git a/src/config/options.inc b/src/config/options.inc
index 0448f90..a267abf 100644
--- a/src/config/options.inc
+++ b/src/config/options.inc
@@ -397,6 +397,11 @@ static struct option_info config_options_info[] = {
N_("Number of lines to scroll when a key bound to scroll-up "
"or scroll-down is pressed and no prefix was given.")),
+ INIT_OPT_INT("document.browse.scrolling", N_("Vertical overlap"),
+ "vertical_overlap", 0, 0, 10, 0,
+ N_("Number of overlapping lines between the new page displayed "
+ "and the previous one when scrolling one page up or down.")),
+
INIT_OPT_TREE("document.browse", N_("Searching"),
"search", 0,
diff --git a/src/viewer/text/view.c b/src/viewer/text/view.c
index e4a9648..9bd9436 100644
--- a/src/viewer/text/view.c
+++ b/src/viewer/text/view.c
@@ -94,7 +94,10 @@ move_down(struct session *ses, struct document_view *doc_view, int \
type, int ove
assert(ses->navigate_mode == NAVIGATE_LINKWISE); /* XXX: drop it at some time. \
--Zas */
- newpos = doc_view->vs->y + doc_view->box.height - overlap;
+ if (overlap < doc_view->box.height)
+ newpos = doc_view->vs->y + doc_view->box.height - overlap;
+ else
+ newpos = doc_view->vs->y + doc_view->box.height;
if (newpos < doc_view->document->height)
doc_view->vs->y = newpos;
@@ -126,7 +129,7 @@ move_part_page_down(struct session *ses, struct document_view \
*doc_view, int ove enum frame_event_status
move_page_down(struct session *ses, struct document_view *doc_view)
{
- return move_part_page_down(ses, doc_view, 0);
+ return move_part_page_down(ses, doc_view, \
get_opt_int("document.browse.scrolling.vertical_overlap", ses)); }
enum frame_event_status
@@ -147,7 +150,10 @@ move_up(struct session *ses, struct document_view *doc_view, int \
type, int overl
if (doc_view->vs->y == 0) return;
- doc_view->vs->y -= (doc_view->box.height - overlap);
+ if (overlap < doc_view->box.height)
+ doc_view->vs->y -= (doc_view->box.height - overlap);
+ else
+ doc_view->vs->y -= doc_view->box.height;
int_lower_bound(&doc_view->vs->y, 0);
@@ -178,7 +184,7 @@ move_part_page_up(struct session *ses, struct document_view \
*doc_view, int overl enum frame_event_status
move_page_up(struct session *ses, struct document_view *doc_view)
{
- return move_part_page_up(ses, doc_view, 0);
+ return move_part_page_up(ses, doc_view, \
get_opt_int("document.browse.scrolling.vertical_overlap", ses)); }
enum frame_event_status
--
1.7.1
_______________________________________________
elinks-dev mailing list
elinks-dev@linuxfromscratch.org
http://linuxfromscratch.org/mailman/listinfo/elinks-dev
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic