Don't bork on link/swap the same window. Also extend comment.

This commit is contained in:
Nicholas Marriott
2008-06-05 22:59:38 +00:00
parent 741f8967b4
commit 197347b61f
5 changed files with 36 additions and 16 deletions

15
cmd.c
View File

@@ -1,4 +1,4 @@
/* $Id: cmd.c,v 1.43 2008-06-05 21:25:00 nicm Exp $ */
/* $Id: cmd.c,v 1.44 2008-06-05 22:59:38 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -313,14 +313,15 @@ cmd_find_window(struct cmd_ctx *ctx, const char *arg, struct session **sp)
s = ctx->cursession;
if (s == NULL)
s = cmd_current_session(ctx);
if (s != NULL) {
if (idx == -1)
wl = s->curw;
else
wl = winlink_find_by_index(&s->windows, idx);
}
if (s == NULL)
return (NULL);
if (sp != NULL)
*sp = s;
if (idx == -1)
wl = s->curw;
else
wl = winlink_find_by_index(&s->windows, idx);
if (wl == NULL)
ctx->error(ctx, "window not found: %s:%d", s->name, idx);
return (wl);