summaryrefslogtreecommitdiff
path: root/src/fe-common/core
diff options
context:
space:
mode:
authorailin-nemui <ailin-nemui@users.noreply.github.com>2017-03-07 23:37:23 +0100
committerGitHub <noreply@github.com>2017-03-07 23:37:23 +0100
commitddba68ad77365748cd1f65fd53ea3b820ebd8567 (patch)
tree86945e517e2cd96748d5bfaf50bd6fa8c7c9ebde /src/fe-common/core
parent7f4fd6037046ba1192bf9612c2cecd809d25b48e (diff)
parent9aaa6449a0a554c83d40b56ce0a87bd0cba8bdbf (diff)
downloadirssi-ddba68ad77365748cd1f65fd53ea3b820ebd8567.zip
Merge pull request #659 from ailin-nemui/foreach_dontspam
make foreach send commands
Diffstat (limited to 'src/fe-common/core')
-rw-r--r--src/fe-common/core/window-commands.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/src/fe-common/core/window-commands.c b/src/fe-common/core/window-commands.c
index 9e4aab3a..57c81ac2 100644
--- a/src/fe-common/core/window-commands.c
+++ b/src/fe-common/core/window-commands.c
@@ -839,23 +839,31 @@ static void cmd_layout(const char *data, SERVER_REC *server, WI_ITEM_REC *item)
/* SYNTAX: FOREACH WINDOW <command> */
static void cmd_foreach_window(const char *data)
{
- WINDOW_REC *old;
- GSList *list;
+ WINDOW_REC *old;
+ GSList *list;
+ const char *cmdchars;
+ char *str;
- old = active_win;
+ cmdchars = settings_get_str("cmdchars");
+ str = strchr(cmdchars, *data) != NULL ? g_strdup(data) :
+ g_strdup_printf("%c%s", *cmdchars, data);
+
+ old = active_win;
list = g_slist_copy(windows);
while (list != NULL) {
WINDOW_REC *rec = list->data;
active_win = rec;
- signal_emit("send command", 3, data, rec->active_server,
+ signal_emit("send command", 3, str, rec->active_server,
rec->active);
- list = g_slist_remove(list, list->data);
+ list = g_slist_remove(list, list->data);
}
if (g_slist_find(windows, old) != NULL)
active_win = old;
+
+ g_free(str);
}
void window_commands_init(void)