From 8cdc62ae0d3ee2e2f1d4a88043cce81f54a45181 Mon Sep 17 00:00:00 2001 From: Kevin Easton Date: Wed, 3 Jun 2015 23:16:57 +1000 Subject: [PATCH] Wire up /SET DOUBLE_STATUS_LINES so it actually does something The DOUBLE_STATUS_LINES /SET has existed for a long while, but setting it has never actually had an effect. This change causes it to affect the /window double setting of new windows: 0 means new windows are created without double status lines, 1 means only the first window is created with double status lines and subsequent windows aren't (this is the default) and 2 means that all windows are created with double status lines. Note that setting this variable in your .ircrc can't actually affect the first window, because that's created before the .ircrc is loaded. The compiled-in default value (DEFAULT_DOUBLE_STATUS_LINES in config.h) is the only thing that can affect the first window. Reported by presi. --- include/config.h | 2 +- source/vars.c | 2 +- source/window.c | 20 +++++++++++++------- 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/include/config.h b/include/config.h index 170ebcb..e63c6f8 100644 --- a/include/config.h +++ b/include/config.h @@ -414,7 +414,7 @@ #define DEFAULT_DCC_AUTORESUME OFF #define DEFAULT_DCC_AUTORENAME_ON_NICKNAME OFF #define DEFAULT_DCC_BAR_TYPE 0 /* 0 or 1 */ -#define DEFAULT_DOUBLE_STATUS_LINE ON +#define DEFAULT_DOUBLE_STATUS_LINE 1 /* 0: never, 1: first window only, 2: always */ #define DEFAULT_FTP_GRAB OFF #define DEFAULT_HTTP_GRAB OFF #define DEFAULT_HELP_WINDOW OFF diff --git a/source/vars.c b/source/vars.c index bde51dd..ec0404e 100644 --- a/source/vars.c +++ b/source/vars.c @@ -215,7 +215,7 @@ static IrcVariable irc_variable[] = { "DISPLAY",0, BOOL_TYPE_VAR, DEFAULT_DISPLAY, NULL, NULL, 0, 0 }, { "DISPLAY_ANSI",0, BOOL_TYPE_VAR, DEFAULT_DISPLAY_ANSI, NULL, toggle_reverse_status, 0, 0 }, { "DISPLAY_PC_CHARACTERS",0, INT_TYPE_VAR, DEFAULT_DISPLAY_PC_CHARACTERS, NULL, reinit_screen, 0, VIF_BITCHX }, - { "DOUBLE_STATUS_LINE",0, INT_TYPE_VAR, DEFAULT_DOUBLE_STATUS_LINE, NULL, reinit_status, 0, VIF_BITCHX }, + { "DOUBLE_STATUS_LINE",0, INT_TYPE_VAR, DEFAULT_DOUBLE_STATUS_LINE, NULL, NULL, 0, VIF_BITCHX }, { "EIGHT_BIT_CHARACTERS",0, BOOL_TYPE_VAR, DEFAULT_EIGHT_BIT_CHARACTERS, NULL, eight_bit_characters, 0, VIF_BITCHX }, { "EXEC_PROTECTION",0, BOOL_TYPE_VAR, DEFAULT_EXEC_PROTECTION, NULL, exec_warning, 0, VF_NODAEMON }, { "FAKE_SPLIT_PATTERNS",0, STR_TYPE_VAR, 0, NULL, NULL, 0, 0 }, diff --git a/source/window.c b/source/window.c index 9a66a27..79f3c0b 100644 --- a/source/window.c +++ b/source/window.c @@ -147,14 +147,20 @@ Window *BX_new_window(Screen *screen) new->status_split = 1; new->scratch_line = -1; -#ifdef DEFAULT_DOUBLE_STATUS - new->double_status = DEFAULT_DOUBLE_STATUS; -#else - if (new->refnum == 1) - new->double_status = 1; - else + switch (get_int_var(DOUBLE_STATUS_LINE_VAR)) + { + case 0: new->double_status = 0; -#endif + break; + case 1: + if (new->refnum == 1) + new->double_status = 1; + else + new->double_status = 0; + break; + default: + new->double_status = 1; + } #ifdef DEFAULT_STATUS_LINES new->status_lines = DEFAULT_STATUS_LINES;