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:
		
							
								
								
									
										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