mirror of
				https://github.com/tmux/tmux.git
				synced 2025-11-03 16:46:18 +00:00 
			
		
		
		
	Also move cmdq_item and cmdq_list into cmd-queue.c (this is to make its
use more clearly defined and preparation for some future work).
This commit is contained in:
		
							
								
								
									
										29
									
								
								format.c
									
									
									
									
									
								
							
							
						
						
									
										29
									
								
								format.c
									
									
									
									
									
								
							@@ -1108,8 +1108,8 @@ format_cb_mouse_line(struct format_tree *ft, struct format_entry *fe)
 | 
			
		||||
		fe->value = s;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* Merge a format tree. */
 | 
			
		||||
static void
 | 
			
		||||
/* Merge one format tree into another. */
 | 
			
		||||
void
 | 
			
		||||
format_merge(struct format_tree *ft, struct format_tree *from)
 | 
			
		||||
{
 | 
			
		||||
	struct format_entry	*fe;
 | 
			
		||||
@@ -1124,21 +1124,16 @@ format_merge(struct format_tree *ft, struct format_tree *from)
 | 
			
		||||
static void
 | 
			
		||||
format_create_add_item(struct format_tree *ft, struct cmdq_item *item)
 | 
			
		||||
{
 | 
			
		||||
	struct cmdq_shared	*shared = cmdq_get_shared(item);
 | 
			
		||||
	struct mouse_event	*m;
 | 
			
		||||
	struct window_pane	*wp;
 | 
			
		||||
	u_int			 x, y;
 | 
			
		||||
 | 
			
		||||
	if (item->cmd != NULL) {
 | 
			
		||||
		format_add(ft, "command", "%s",
 | 
			
		||||
		    cmd_get_entry (item->cmd)->name);
 | 
			
		||||
	}
 | 
			
		||||
	cmdq_merge_formats(item, ft);
 | 
			
		||||
 | 
			
		||||
	if (item->shared == NULL)
 | 
			
		||||
	if (shared == NULL)
 | 
			
		||||
		return;
 | 
			
		||||
	if (item->shared->formats != NULL)
 | 
			
		||||
		format_merge(ft, item->shared->formats);
 | 
			
		||||
 | 
			
		||||
	m = &item->shared->mouse;
 | 
			
		||||
	m = &shared->mouse;
 | 
			
		||||
	if (m->valid && ((wp = cmd_mouse_pane(m, NULL, NULL)) != NULL)) {
 | 
			
		||||
		format_add(ft, "mouse_pane", "%%%u", wp->id);
 | 
			
		||||
		if (cmd_mouse_at(wp, m, &x, &y, 0) == 0) {
 | 
			
		||||
@@ -2425,7 +2420,7 @@ format_single(struct cmdq_item *item, const char *fmt, struct client *c,
 | 
			
		||||
	char			*expanded;
 | 
			
		||||
 | 
			
		||||
	if (item != NULL)
 | 
			
		||||
		ft = format_create(item->client, item, FORMAT_NONE, 0);
 | 
			
		||||
		ft = format_create(cmdq_get_client(item), item, FORMAT_NONE, 0);
 | 
			
		||||
	else
 | 
			
		||||
		ft = format_create(NULL, item, FORMAT_NONE, 0);
 | 
			
		||||
	format_defaults(ft, c, s, wl, wp);
 | 
			
		||||
@@ -2435,6 +2430,16 @@ format_single(struct cmdq_item *item, const char *fmt, struct client *c,
 | 
			
		||||
	return (expanded);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* Expand a single string using target. */
 | 
			
		||||
char *
 | 
			
		||||
format_single_from_target(struct cmdq_item *item, const char *fmt,
 | 
			
		||||
    struct client *c)
 | 
			
		||||
{
 | 
			
		||||
	struct cmd_find_state	*target = cmdq_get_target(item);
 | 
			
		||||
 | 
			
		||||
	return (format_single(item, fmt, c, target->s, target->wl, target->wp));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* Set defaults for any of arguments that are not NULL. */
 | 
			
		||||
void
 | 
			
		||||
format_defaults(struct format_tree *ft, struct client *c, struct session *s,
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user