From 2968d45f82bfba65efffb5dab4e659f13172653a Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Thu, 8 Mar 2001 00:27:40 +0000 Subject: [PATCH] /SET scroll_page_count - don't crash if /0 is given. Works now properly if /0.xx is given. git-svn-id: http://svn.irssi.org/repos/irssi/trunk@1364 dbcabf3a-b0e7-0310-adc4-f8d773084564 --- src/fe-text/gui-readline.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/fe-text/gui-readline.c b/src/fe-text/gui-readline.c index f2b18ab9..d7b2d29f 100644 --- a/src/fe-text/gui-readline.c +++ b/src/fe-text/gui-readline.c @@ -93,15 +93,18 @@ static void handle_entry_redirect(const char *line) static int get_scroll_count(void) { const char *str; - int count; + double count; str = settings_get_str("scroll_page_count"); - count = atoi(str + (*str == '/')); - if (count < 0) count = 1; - + count = atof(str + (*str == '/')); + if (count <= 0) + count = 1; + else if (count < 1) + count = 1.0/count; + if (*str == '/') count = WINDOW_GUI(active_win)->parent->lines/count; - return count; + return (int)count; } static void window_prev_page(void)