From a8978726b6879529ea5bdbae73f03a9a46f1f111 Mon Sep 17 00:00:00 2001 From: Dennis Kaarsemaker Date: Wed, 27 Apr 2016 21:59:50 +0200 Subject: [PATCH] Add an option to create windows at the end I prefer to group my windows by topic, with occasional gaps between them to start the next group at a multiple of 10. This new option avoids irssi filling those gaps. --- src/fe-common/core/fe-windows.c | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/src/fe-common/core/fe-windows.c b/src/fe-common/core/fe-windows.c index 46c1593b..ee3b8d0b 100644 --- a/src/fe-common/core/fe-windows.c +++ b/src/fe-common/core/fe-windows.c @@ -49,16 +49,28 @@ static int window_get_new_refnum(void) refnum = 1; tmp = windows; - while (tmp != NULL) { - win = tmp->data; - - if (refnum != win->refnum) { + if(settings_get_bool("window_create_at_end")) { + while (tmp != NULL) { + win = tmp->data; + if(win->refnum > refnum) + refnum = win->refnum; tmp = tmp->next; - continue; } refnum++; - tmp = windows; + } + else { + while (tmp != NULL) { + win = tmp->data; + + if (refnum != win->refnum) { + tmp = tmp->next; + continue; + } + + refnum++; + tmp = windows; + } } return refnum; @@ -712,6 +724,7 @@ void windows_init(void) daycheck = 0; daytag = -1; settings_add_bool("lookandfeel", "window_auto_change", FALSE); settings_add_bool("lookandfeel", "windows_auto_renumber", TRUE); + settings_add_bool("lookandfeel", "window_create_at_end", FALSE); settings_add_bool("lookandfeel", "window_check_level_first", FALSE); settings_add_level("lookandfeel", "window_default_level", "NONE");