mirror of
				https://github.com/tmux/tmux.git
				synced 2025-10-26 12:27:15 +00:00 
			
		
		
		
	Add display-message -C flag to update pane while message is displayed,
GitHub issue 4363 from Vitaly Ostrosablin.
This commit is contained in:
		
							
								
								
									
										8
									
								
								alerts.c
									
									
									
									
									
								
							
							
						
						
									
										8
									
								
								alerts.c
									
									
									
									
									
								
							| @@ -316,11 +316,11 @@ alerts_set_message(struct winlink *wl, const char *type, const char *option) | |||||||
| 		if (visual == VISUAL_OFF) | 		if (visual == VISUAL_OFF) | ||||||
| 			continue; | 			continue; | ||||||
| 		if (c->session->curw == wl) { | 		if (c->session->curw == wl) { | ||||||
| 			status_message_set(c, -1, 1, 0, "%s in current window", | 			status_message_set(c, -1, 1, 0, 0, | ||||||
| 			    type); | 			    "%s in current window", type); | ||||||
| 		} else { | 		} else { | ||||||
| 			status_message_set(c, -1, 1, 0, "%s in window %d", type, | 			status_message_set(c, -1, 1, 0, 0, | ||||||
| 			    wl->idx); | 			    "%s in window %d", type, wl->idx); | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
|   | |||||||
| @@ -39,8 +39,8 @@ const struct cmd_entry cmd_display_message_entry = { | |||||||
| 	.name = "display-message", | 	.name = "display-message", | ||||||
| 	.alias = "display", | 	.alias = "display", | ||||||
|  |  | ||||||
| 	.args = { "ac:d:lINpt:F:v", 0, 1, NULL }, | 	.args = { "aCc:d:lINpt:F:v", 0, 1, NULL }, | ||||||
| 	.usage = "[-aIlNpv] [-c target-client] [-d delay] [-F format] " | 	.usage = "[-aCIlNpv] [-c target-client] [-d delay] [-F format] " | ||||||
| 		 CMD_TARGET_PANE_USAGE " [message]", | 		 CMD_TARGET_PANE_USAGE " [message]", | ||||||
|  |  | ||||||
| 	.target = { 't', CMD_FIND_PANE, CMD_FIND_CANFAIL }, | 	.target = { 't', CMD_FIND_PANE, CMD_FIND_CANFAIL }, | ||||||
| @@ -69,6 +69,7 @@ cmd_display_message_exec(struct cmd *self, struct cmdq_item *item) | |||||||
| 	const char		*template; | 	const char		*template; | ||||||
| 	char			*msg, *cause; | 	char			*msg, *cause; | ||||||
| 	int			 delay = -1, flags, Nflag = args_has(args, 'N'); | 	int			 delay = -1, flags, Nflag = args_has(args, 'N'); | ||||||
|  | 	int			 Cflag = args_has(args, 'C'); | ||||||
| 	struct format_tree	*ft; | 	struct format_tree	*ft; | ||||||
| 	u_int			 count = args_count(args); | 	u_int			 count = args_count(args); | ||||||
| 	struct evbuffer		*evb; | 	struct evbuffer		*evb; | ||||||
| @@ -150,7 +151,7 @@ cmd_display_message_exec(struct cmd *self, struct cmdq_item *item) | |||||||
| 		server_client_print(tc, 0, evb); | 		server_client_print(tc, 0, evb); | ||||||
| 		evbuffer_free(evb); | 		evbuffer_free(evb); | ||||||
| 	} else if (tc != NULL) | 	} else if (tc != NULL) | ||||||
| 		status_message_set(tc, delay, 0, Nflag, "%s", msg); | 		status_message_set(tc, delay, 0, Nflag, Cflag, "%s", msg); | ||||||
| 	free(msg); | 	free(msg); | ||||||
|  |  | ||||||
| 	format_free(ft); | 	format_free(ft); | ||||||
|   | |||||||
| @@ -157,7 +157,7 @@ cmd_if_shell_callback(struct job *job) | |||||||
| 	if (cmdlist == NULL) { | 	if (cmdlist == NULL) { | ||||||
| 		if (cdata->item == NULL) { | 		if (cdata->item == NULL) { | ||||||
| 			*error = toupper((u_char)*error); | 			*error = toupper((u_char)*error); | ||||||
| 			status_message_set(c, -1, 1, 0, "%s", error); | 			status_message_set(c, -1, 1, 0, 0, "%s", error); | ||||||
| 		} else | 		} else | ||||||
| 			cmdq_error(cdata->item, "%s", error); | 			cmdq_error(cdata->item, "%s", error); | ||||||
| 		free(error); | 		free(error); | ||||||
|   | |||||||
| @@ -114,8 +114,8 @@ cmd_list_keys_print_notes(struct cmdq_item *item, struct args *args, | |||||||
| 			note = xstrdup(bd->note); | 			note = xstrdup(bd->note); | ||||||
| 		tmp = utf8_padcstr(key, keywidth + 1); | 		tmp = utf8_padcstr(key, keywidth + 1); | ||||||
| 		if (args_has(args, '1') && tc != NULL) { | 		if (args_has(args, '1') && tc != NULL) { | ||||||
| 			status_message_set(tc, -1, 1, 0, "%s%s%s", prefix, tmp, | 			status_message_set(tc, -1, 1, 0, 0, "%s%s%s", prefix, | ||||||
| 			    note); | 			    tmp, note); | ||||||
| 		} else | 		} else | ||||||
| 			cmdq_print(item, "%s%s%s", prefix, tmp, note); | 			cmdq_print(item, "%s%s%s", prefix, tmp, note); | ||||||
| 		free(tmp); | 		free(tmp); | ||||||
| @@ -298,8 +298,8 @@ cmd_list_keys_exec(struct cmd *self, struct cmdq_item *item) | |||||||
| 			free(cp); | 			free(cp); | ||||||
|  |  | ||||||
| 			if (args_has(args, '1') && tc != NULL) { | 			if (args_has(args, '1') && tc != NULL) { | ||||||
| 				status_message_set(tc, -1, 1, 0, "bind-key %s", | 				status_message_set(tc, -1, 1, 0, 0, | ||||||
| 				    tmp); | 				    "bind-key %s", tmp); | ||||||
| 			} else | 			} else | ||||||
| 				cmdq_print(item, "bind-key %s", tmp); | 				cmdq_print(item, "bind-key %s", tmp); | ||||||
| 			free(key); | 			free(key); | ||||||
|   | |||||||
| @@ -893,7 +893,7 @@ cmdq_error(struct cmdq_item *item, const char *fmt, ...) | |||||||
| 		c->retval = 1; | 		c->retval = 1; | ||||||
| 	} else { | 	} else { | ||||||
| 		*msg = toupper((u_char) *msg); | 		*msg = toupper((u_char) *msg); | ||||||
| 		status_message_set(c, -1, 1, 0, "%s", msg); | 		status_message_set(c, -1, 1, 0, 0, "%s", msg); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	free(msg); | 	free(msg); | ||||||
|   | |||||||
| @@ -204,7 +204,7 @@ cmd_run_shell_timer(__unused int fd, __unused short events, void* arg) | |||||||
| 	if (cmdlist == NULL) { | 	if (cmdlist == NULL) { | ||||||
| 		if (cdata->item == NULL) { | 		if (cdata->item == NULL) { | ||||||
| 			*error = toupper((u_char)*error); | 			*error = toupper((u_char)*error); | ||||||
| 			status_message_set(c, -1, 1, 0, "%s", error); | 			status_message_set(c, -1, 1, 0, 0, "%s", error); | ||||||
| 		} else | 		} else | ||||||
| 			cmdq_error(cdata->item, "%s", error); | 			cmdq_error(cdata->item, "%s", error); | ||||||
| 		free(error); | 		free(error); | ||||||
|   | |||||||
| @@ -1297,7 +1297,7 @@ mode_tree_run_command(struct client *c, struct cmd_find_state *fs, | |||||||
| 		if (status == CMD_PARSE_ERROR) { | 		if (status == CMD_PARSE_ERROR) { | ||||||
| 			if (c != NULL) { | 			if (c != NULL) { | ||||||
| 				*error = toupper((u_char)*error); | 				*error = toupper((u_char)*error); | ||||||
| 				status_message_set(c, -1, 1, 0, "%s", error); | 				status_message_set(c, -1, 1, 0, 0, "%s", error); | ||||||
| 			} | 			} | ||||||
| 			free(error); | 			free(error); | ||||||
| 		} | 		} | ||||||
|   | |||||||
							
								
								
									
										6
									
								
								status.c
									
									
									
									
									
								
							
							
						
						
									
										6
									
								
								status.c
									
									
									
									
									
								
							| @@ -470,7 +470,7 @@ status_redraw(struct client *c) | |||||||
| /* Set a status line message. */ | /* Set a status line message. */ | ||||||
| void | void | ||||||
| status_message_set(struct client *c, int delay, int ignore_styles, | status_message_set(struct client *c, int delay, int ignore_styles, | ||||||
|     int ignore_keys, const char *fmt, ...) |     int ignore_keys, int no_freeze, const char *fmt, ...) | ||||||
| { | { | ||||||
| 	struct timeval	 tv; | 	struct timeval	 tv; | ||||||
| 	va_list		 ap; | 	va_list		 ap; | ||||||
| @@ -514,7 +514,9 @@ status_message_set(struct client *c, int delay, int ignore_styles, | |||||||
| 		c->message_ignore_keys = ignore_keys; | 		c->message_ignore_keys = ignore_keys; | ||||||
| 	c->message_ignore_styles = ignore_styles; | 	c->message_ignore_styles = ignore_styles; | ||||||
|  |  | ||||||
| 	c->tty.flags |= (TTY_NOCURSOR|TTY_FREEZE); | 	if (!no_freeze) | ||||||
|  | 		c->tty.flags |= TTY_FREEZE; | ||||||
|  | 	c->tty.flags |= TTY_NOCURSOR; | ||||||
| 	c->flags |= CLIENT_REDRAWSTATUS; | 	c->flags |= CLIENT_REDRAWSTATUS; | ||||||
| } | } | ||||||
|  |  | ||||||
|   | |||||||
							
								
								
									
										5
									
								
								tmux.1
									
									
									
									
									
								
							
							
						
						
									
										5
									
								
								tmux.1
									
									
									
									
									
								
							| @@ -6742,7 +6742,7 @@ The following keys are available in menus: | |||||||
| .El | .El | ||||||
| .Tg display | .Tg display | ||||||
| .It Xo Ic display-message | .It Xo Ic display-message | ||||||
| .Op Fl aIlNpv | .Op Fl aCIlNpv | ||||||
| .Op Fl c Ar target-client | .Op Fl c Ar target-client | ||||||
| .Op Fl d Ar delay | .Op Fl d Ar delay | ||||||
| .Op Fl t Ar target-pane | .Op Fl t Ar target-pane | ||||||
| @@ -6765,6 +6765,9 @@ option is used; a delay of zero waits for a key press. | |||||||
| .Ql N | .Ql N | ||||||
| ignores key presses and closes only after the delay expires. | ignores key presses and closes only after the delay expires. | ||||||
| If | If | ||||||
|  | .Fl C | ||||||
|  | given, the pane will continue to be updated while the message is displayed. | ||||||
|  | If | ||||||
| .Fl l | .Fl l | ||||||
| is given, | is given, | ||||||
| .Ar message | .Ar message | ||||||
|   | |||||||
							
								
								
									
										2
									
								
								tmux.h
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								tmux.h
									
									
									
									
									
								
							| @@ -2847,7 +2847,7 @@ struct style_range *status_get_range(struct client *, u_int, u_int); | |||||||
| void	 status_init(struct client *); | void	 status_init(struct client *); | ||||||
| void	 status_free(struct client *); | void	 status_free(struct client *); | ||||||
| int	 status_redraw(struct client *); | int	 status_redraw(struct client *); | ||||||
| void printflike(5, 6) status_message_set(struct client *, int, int, int, | void printflike(6, 7) status_message_set(struct client *, int, int, int, int, | ||||||
| 	     const char *, ...); | 	     const char *, ...); | ||||||
| void	 status_message_clear(struct client *); | void	 status_message_clear(struct client *); | ||||||
| int	 status_message_redraw(struct client *); | int	 status_message_redraw(struct client *); | ||||||
|   | |||||||
| @@ -1000,7 +1000,7 @@ window_customize_set_option_callback(struct client *c, void *itemdata, | |||||||
|  |  | ||||||
| fail: | fail: | ||||||
| 	*cause = toupper((u_char)*cause); | 	*cause = toupper((u_char)*cause); | ||||||
| 	status_message_set(c, -1, 1, 0, "%s", cause); | 	status_message_set(c, -1, 1, 0, 0, "%s", cause); | ||||||
| 	free(cause); | 	free(cause); | ||||||
| 	return (0); | 	return (0); | ||||||
| } | } | ||||||
| @@ -1203,7 +1203,7 @@ window_customize_set_command_callback(struct client *c, void *itemdata, | |||||||
|  |  | ||||||
| fail: | fail: | ||||||
| 	*error = toupper((u_char)*error); | 	*error = toupper((u_char)*error); | ||||||
| 	status_message_set(c, -1, 1, 0, "%s", error); | 	status_message_set(c, -1, 1, 0, 0, "%s", error); | ||||||
| 	free(error); | 	free(error); | ||||||
| 	return (0); | 	return (0); | ||||||
| } | } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 nicm
					nicm