diff options
author | ailin-nemui <ailin-nemui@users.noreply.github.com> | 2017-02-27 13:43:58 +0100 |
---|---|---|
committer | ailin-nemui <ailin-nemui@users.noreply.github.com> | 2017-02-27 13:43:58 +0100 |
commit | 9aaa6449a0a554c83d40b56ce0a87bd0cba8bdbf (patch) | |
tree | 88e52e7e9db6cedb5fa6dbf2c34d2c11fb464470 /src/fe-common/core | |
parent | 540639e0faee2dac9ff60fcf5e2ab0334a1ad5d9 (diff) | |
download | irssi-9aaa6449a0a554c83d40b56ce0a87bd0cba8bdbf.zip |
make foreach send commands
Diffstat (limited to 'src/fe-common/core')
-rw-r--r-- | src/fe-common/core/window-commands.c | 18 |
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) |