mirror of
				https://github.com/tmux/tmux.git
				synced 2025-10-26 12:27:15 +00:00 
			
		
		
		
	Redraw any visible modes when status line changes so that formats like
the pane title are updated. GitHub issue 2487. Also a man page fix from jmc.
This commit is contained in:
		| @@ -42,6 +42,7 @@ static void	server_client_repeat_timer(int, short, void *); | |||||||
| static void	server_client_click_timer(int, short, void *); | static void	server_client_click_timer(int, short, void *); | ||||||
| static void	server_client_check_exit(struct client *); | static void	server_client_check_exit(struct client *); | ||||||
| static void	server_client_check_redraw(struct client *); | static void	server_client_check_redraw(struct client *); | ||||||
|  | static void	server_client_check_modes(struct client *); | ||||||
| static void	server_client_set_title(struct client *); | static void	server_client_set_title(struct client *); | ||||||
| static void	server_client_reset_state(struct client *); | static void	server_client_reset_state(struct client *); | ||||||
| static int	server_client_assume_paste(struct session *); | static int	server_client_assume_paste(struct session *); | ||||||
| @@ -1355,6 +1356,7 @@ server_client_loop(void) | |||||||
| 	TAILQ_FOREACH(c, &clients, entry) { | 	TAILQ_FOREACH(c, &clients, entry) { | ||||||
| 		server_client_check_exit(c); | 		server_client_check_exit(c); | ||||||
| 		if (c->session != NULL) { | 		if (c->session != NULL) { | ||||||
|  | 			server_client_check_modes(c); | ||||||
| 			server_client_check_redraw(c); | 			server_client_check_redraw(c); | ||||||
| 			server_client_reset_state(c); | 			server_client_reset_state(c); | ||||||
| 		} | 		} | ||||||
| @@ -1810,6 +1812,28 @@ server_client_redraw_timer(__unused int fd, __unused short events, | |||||||
| 	log_debug("redraw timer fired"); | 	log_debug("redraw timer fired"); | ||||||
| } | } | ||||||
|  |  | ||||||
|  | /* | ||||||
|  |  * Check if modes need to be updated. Only modes in the current window are | ||||||
|  |  * updated and it is done when the status line is redrawn. | ||||||
|  |  */ | ||||||
|  | static void | ||||||
|  | server_client_check_modes(struct client *c) | ||||||
|  | { | ||||||
|  | 	struct window			*w = c->session->curw->window; | ||||||
|  | 	struct window_pane		*wp; | ||||||
|  | 	struct window_mode_entry	*wme; | ||||||
|  |  | ||||||
|  | 	if (c->flags & (CLIENT_CONTROL|CLIENT_SUSPENDED)) | ||||||
|  | 		return; | ||||||
|  | 	if (~c->flags & CLIENT_REDRAWSTATUS) | ||||||
|  | 		return; | ||||||
|  | 	TAILQ_FOREACH(wp, &w->panes, entry) { | ||||||
|  | 		wme = TAILQ_FIRST(&wp->modes); | ||||||
|  | 		if (wme != NULL && wme->mode->update != NULL) | ||||||
|  | 			wme->mode->update(wme); | ||||||
|  | 	} | ||||||
|  | } | ||||||
|  |  | ||||||
| /* Check for client redraws. */ | /* Check for client redraws. */ | ||||||
| static void | static void | ||||||
| server_client_check_redraw(struct client *c) | server_client_check_redraw(struct client *c) | ||||||
|   | |||||||
							
								
								
									
										1
									
								
								tmux.h
									
									
									
									
									
								
							
							
						
						
									
										1
									
								
								tmux.h
									
									
									
									
									
								
							| @@ -887,6 +887,7 @@ struct window_mode { | |||||||
| 			     struct cmd_find_state *, struct args *); | 			     struct cmd_find_state *, struct args *); | ||||||
| 	void		 (*free)(struct window_mode_entry *); | 	void		 (*free)(struct window_mode_entry *); | ||||||
| 	void		 (*resize)(struct window_mode_entry *, u_int, u_int); | 	void		 (*resize)(struct window_mode_entry *, u_int, u_int); | ||||||
|  | 	void		 (*update)(struct window_mode_entry *); | ||||||
| 	void		 (*key)(struct window_mode_entry *, struct client *, | 	void		 (*key)(struct window_mode_entry *, struct client *, | ||||||
| 			     struct session *, struct winlink *, key_code, | 			     struct session *, struct winlink *, key_code, | ||||||
| 			     struct mouse_event *); | 			     struct mouse_event *); | ||||||
|   | |||||||
							
								
								
									
										4
									
								
								tty.c
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								tty.c
									
									
									
									
									
								
							| @@ -2447,7 +2447,7 @@ tty_check_fg(struct tty *tty, int *palette, struct grid_cell *gc) | |||||||
