/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
This commit is contained in:
Timo Sirainen 2001-01-01 18:30:23 +00:00 committed by cras
commit 4613196cd2
3 changed files with 25 additions and 7 deletions

View file

@ -93,7 +93,8 @@ static void windows_pack(int removed_refnum)
for (refnum = removed_refnum+1;; refnum++) { for (refnum = removed_refnum+1;; refnum++) {
window = window_find_refnum(refnum); window = window_find_refnum(refnum);
if (window == NULL) break; if (window == NULL || window->sticky_refnum)
break;
window_set_refnum(window, refnum-1); window_set_refnum(window, refnum-1);
} }

View file

@ -24,6 +24,7 @@ typedef struct {
GSList *waiting_channels; /* list of "<server tag> <channel>" */ GSList *waiting_channels; /* list of "<server tag> <channel>" */
int lines; int lines;
unsigned int sticky_refnum:1;
unsigned int destroying:1; unsigned int destroying:1;
/* window-specific command line history */ /* window-specific command line history */

View file

@ -240,16 +240,30 @@ static void cmd_window_item_move(const char *data, SERVER_REC *server,
window_item_set_active(window, item); window_item_set_active(window, item);
} }
/* SYNTAX: WINDOW NUMBER <number> */ /* SYNTAX: WINDOW NUMBER [-sticky] <number> */
static void cmd_window_number(const char *data) static void cmd_window_number(const char *data)
{ {
int num; GHashTable *optlist;
char *refnum;
void *free_arg;
int num;
num = atoi(data); if (!cmd_get_params(data, &free_arg, 1 | PARAM_FLAG_OPTIONS,
if (num < 1) "window number", &optlist, &refnum))
printformat(NULL, NULL, MSGLEVEL_CLIENTNOTICE, IRCTXT_REFNUM_TOO_LOW); return;
else
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); window_set_refnum(active_win, num);
active_win->sticky_refnum =
g_hash_table_lookup(optlist, "sticky") != NULL;
}
} }
/* SYNTAX: WINDOW NAME <name> */ /* 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 list", NULL, (SIGNAL_FUNC) cmd_window_list);
command_bind("window theme", NULL, (SIGNAL_FUNC) cmd_window_theme); command_bind("window theme", NULL, (SIGNAL_FUNC) cmd_window_theme);
command_bind("savewindows", NULL, (SIGNAL_FUNC) cmd_savewindows); command_bind("savewindows", NULL, (SIGNAL_FUNC) cmd_savewindows);
command_set_options("window number", "sticky");
} }
void window_commands_deinit(void) void window_commands_deinit(void)