Reverse scroll-wrap's logic

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>
This commit is contained in:
Benoît Knecht 2012-12-06 10:57:04 +01:00 committed by Sebastian Ramacher
parent 824843a917
commit c06d353eb7

View File

@ -422,20 +422,20 @@ sc_navigate(girara_session_t* session, girara_argument_t* argument,
t = (t == 0) ? (unsigned int) offset : t; t = (t == 0) ? (unsigned int) offset : t;
if (argument->n == NEXT) { if (argument->n == NEXT) {
if (scroll_wrap == true) { if (scroll_wrap == false) {
new_page = new_page + t; new_page = new_page + t;
} else { } else {
new_page = (new_page + t) % number_of_pages; new_page = (new_page + t) % number_of_pages;
} }
} else if (argument->n == PREVIOUS) { } else if (argument->n == PREVIOUS) {
if (scroll_wrap == true) { if (scroll_wrap == false) {
new_page = new_page - t; new_page = new_page - t;
} else { } else {
new_page = (new_page + number_of_pages - t) % number_of_pages; new_page = (new_page + number_of_pages - t) % number_of_pages;
} }
} }
if (scroll_wrap == true && (new_page < 0 || new_page >= number_of_pages)) { if ((new_page < 0 || new_page >= number_of_pages) && !scroll_wrap) {
return false; return false;
} }