| 	/* Is this a 256-colour colour? */ | 	/* Is this a 256-colour colour? */ | ||||||
| 	if (gc->fg & COLOUR_FLAG_256) { | 	if (gc->fg & COLOUR_FLAG_256) { | ||||||
| 		/* And not a 256 colour mode? */ | 		/* And not a 256 colour mode? */ | ||||||
| 		if (colours != 256) { | 		if (colours < 256) { | ||||||
| 			gc->fg = colour_256to16(gc->fg); | 			gc->fg = colour_256to16(gc->fg); | ||||||
| 			if (gc->fg & 8) { | 			if (gc->fg & 8) { | ||||||
| 				gc->fg &= 7; | 				gc->fg &= 7; | ||||||
| @@ -2500,7 +2500,7 @@ tty_check_bg(struct tty *tty, int *palette, struct grid_cell *gc) | |||||||
| 		 * palette. Bold background doesn't exist portably, so just | 		 * palette. Bold background doesn't exist portably, so just | ||||||
| 		 * discard the bold bit if set. | 		 * discard the bold bit if set. | ||||||
| 		 */ | 		 */ | ||||||
| 		if (colours != 256) { | 		if (colours < 256) { | ||||||
| 			gc->bg = colour_256to16(gc->bg); | 			gc->bg = colour_256to16(gc->bg); | ||||||
| 			if (gc->bg & 8) { | 			if (gc->bg & 8) { | ||||||
| 				gc->bg &= 7; | 				gc->bg &= 7; | ||||||
|   | |||||||
| @@ -31,6 +31,7 @@ static struct screen	*window_buffer_init(struct window_mode_entry *, | |||||||
| static void		 window_buffer_free(struct window_mode_entry *); | static void		 window_buffer_free(struct window_mode_entry *); | ||||||
| static void		 window_buffer_resize(struct window_mode_entry *, u_int, | static void		 window_buffer_resize(struct window_mode_entry *, u_int, | ||||||
| 			     u_int); | 			     u_int); | ||||||
|  | static void		 window_buffer_update(struct window_mode_entry *); | ||||||
| static void		 window_buffer_key(struct window_mode_entry *, | static void		 window_buffer_key(struct window_mode_entry *, | ||||||
| 			     struct client *, struct session *, | 			     struct client *, struct session *, | ||||||
| 			     struct winlink *, key_code, struct mouse_event *); | 			     struct winlink *, key_code, struct mouse_event *); | ||||||
| @@ -63,6 +64,7 @@ const struct window_mode window_buffer_mode = { | |||||||
| 	.init = window_buffer_init, | 	.init = window_buffer_init, | ||||||
| 	.free = window_buffer_free, | 	.free = window_buffer_free, | ||||||
| 	.resize = window_buffer_resize, | 	.resize = window_buffer_resize, | ||||||
|  | 	.update = window_buffer_update, | ||||||
| 	.key = window_buffer_key, | 	.key = window_buffer_key, | ||||||
| }; | }; | ||||||
|  |  | ||||||
| @@ -335,6 +337,16 @@ window_buffer_resize(struct window_mode_entry *wme, u_int sx, u_int sy) | |||||||
| 	mode_tree_resize(data->data, sx, sy); | 	mode_tree_resize(data->data, sx, sy); | ||||||
| } | } | ||||||
|  |  | ||||||
|  | static void | ||||||
|  | window_buffer_update(struct window_mode_entry *wme) | ||||||
|  | { | ||||||
|  | 	struct window_buffer_modedata	*data = wme->data; | ||||||
|  |  | ||||||
|  | 	mode_tree_build(data->data); | ||||||
|  | 	mode_tree_draw(data->data); | ||||||
|  | 	data->wp->flags |= PANE_REDRAW; | ||||||
|  | } | ||||||
|  |  | ||||||
| static void | static void | ||||||
| window_buffer_do_delete(void *modedata, void *itemdata, | window_buffer_do_delete(void *modedata, void *itemdata, | ||||||
|     __unused struct client *c, __unused key_code key) |     __unused struct client *c, __unused key_code key) | ||||||
|   | |||||||
| @@ -30,6 +30,7 @@ static struct screen	*window_client_init(struct window_mode_entry *, | |||||||
| static void		 window_client_free(struct window_mode_entry *); | static void		 window_client_free(struct window_mode_entry *); | ||||||
| static void		 window_client_resize(struct window_mode_entry *, u_int, | static void		 window_client_resize(struct window_mode_entry *, u_int, | ||||||
| 			     u_int); | 			     u_int); | ||||||
|  | static void		 window_client_update(struct window_mode_entry *); | ||||||
| static void		 window_client_key(struct window_mode_entry *, | static void		 window_client_key(struct window_mode_entry *, | ||||||
| 			     struct client *, struct session *, | 			     struct client *, struct session *, | ||||||
| 			     struct winlink *, key_code, struct mouse_event *); | 			     struct winlink *, key_code, struct mouse_event *); | ||||||
| @@ -59,6 +60,7 @@ const struct window_mode window_client_mode = { | |||||||
| 	.init = window_client_init, | 	.init = window_client_init, | ||||||
| 	.free = window_client_free, | 	.free = window_client_free, | ||||||
| 	.resize = window_client_resize, | 	.resize = window_client_resize, | ||||||
|  | 	.update = window_client_update, | ||||||
| 	.key = window_client_key, | 	.key = window_client_key, | ||||||
| }; | }; | ||||||
|  |  | ||||||
| @@ -311,6 +313,16 @@ window_client_resize(struct window_mode_entry *wme, u_int sx, u_int sy) | |||||||
| 	mode_tree_resize(data->data, sx, sy); | 	mode_tree_resize(data->data, sx, sy); | ||||||
| } | } | ||||||
|  |  | ||||||
|  | static void | ||||||
|  | window_client_update(struct window_mode_entry *wme) | ||||||
|  | { | ||||||
|  | 	struct window_client_modedata	*data = wme->data; | ||||||
|  |  | ||||||
|  | 	mode_tree_build(data->data); | ||||||
|  | 	mode_tree_draw(data->data); | ||||||
|  | 	data->wp->flags |= PANE_REDRAW; | ||||||
|  | } | ||||||
|  |  | ||||||
| static void | static void | ||||||
| window_client_do_detach(void *modedata, void *itemdata, | window_client_do_detach(void *modedata, void *itemdata, | ||||||
|     __unused struct client *c, key_code key) |     __unused struct client *c, key_code key) | ||||||
|   | |||||||
| @@ -29,6 +29,7 @@ static struct screen	*window_tree_init(struct window_mode_entry *, | |||||||
| static void		 window_tree_free(struct window_mode_entry *); | static void		 window_tree_free(struct window_mode_entry *); | ||||||
| static void		 window_tree_resize(struct window_mode_entry *, u_int, | static void		 window_tree_resize(struct window_mode_entry *, u_int, | ||||||
| 			     u_int); | 			     u_int); | ||||||
|  | static void		 window_tree_update(struct window_mode_entry *); | ||||||
| static void		 window_tree_key(struct window_mode_entry *, | static void		 window_tree_key(struct window_mode_entry *, | ||||||
| 			     struct client *, struct session *, | 			     struct client *, struct session *, | ||||||
| 			     struct winlink *, key_code, struct mouse_event *); | 			     struct winlink *, key_code, struct mouse_event *); | ||||||
| @@ -79,6 +80,7 @@ const struct window_mode window_tree_mode = { | |||||||
| 	.init = window_tree_init, | 	.init = window_tree_init, | ||||||
| 	.free = window_tree_free, | 	.free = window_tree_free, | ||||||
| 	.resize = window_tree_resize, | 	.resize = window_tree_resize, | ||||||
|  | 	.update = window_tree_update, | ||||||
| 	.key = window_tree_key, | 	.key = window_tree_key, | ||||||
| }; | }; | ||||||
|  |  | ||||||
| @@ -937,6 +939,16 @@ window_tree_resize(struct window_mode_entry *wme, u_int sx, u_int sy) | |||||||
| 	mode_tree_resize(data->data, sx, sy); | 	mode_tree_resize(data->data, sx, sy); | ||||||
| } | } | ||||||
|  |  | ||||||
|  | static void | ||||||
|  | window_tree_update(struct window_mode_entry *wme) | ||||||
|  | { | ||||||
|  | 	struct window_tree_modedata	*data = wme->data; | ||||||
|  |  | ||||||
|  | 	mode_tree_build(data->data); | ||||||
|  | 	mode_tree_draw(data->data); | ||||||
|  | 	data->wp->flags |= PANE_REDRAW; | ||||||
|  | } | ||||||
|  |  | ||||||
| static char * | static char * | ||||||
| window_tree_get_target(struct window_tree_itemdata *item, | window_tree_get_target(struct window_tree_itemdata *item, | ||||||
|     struct cmd_find_state *fs) |     struct cmd_find_state *fs) | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 nicm
					nicm