From 4ba3cf60beea7be93a1de674226f412e5fec1105 Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Fri, 26 Oct 2007 12:29:07 +0000 Subject: Reorg window data structures. Add an intermediate data type (struct winlink) to hold index and make sessions hold a RB tree of them rather than a fixed array. --- cmd-select-window.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'cmd-select-window.c') diff --git a/cmd-select-window.c b/cmd-select-window.c index c0633567..9b906ea4 100644 --- a/cmd-select-window.c +++ b/cmd-select-window.c @@ -1,4 +1,4 @@ -/* $Id: cmd-select-window.c,v 1.4 2007-10-19 09:21:26 nicm Exp $ */ +/* $Id: cmd-select-window.c,v 1.5 2007-10-26 12:29:07 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -108,10 +108,16 @@ cmd_select_window_exec(void *ptr, struct cmd_ctx *ctx) if (data == NULL) return; - if (session_select(s, data->idx) == 0) + switch (session_select(s, data->idx)) { + case 0: server_redraw_session(s); - else + break; + case 1: + break; + default: ctx->error(ctx, "no window %u", data->idx); + break; + } if (!(ctx->flags & CMD_KEY)) server_write_client(c, MSG_EXIT, NULL, 0); -- cgit