diff options
author | Timo Sirainen <cras@irssi.org> | 2001-01-01 18:30:23 +0000 |
---|---|---|
committer | cras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564> | 2001-01-01 18:30:23 +0000 |
commit | 4613196cd26f9eb593001d1b04568b452b1bb365 (patch) | |
tree | 7a60996bf0ad12e0e0361111dbd4ae041f853b8e /src | |
parent | 8b5475f78951e646d5101fb14f4db99ed84ed016 (diff) | |
download | irssi-4613196cd26f9eb593001d1b04568b452b1bb365.zip |
/WINDOW NUMBER: -sticky option added. Closing windows before a sticky
window won't change refnum of the sticky window and windows after it
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@1046 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'src')
-rw-r--r-- | src/fe-common/core/fe-windows.c | 3 | ||||
-rw-r--r-- | src/fe-common/core/fe-windows.h | 1 | ||||
-rw-r--r-- | src/fe-common/core/window-commands.c | 28 |
3 files changed, 25 insertions, 7 deletions
diff --git a/src/fe-common/core/fe-windows.c b/src/fe-common/core/fe-windows.c index 1e754347..0103c260 100644 --- a/src/fe-common/core/fe-windows.c +++ b/src/fe-common/core/fe-windows.c @@ -93,7 +93,8 @@ static void windows_pack(int removed_refnum) for (refnum = removed_refnum+1;; refnum++) { window = window_find_refnum(refnum); - if (window == NULL) break; + if (window == NULL || window->sticky_refnum) + break; window_set_refnum(window, refnum-1); } diff --git a/src/fe-common/core/fe-windows.h b/src/fe-common/core/fe-windows.h index f91e3364..aaa3f0ce 100644 --- a/src/fe-common/core/fe-windows.h +++ b/src/fe-common/core/fe-windows.h @@ -24,6 +24,7 @@ typedef struct { GSList *waiting_channels; /* list of "<server tag> <channel>" */ int lines; + unsigned int sticky_refnum:1; unsigned int destroying:1; /* window-specific command line history */ diff --git a/src/fe-common/core/window-commands.c b/src/fe-common/core/window-commands.c index 17595f5b..6333c429 100644 --- a/src/fe-common/core/window-commands.c +++ b/src/fe-common/core/window-commands.c @@ -240,16 +240,30 @@ static void cmd_window_item_move(const char *data, SERVER_REC *server, window_item_set_active(window, item); } -/* SYNTAX: WINDOW NUMBER <number> */ +/* SYNTAX: WINDOW NUMBER [-sticky] <number> */ static void cmd_window_number(const char *data) { - int num; + GHashTable *optlist; + char *refnum; + void *free_arg; + int num; - num = atoi(data); - if (num < 1) - printformat(NULL, NULL, MSGLEVEL_CLIENTNOTICE, IRCTXT_REFNUM_TOO_LOW); - else + if (!cmd_get_params(data, &free_arg, 1 | PARAM_FLAG_OPTIONS, + "window number", &optlist, &refnum)) + return; + + if (*refnum == '\0') + cmd_param_error(CMDERR_NOT_ENOUGH_PARAMS); + + num = atoi(refnum); + if (num < 1) { + printformat(NULL, NULL, MSGLEVEL_CLIENTNOTICE, + IRCTXT_REFNUM_TOO_LOW); + } else { window_set_refnum(active_win, num); + active_win->sticky_refnum = + g_hash_table_lookup(optlist, "sticky") != NULL; + } } /* SYNTAX: WINDOW NAME <name> */ @@ -424,6 +438,8 @@ void window_commands_init(void) command_bind("window list", NULL, (SIGNAL_FUNC) cmd_window_list); command_bind("window theme", NULL, (SIGNAL_FUNC) cmd_window_theme); command_bind("savewindows", NULL, (SIGNAL_FUNC) cmd_savewindows); + + command_set_options("window number", "sticky"); } void window_commands_deinit(void) |