From 8f79457769881f8fe9730b02766e4ad68056398d Mon Sep 17 00:00:00 2001 From: ailin-nemui Date: Tue, 29 Nov 2022 20:05:52 +0100 Subject: [PATCH] Merge pull request #1428 from ailin-nemui/flip-level add (hide)level flip command (cherry picked from commit 88cc48651dcfe9121ff60464c92b4318a6c1ca31) --- docs/help/in/window.in | 4 ++++ src/core/levels.c | 8 +++++--- src/fe-common/core/window-commands.c | 2 +- src/fe-text/textbuffer-commands.c | 2 +- 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/docs/help/in/window.in b/docs/help/in/window.in index 9a7a7b10..23316911 100644 --- a/docs/help/in/window.in +++ b/docs/help/in/window.in @@ -42,6 +42,7 @@ LEFT: %|Go to the previous window numerically that is part of the current sticky group (or not part of any sticky group). RIGHT: %|Go to the next window numerically that is part of the current sticky group (or not part of any sticky group). STICK: %|Make the currently active window sticky, or stick the window specified by number to the currently visible split window. Or turn off stickyness of the currently active window or the window specified by number. + HIDELEVEL: %|Changes the levels of text lines that should be hidden from view, or query the current hidden level. MOVE LEFT: %|Move the window to the numerically previous location inside the current sticky group. MOVE RIGHT: %|Move the window to the numerically next location inside the current sticky group. MOVE UP: %|Move the current window to the sticky group of the previous split window. If no sticky group remains, the split window collapses. @@ -52,6 +53,8 @@ %|Add the required arguments for the given command. Without arguments, the details (size, immortality, levels, server, name and sticky group) of the currently active window are displayed. If used with a number as argument, same as WINDOW REFNUM. + %|LEVEL and HIDELEVEL modify the currently set level. Without arguments, the current level is displayed. Levels listed starting with `+' are added to the current levels. Levels listed starting with `-' are removed from the current levels. To clear the levels, start the new level setting with `NONE'. Levels listed starting with `^' are either removed or added from the current setting, depending on whether they were previously set or not (since Irssi 1.5). Levels listed as is are also added to the current levels. Afterwards, the new level setting is displayed. + %9Description:%9 Manipulates the window layout and positioning attributes. @@ -68,6 +71,7 @@ /WINDOW LOG OFF /WINDOW LOG ON ~/logs/debug.log /WINDOW LEVEL -ALL +NOTICES + /WINDOW HIDELEVEL ^JOINS ^PARTS ^QUITS /WINDOW LOGFILE ~/logs/notices.log %9See also:%9 JOIN, LEVELS, LOG, QUERY diff --git a/src/core/levels.c b/src/core/levels.c index e62bc68c..62d7a00a 100644 --- a/src/core/levels.c +++ b/src/core/levels.c @@ -181,13 +181,15 @@ int combine_level(int dest, const char *src) list = g_strsplit(src, " ", -1); for (item = list; *item != NULL; item++) { - itemname = *item + (**item == '+' || **item == '-' ? 1 : 0); + itemname = *item + (**item == '+' || **item == '-' || **item == '^' ? 1 : 0); itemlevel = level_get(itemname); - if (g_strcmp0(itemname, "NONE") == 0) - dest = 0; + if (g_ascii_strcasecmp(itemname, "NONE") == 0) + dest = 0; else if (**item == '-') dest &= ~(itemlevel); + else if (**item == '^') + dest ^= itemlevel; else dest |= itemlevel; } diff --git a/src/fe-common/core/window-commands.c b/src/fe-common/core/window-commands.c index 7c542d37..6669ba43 100644 --- a/src/fe-common/core/window-commands.c +++ b/src/fe-common/core/window-commands.c @@ -400,7 +400,7 @@ static void cmd_window_previous(void) window_set_active(window_find_refnum(num)); } -/* SYNTAX: WINDOW LEVEL [] */ +/* SYNTAX: WINDOW LEVEL [] */ static void cmd_window_level(const char *data) { char *level; diff --git a/src/fe-text/textbuffer-commands.c b/src/fe-text/textbuffer-commands.c index 6ed7c39c..3d1d963b 100644 --- a/src/fe-text/textbuffer-commands.c +++ b/src/fe-text/textbuffer-commands.c @@ -93,7 +93,7 @@ static void cmd_window_scroll(const char *data) gui->scroll : settings_get_bool("scroll")); } -/* SYNTAX: WINDOW HIDELEVEL [] */ +/* SYNTAX: WINDOW HIDELEVEL [] */ static void cmd_window_hidelevel(const char *data) { GUI_WINDOW_REC *gui;