From 40bfc729cafde4ea7a357e0372e9b2133af28687 Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Sun, 31 May 2015 08:45:17 +0000 Subject: [PATCH] Preventing a floating-point exception when the available length for an answer becomes zero. The answer will instead wrap to the next line, which does not look nice but is better than crashing. Patch by Mahyar Abbaspour. git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5235 35c25a1d-7b9e-4130-9fde-d3aeb78583b8 --- ChangeLog | 4 ++++ src/prompt.c | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 9b68f4cb..f64e2941 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2015-05-31 Mahyar Abbaspour + * src/prompt.c (get_statusbar_page_start): Prevent a floating-point + exception when the available length for an answer becomes zero. + 2015-05-28 Benno Schulenberg * src/help.c (do_help), src/prompt.c (do_yesno_prompt): Normalize the whitespace after the recent changes in logic. diff --git a/src/prompt.c b/src/prompt.c index 671d53ac..61c4347f 100644 --- a/src/prompt.c +++ b/src/prompt.c @@ -650,7 +650,7 @@ size_t statusbar_xplustabs(void) * get_statusbar_page_start(column) < COLS). */ size_t get_statusbar_page_start(size_t start_col, size_t column) { - if (column == start_col || column < COLS - 1) + if (column == start_col || column < COLS - 1 || COLS == start_col + 1) return 0; else return column - start_col - (column - start_col) % (COLS - -- 2.39.5