mirror of
				https://github.com/tmux/tmux.git
				synced 2025-10-26 12:27:15 +00:00 
			
		
		
		
	Use starting client cwd in config file, GitHub issue 1606.
This commit is contained in:
		
							
								
								
									
										3
									
								
								cfg.c
									
									
									
									
									
								
							
							
						
						
									
										3
									
								
								cfg.c
									
									
									
									
									
								
							| @@ -38,6 +38,7 @@ struct cfg_cond { | |||||||
| }; | }; | ||||||
| TAILQ_HEAD(cfg_conds, cfg_cond); | TAILQ_HEAD(cfg_conds, cfg_cond); | ||||||
|  |  | ||||||
|  | struct client		 *cfg_client; | ||||||
| static char		 *cfg_file; | static char		 *cfg_file; | ||||||
| int			  cfg_finished; | int			  cfg_finished; | ||||||
| static char		**cfg_causes; | static char		**cfg_causes; | ||||||
| @@ -95,7 +96,7 @@ start_cfg(void) | |||||||
| 	 * command queue is currently empty and our callback will be at the | 	 * command queue is currently empty and our callback will be at the | ||||||
| 	 * front - we need to get in before MSG_COMMAND. | 	 * front - we need to get in before MSG_COMMAND. | ||||||
| 	 */ | 	 */ | ||||||
| 	c = TAILQ_FIRST(&clients); | 	cfg_client = c = TAILQ_FIRST(&clients); | ||||||
| 	if (c != NULL) { | 	if (c != NULL) { | ||||||
| 		cfg_item = cmdq_get_callback(cfg_client_done, NULL); | 		cfg_item = cmdq_get_callback(cfg_client_done, NULL); | ||||||
| 		cmdq_append(c, cfg_item); | 		cmdq_append(c, cfg_item); | ||||||
|   | |||||||
| @@ -1982,6 +1982,8 @@ server_client_get_cwd(struct client *c, struct session *s) | |||||||
| { | { | ||||||
| 	const char	*home; | 	const char	*home; | ||||||
|  |  | ||||||
|  | 	if (!cfg_finished && cfg_client != NULL) | ||||||
|  | 		return (cfg_client->cwd); | ||||||
| 	if (c != NULL && c->session == NULL && c->cwd != NULL) | 	if (c != NULL && c->session == NULL && c->cwd != NULL) | ||||||
| 		return (c->cwd); | 		return (c->cwd); | ||||||
| 	if (s != NULL && s->cwd != NULL) | 	if (s != NULL && s->cwd != NULL) | ||||||
|   | |||||||
							
								
								
									
										1
									
								
								tmux.h
									
									
									
									
									
								
							
							
						
						
									
										1
									
								
								tmux.h
									
									
									
									
									
								
							| @@ -1527,6 +1527,7 @@ void	proc_toggle_log(struct tmuxproc *); | |||||||
|  |  | ||||||
| /* cfg.c */ | /* cfg.c */ | ||||||
| extern int cfg_finished; | extern int cfg_finished; | ||||||
|  | extern struct client *cfg_client; | ||||||
| void	start_cfg(void); | void	start_cfg(void); | ||||||
| int	load_cfg(const char *, struct client *, struct cmdq_item *, int); | int	load_cfg(const char *, struct client *, struct cmdq_item *, int); | ||||||
| void	set_cfg_file(const char *); | void	set_cfg_file(const char *); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 nicm
					nicm