mirror of
				https://github.com/tmux/tmux.git
				synced 2025-11-04 09:26:05 +00:00 
			
		
		
		
	Sync OpenBSD patchset 1024:
Move window name changes into wrapper function window_set_name, from George Nachman.
This commit is contained in:
		@@ -46,6 +46,7 @@ cmd_break_pane_exec(struct cmd *self, struct cmd_ctx *ctx)
 | 
				
			|||||||
	struct session		*s;
 | 
						struct session		*s;
 | 
				
			||||||
	struct window_pane	*wp;
 | 
						struct window_pane	*wp;
 | 
				
			||||||
	struct window		*w;
 | 
						struct window		*w;
 | 
				
			||||||
 | 
						char			*name;
 | 
				
			||||||
	char			*cause;
 | 
						char			*cause;
 | 
				
			||||||
	int			 base_idx;
 | 
						int			 base_idx;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -74,7 +75,9 @@ cmd_break_pane_exec(struct cmd *self, struct cmd_ctx *ctx)
 | 
				
			|||||||
	w = wp->window = window_create1(s->sx, s->sy);
 | 
						w = wp->window = window_create1(s->sx, s->sy);
 | 
				
			||||||
	TAILQ_INSERT_HEAD(&w->panes, wp, entry);
 | 
						TAILQ_INSERT_HEAD(&w->panes, wp, entry);
 | 
				
			||||||
	w->active = wp;
 | 
						w->active = wp;
 | 
				
			||||||
	w->name = default_window_name(w);
 | 
						name = default_window_name(w);
 | 
				
			||||||
 | 
						window_set_name(w, name);
 | 
				
			||||||
 | 
						xfree(name);
 | 
				
			||||||
	layout_init(w);
 | 
						layout_init(w);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	base_idx = options_get_number(&s->options, "base-index");
 | 
						base_idx = options_get_number(&s->options, "base-index");
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -217,8 +217,7 @@ cmd_new_session_exec(struct cmd *self, struct cmd_ctx *ctx)
 | 
				
			|||||||
	if (cmd != NULL && args_has(args, 'n')) {
 | 
						if (cmd != NULL && args_has(args, 'n')) {
 | 
				
			||||||
		w = s->curw->window;
 | 
							w = s->curw->window;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		xfree(w->name);
 | 
							window_set_name(w, args_get(args, 'n'));
 | 
				
			||||||
		w->name = xstrdup(args_get(args, 'n'));
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
		options_set_number(&w->options, "automatic-rename", 0);
 | 
							options_set_number(&w->options, "automatic-rename", 0);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -48,8 +48,7 @@ cmd_rename_window_exec(struct cmd *self, struct cmd_ctx *ctx)
 | 
				
			|||||||
	if ((wl = cmd_find_window(ctx, args_get(args, 't'), &s)) == NULL)
 | 
						if ((wl = cmd_find_window(ctx, args_get(args, 't'), &s)) == NULL)
 | 
				
			||||||
		return (-1);
 | 
							return (-1);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	xfree(wl->window->name);
 | 
						window_set_name(wl->window, args->argv[0]);
 | 
				
			||||||
	wl->window->name = xstrdup(args->argv[0]);
 | 
					 | 
				
			||||||
	options_set_number(&wl->window->options, "automatic-rename", 0);
 | 
						options_set_number(&wl->window->options, "automatic-rename", 0);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	server_status_window(wl->window);
 | 
						server_status_window(wl->window);
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										3
									
								
								input.c
									
									
									
									
									
								
							
							
						
						
									
										3
									
								
								input.c
									
									
									
									
									
								
							@@ -1552,8 +1552,7 @@ input_exit_rename(struct input_ctx *ictx)
 | 
				
			|||||||
		return;
 | 
							return;
 | 
				
			||||||
	log_debug("%s: \"%s\"", __func__, ictx->input_buf);
 | 
						log_debug("%s: \"%s\"", __func__, ictx->input_buf);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	xfree(ictx->wp->window->name);
 | 
						window_set_name(ictx->wp->window, ictx->input_buf);
 | 
				
			||||||
	ictx->wp->window->name = xstrdup(ictx->input_buf);
 | 
					 | 
				
			||||||
	options_set_number(&ictx->wp->window->options, "automatic-rename", 0);
 | 
						options_set_number(&ictx->wp->window->options, "automatic-rename", 0);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	server_status_window(ictx->wp->window);
 | 
						server_status_window(ictx->wp->window);
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										1
									
								
								tmux.h
									
									
									
									
									
								
							
							
						
						
									
										1
									
								
								tmux.h
									
									
									
									
									
								
							@@ -1964,6 +1964,7 @@ struct window_pane *window_pane_find_up(struct window_pane *);
 | 
				
			|||||||
struct window_pane *window_pane_find_down(struct window_pane *);
 | 
					struct window_pane *window_pane_find_down(struct window_pane *);
 | 
				
			||||||
struct window_pane *window_pane_find_left(struct window_pane *);
 | 
					struct window_pane *window_pane_find_left(struct window_pane *);
 | 
				
			||||||
struct window_pane *window_pane_find_right(struct window_pane *);
 | 
					struct window_pane *window_pane_find_right(struct window_pane *);
 | 
				
			||||||
 | 
					void		 window_set_name(struct window *, const char *);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* layout.c */
 | 
					/* layout.c */
 | 
				
			||||||
u_int		 layout_count_cells(struct layout_cell *);
 | 
					u_int		 layout_count_cells(struct layout_cell *);
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										8
									
								
								window.c
									
									
									
									
									
								
							
							
						
						
									
										8
									
								
								window.c
									
									
									
									
									
								
							@@ -358,6 +358,14 @@ window_destroy(struct window *w)
 | 
				
			|||||||
	xfree(w);
 | 
						xfree(w);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void
 | 
				
			||||||
 | 
					window_set_name(struct window *w, const char *new_name)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						if (w->name != NULL)
 | 
				
			||||||
 | 
							xfree(w->name);
 | 
				
			||||||
 | 
						w->name = xstrdup(new_name);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void
 | 
					void
 | 
				
			||||||
window_resize(struct window *w, u_int sx, u_int sy)
 | 
					window_resize(struct window *w, u_int sx, u_int sy)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user