mirror of
				https://github.com/tmux/tmux.git
				synced 2025-11-04 00:56:10 +00:00 
			
		
		
		
	Adjust how mouse targets are found so they always have a session, window
and pane.
This commit is contained in:
		@@ -1040,12 +1040,16 @@ cmd_find_target(struct cmd_find_state *fs, struct cmdq_item *item,
 | 
				
			|||||||
		switch (type) {
 | 
							switch (type) {
 | 
				
			||||||
		case CMD_FIND_PANE:
 | 
							case CMD_FIND_PANE:
 | 
				
			||||||
			fs->wp = cmd_mouse_pane(m, &fs->s, &fs->wl);
 | 
								fs->wp = cmd_mouse_pane(m, &fs->s, &fs->wl);
 | 
				
			||||||
			if (fs->wp != NULL)
 | 
								if (fs->wp != NULL) {
 | 
				
			||||||
				fs->w = fs->wl->window;
 | 
									fs->w = fs->wl->window;
 | 
				
			||||||
				break;
 | 
									break;
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
								/* FALLTHROUGH */
 | 
				
			||||||
		case CMD_FIND_WINDOW:
 | 
							case CMD_FIND_WINDOW:
 | 
				
			||||||
		case CMD_FIND_SESSION:
 | 
							case CMD_FIND_SESSION:
 | 
				
			||||||
			fs->wl = cmd_mouse_window(m, &fs->s);
 | 
								fs->wl = cmd_mouse_window(m, &fs->s);
 | 
				
			||||||
 | 
								if (fs->wl == NULL && fs->s != NULL)
 | 
				
			||||||
 | 
									fs->wl = fs->s->curw;
 | 
				
			||||||
			if (fs->wl != NULL) {
 | 
								if (fs->wl != NULL) {
 | 
				
			||||||
				fs->w = fs->wl->window;
 | 
									fs->w = fs->wl->window;
 | 
				
			||||||
				fs->wp = fs->w->active;
 | 
									fs->wp = fs->w->active;
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										13
									
								
								cmd.c
									
									
									
									
									
								
							
							
						
						
									
										13
									
								
								cmd.c
									
									
									
									
									
								
							@@ -510,17 +510,22 @@ cmd_mouse_window(struct mouse_event *m, struct session **sp)
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
	struct session	*s;
 | 
						struct session	*s;
 | 
				
			||||||
	struct window	*w;
 | 
						struct window	*w;
 | 
				
			||||||
 | 
						struct winlink	*wl;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (!m->valid || m->s == -1 || m->w == -1)
 | 
						if (!m->valid)
 | 
				
			||||||
		return (NULL);
 | 
							return (NULL);
 | 
				
			||||||
	if ((s = session_find_by_id(m->s)) == NULL)
 | 
						if (m->s == -1 || (s = session_find_by_id(m->s)) == NULL)
 | 
				
			||||||
		return (NULL);
 | 
							return (NULL);
 | 
				
			||||||
 | 
						if (m->w == -1)
 | 
				
			||||||
 | 
							wl = s->curw;
 | 
				
			||||||
 | 
						else {
 | 
				
			||||||
		if ((w = window_find_by_id(m->w)) == NULL)
 | 
							if ((w = window_find_by_id(m->w)) == NULL)
 | 
				
			||||||
			return (NULL);
 | 
								return (NULL);
 | 
				
			||||||
 | 
							wl = winlink_find_by_window(&s->windows, w);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
	if (sp != NULL)
 | 
						if (sp != NULL)
 | 
				
			||||||
		*sp = s;
 | 
							*sp = s;
 | 
				
			||||||
	return (winlink_find_by_window(&s->windows, w));
 | 
						return (wl);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Get current mouse pane if any. */
 | 
					/* Get current mouse pane if any. */
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user