mirror of
				https://github.com/tmux/tmux.git
				synced 2025-11-04 00:56:10 +00:00 
			
		
		
		
	Tidy changing the mode into window_copy_init_for_output.
This commit is contained in:
		
							
								
								
									
										1
									
								
								cfg.c
									
									
									
									
									
								
							
							
						
						
									
										1
									
								
								cfg.c
									
									
									
									
									
								
							@@ -348,7 +348,6 @@ cfg_show_causes(struct session *s)
 | 
				
			|||||||
		return;
 | 
							return;
 | 
				
			||||||
	wp = s->curw->window->active;
 | 
						wp = s->curw->window->active;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	window_pane_set_mode(wp, &window_copy_mode, NULL, NULL);
 | 
					 | 
				
			||||||
	window_copy_init_for_output(wp);
 | 
						window_copy_init_for_output(wp);
 | 
				
			||||||
	for (i = 0; i < cfg_ncauses; i++) {
 | 
						for (i = 0; i < cfg_ncauses; i++) {
 | 
				
			||||||
		window_copy_add(wp, "%s", cfg_causes[i]);
 | 
							window_copy_add(wp, "%s", cfg_causes[i]);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -426,12 +426,7 @@ cmdq_print(struct cmdq_item *item, const char *fmt, ...)
 | 
				
			|||||||
		server_client_push_stdout(c);
 | 
							server_client_push_stdout(c);
 | 
				
			||||||
	} else {
 | 
						} else {
 | 
				
			||||||
		w = c->session->curw->window;
 | 
							w = c->session->curw->window;
 | 
				
			||||||
		if (w->active->mode != &window_copy_mode) {
 | 
							window_copy_init_for_output(w->active);
 | 
				
			||||||
			window_pane_reset_mode(w->active);
 | 
					 | 
				
			||||||
			window_pane_set_mode(w->active, &window_copy_mode, NULL,
 | 
					 | 
				
			||||||
			    NULL);
 | 
					 | 
				
			||||||
			window_copy_init_for_output(w->active);
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
		window_copy_vadd(w->active, fmt, ap);
 | 
							window_copy_vadd(w->active, fmt, ap);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -75,10 +75,8 @@ cmd_run_shell_print(struct job *job, const char *msg)
 | 
				
			|||||||
			return;
 | 
								return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (window_pane_set_mode(wp, &window_copy_mode, NULL, NULL) == 0)
 | 
						window_copy_init_for_output(wp);
 | 
				
			||||||
		window_copy_init_for_output(wp);
 | 
						window_copy_add(wp, "%s", msg);
 | 
				
			||||||
	if (wp->mode == &window_copy_mode)
 | 
					 | 
				
			||||||
		window_copy_add(wp, "%s", msg);
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static enum cmd_retval
 | 
					static enum cmd_retval
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -263,6 +263,12 @@ window_copy_init_for_output(struct window_pane *wp)
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
	struct window_copy_mode_data	*data = wp->modedata;
 | 
						struct window_copy_mode_data	*data = wp->modedata;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (wp->mode == &window_copy_mode && data->backing != &wp->base)
 | 
				
			||||||
 | 
							return;
 | 
				
			||||||
 | 
						window_pane_reset_mode(wp);
 | 
				
			||||||
 | 
						window_pane_set_mode(wp, &window_copy_mode, NULL, NULL);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						data = wp->modedata;
 | 
				
			||||||
	data->backing = xmalloc(sizeof *data->backing);
 | 
						data->backing = xmalloc(sizeof *data->backing);
 | 
				
			||||||
	screen_init(data->backing, screen_size_x(&wp->base),
 | 
						screen_init(data->backing, screen_size_x(&wp->base),
 | 
				
			||||||
	    screen_size_y(&wp->base), UINT_MAX);
 | 
						    screen_size_y(&wp->base), UINT_MAX);
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user