aboutsummaryrefslogtreecommitdiff
path: root/cmd-link-window.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicholas.marriott@gmail.com>2008-06-25 20:33:20 +0000
committerNicholas Marriott <nicholas.marriott@gmail.com>2008-06-25 20:33:20 +0000
commit7836298f296f8f41407dc4a6dbdb4aac1e3d4b96 (patch)
tree6c4071f585ae3f50e4fe2494f018b12226387c5d /cmd-link-window.c
parenteb5638f3e7d4e85130555159751899736d1a5a6d (diff)
downloadrtmux-7836298f296f8f41407dc4a6dbdb4aac1e3d4b96.tar.gz
rtmux-7836298f296f8f41407dc4a6dbdb4aac1e3d4b96.tar.bz2
rtmux-7836298f296f8f41407dc4a6dbdb4aac1e3d4b96.zip
Allow use of alt keys. move-window command.
Diffstat (limited to 'cmd-link-window.c')
-rw-r--r--cmd-link-window.c43
1 files changed, 19 insertions, 24 deletions
diff --git a/cmd-link-window.c b/cmd-link-window.c
index 3a3c3e5e..8a9bb6df 100644
--- a/cmd-link-window.c
+++ b/cmd-link-window.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-link-window.c,v 1.23 2008-06-18 22:21:51 nicm Exp $ */
+/* $Id: cmd-link-window.c,v 1.24 2008-06-25 20:33:20 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -46,29 +46,29 @@ void
cmd_link_window_exec(struct cmd *self, struct cmd_ctx *ctx)
{
struct cmd_srcdst_data *data = self->data;
- struct session *s;
+ struct session *dst;
struct winlink *wl_src, *wl_dst;
int idx;
if ((wl_src = cmd_find_window(ctx, data->src, NULL)) == NULL)
return;
- if (arg_parse_window(data->dst, &s, &idx) != 0) {
+ if (arg_parse_window(data->dst, &dst, &idx) != 0) {
ctx->error(ctx, "bad window: %s", data->dst);
return;
}
- if (s == NULL)
- s = ctx->cursession;
- if (s == NULL)
- s = cmd_current_session(ctx);
- if (s == NULL) {
+ if (dst == NULL)
+ dst = ctx->cursession;
+ if (dst == NULL)
+ dst = cmd_current_session(ctx);
+ if (dst == NULL) {
ctx->error(ctx, "session not found: %s", data->dst);
return;
}
wl_dst = NULL;
if (idx != -1)
- wl_dst = winlink_find_by_index(&s->windows, idx);
+ wl_dst = winlink_find_by_index(&dst->windows, idx);
if (wl_dst != NULL) {
if (wl_dst->window == wl_src->window)
goto out;
@@ -78,35 +78,30 @@ cmd_link_window_exec(struct cmd *self, struct cmd_ctx *ctx)
* Can't use session_detach as it will destroy session
* if this makes it empty.
*/
- session_alert_cancel(s, wl_dst);
- winlink_remove(&s->windows, wl_dst);
+ session_alert_cancel(dst, wl_dst);
+ winlink_remove(&dst->windows, wl_dst);
/* Force select/redraw if current. */
- if (wl_dst == s->curw) {
+ if (wl_dst == dst->curw) {
data->flags &= ~CMD_DFLAG;
- s->curw = NULL;
+ dst->curw = NULL;
}
- if (wl_dst == s->lastw)
- s->lastw = NULL;
-
- /*
- * Can't error out after this or there could be an
- * empty session!
- */
+ if (wl_dst == dst->lastw)
+ dst->lastw = NULL;
}
}
- wl_dst = session_attach(s, wl_src->window, idx);
+ wl_dst = session_attach(dst, wl_src->window, idx);
if (wl_dst == NULL) {
ctx->error(ctx, "index in use: %d", idx);
return;
}
if (data->flags & CMD_DFLAG)
- server_status_session(s);
+ server_status_session(dst);
else {
- session_select(s, wl_dst->idx);
- server_redraw_session(s);
+ session_select(dst, wl_dst->idx);
+ server_redraw_session(dst);
}
recalculate_sizes();