From db005007cf3c951ace57b1810b30248fe371e4be Mon Sep 17 00:00:00 2001 From: ailin-nemui Date: Wed, 26 Sep 2018 14:16:09 +0200 Subject: [PATCH] fix irssi being stuck when resized very small --- src/fe-text/mainwindows.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/fe-text/mainwindows.c b/src/fe-text/mainwindows.c index 83a3e0cc..68cb9880 100644 --- a/src/fe-text/mainwindows.c +++ b/src/fe-text/mainwindows.c @@ -285,8 +285,13 @@ static MAIN_WINDOW_REC *mainwindows_find_lower(MAIN_WINDOW_REC *window) MAIN_WINDOW_REC *best; GSList *tmp; + /* unfortunate special case: if the window has been resized + and there is not enough room, the last_line could become + smaller than the first_line, sending us in an infinite + loop */ if (window != NULL) - last_line = window->last_line; + last_line = + window->last_line > window->first_line ? window->last_line : window->first_line; else last_line = -1;