mirror of
https://github.com/tmux/tmux.git
synced 2025-11-05 01:56:07 +00:00
Don't bork on link/swap the same window. Also extend comment.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
/* $Id: cmd-link-window.c,v 1.19 2008-06-05 21:25:00 nicm Exp $ */
|
||||
/* $Id: cmd-link-window.c,v 1.20 2008-06-05 22:59:38 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
@@ -66,16 +66,20 @@ cmd_link_window_exec(struct cmd *self, struct cmd_ctx *ctx)
|
||||
return;
|
||||
}
|
||||
|
||||
if (data->flags & CMD_KFLAG) {
|
||||
if (idx != -1)
|
||||
wl_dst = winlink_find_by_index(&s->windows, idx);
|
||||
if (wl_dst != NULL) {
|
||||
if (wl_dst != NULL) {
|
||||
if (wl_dst->window == wl_src->window)
|
||||
goto out;
|
||||
|
||||
if (data->flags & CMD_KFLAG) {
|
||||
/*
|
||||
* 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);
|
||||
|
||||
|
||||
/* Force select/redraw if current. */
|
||||
if (wl_dst == s->curw) {
|
||||
data->flags &= ~CMD_DFLAG;
|
||||
@@ -85,8 +89,8 @@ cmd_link_window_exec(struct cmd *self, struct cmd_ctx *ctx)
|
||||
s->lastw = NULL;
|
||||
|
||||
/*
|
||||
* Can't error out after this or there could be an empty
|
||||
* session!
|
||||
* Can't error out after this or there could be an
|
||||
* empty session!
|
||||
*/
|
||||
}
|
||||
}
|
||||
@@ -104,6 +108,7 @@ cmd_link_window_exec(struct cmd *self, struct cmd_ctx *ctx)
|
||||
server_redraw_session(s);
|
||||
}
|
||||
|
||||
out:
|
||||
if (ctx->cmdclient != NULL)
|
||||
server_write_client(ctx->cmdclient, MSG_EXIT, NULL, 0);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user