mirror of
				https://github.com/tmux/tmux.git
				synced 2025-11-04 09:26:05 +00:00 
			
		
		
		
	Don't bork on link/swap the same window. Also extend comment.
This commit is contained in:
		
							
								
								
									
										13
									
								
								CHANGES
									
									
									
									
									
								
							
							
						
						
									
										13
									
								
								CHANGES
									
									
									
									
									
								
							@@ -21,6 +21,17 @@
 | 
			
		||||
	tmux renamew -t/dev/ttypi:0 newname	(client /dev/ttypi's current
 | 
			
		||||
						 session, window 0)
 | 
			
		||||
 | 
			
		||||
  This does have some downsides, for example, having to use -t on selectw,
 | 
			
		||||
 | 
			
		||||
	tmux selectw -t7
 | 
			
		||||
 | 
			
		||||
  is annoying. But then using non-flagged arguments would mean renaming the
 | 
			
		||||
  current window would need to be something like:
 | 
			
		||||
	
 | 
			
		||||
	tmux renamew : newname
 | 
			
		||||
 | 
			
		||||
  It might be better not to try and be so consistent; comments to the usual
 | 
			
		||||
  address ;-).
 | 
			
		||||
* Infrastructure for printing arguments in list-keys output. Easy ones only for
 | 
			
		||||
  now.
 | 
			
		||||
 | 
			
		||||
@@ -429,4 +440,4 @@
 | 
			
		||||
  (including mutt, emacs). No status bar yet and no key remapping or other
 | 
			
		||||
  customisation.
 | 
			
		||||
 | 
			
		||||
$Id: CHANGES,v 1.111 2008-06-05 21:24:59 nicm Exp $
 | 
			
		||||
$Id: CHANGES,v 1.112 2008-06-05 22:59:38 nicm Exp $
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										1
									
								
								TODO
									
									
									
									
									
								
							
							
						
						
									
										1
									
								
								TODO
									
									
									
									
									
								
							@@ -34,7 +34,6 @@
 | 
			
		||||
	command to purge window history
 | 
			
		||||
 	extend list-clients to list clients attached to a session (-a for all?)
 | 
			
		||||
	bring back detach-session to detach all clients on a session?
 | 
			
		||||
	paste buffer etc shouldn't be limited to keys
 | 
			
		||||
	buffer manip: clear, view etc (clear-buffer, show-buffer)
 | 
			
		||||
- function groups, bind-key ^W { select-window 0; send-key ^W } etc ***
 | 
			
		||||
- allow fnmatch for -c, so that you can, eg, detach all clients
 | 
			
		||||
 
 | 
			
		||||
@@ -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,9 +66,13 @@ 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.
 | 
			
		||||
@@ -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);
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,4 @@
 | 
			
		||||
/* $Id: cmd-swap-window.c,v 1.11 2008-06-05 21:25:00 nicm Exp $ */
 | 
			
		||||
/* $Id: cmd-swap-window.c,v 1.12 2008-06-05 22:59:38 nicm Exp $ */
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
 | 
			
		||||
@@ -55,6 +55,9 @@ cmd_swap_window_exec(struct cmd *self, struct cmd_ctx *ctx)
 | 
			
		||||
	if ((wl_dst = cmd_find_window(ctx, data->dst, &dst)) == NULL)
 | 
			
		||||
		return;
 | 
			
		||||
 | 
			
		||||
	if (wl_dst->window == wl_src->window)
 | 
			
		||||
		goto out;
 | 
			
		||||
 | 
			
		||||
	w = wl_dst->window;
 | 
			
		||||
	wl_dst->window = wl_src->window;
 | 
			
		||||
	wl_src->window = w;
 | 
			
		||||
@@ -68,6 +71,7 @@ cmd_swap_window_exec(struct cmd *self, struct cmd_ctx *ctx)
 | 
			
		||||
	if (src != dst)
 | 
			
		||||
		server_redraw_session(dst);
 | 
			
		||||
 | 
			
		||||
out:
 | 
			
		||||
	if (ctx->cmdclient != NULL)
 | 
			
		||||
		server_write_client(ctx->cmdclient, MSG_EXIT, NULL, 0);
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										15
									
								
								cmd.c
									
									
									
									
									
								
							
							
						
						
									
										15
									
								
								cmd.c
									
									
									
									
									
								
							@@ -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);
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user