From 3f7dd3fe3e4ebd99d79e3c5028051108412147b2 Mon Sep 17 00:00:00 2001 From: Jinhao Date: Sat, 3 Feb 2018 06:28:25 +0800 Subject: [PATCH] fix bug of scroll.make_page_scroll --- include/nana/gui/widgets/scroll.hpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/include/nana/gui/widgets/scroll.hpp b/include/nana/gui/widgets/scroll.hpp index 0603c308..f06ef8e0 100644 --- a/include/nana/gui/widgets/scroll.hpp +++ b/include/nana/gui/widgets/scroll.hpp @@ -1,7 +1,7 @@ /** * A Scroll Implementation * Nana C++ Library(http://www.nanapro.org) - * Copyright(C) 2003-2015 Jinhao(cnjinhao@hotmail.com) + * Copyright(C) 2003-2018 Jinhao(cnjinhao@hotmail.com) * * Distributed under the Boost Software License, Version 1.0. * (See accompanying file LICENSE_1_0.txt or copy at @@ -147,7 +147,7 @@ namespace nana void step(size_type s) { - metrics_.step = s; + metrics_.step = (s ? s : 1); } bool make_step(bool forward, unsigned multiple) @@ -501,7 +501,8 @@ namespace nana /// @return true if the vlaue is changed. bool make_page_scroll(bool forward) { - return this->make_step(forward, static_cast(range() - 1)); + auto const count = range() / step(); + return this->make_step(forward, (count > 2 ? count - 1 : 1)); } };//end class scroll }//end namespace nana