mirror of
				https://github.com/tmux/tmux.git
				synced 2025-10-26 12:27:15 +00:00 
			
		
		
		
	Tidy up mode-mouse check.
This commit is contained in:
		| @@ -49,7 +49,6 @@ cmd_paste_buffer_exec(struct cmd *self, struct cmd_q *cmdq) | ||||
| 	struct session		*s; | ||||
| 	struct paste_buffer	*pb; | ||||
| 	const char		*sepstr, *bufname; | ||||
| 	int			 pflag; | ||||
|  | ||||
| 	if (cmd_find_pane(cmdq, args_get(args, 't'), &s, &wp) == NULL) | ||||
| 		return (CMD_RETURN_ERROR); | ||||
| @@ -76,8 +75,7 @@ cmd_paste_buffer_exec(struct cmd *self, struct cmd_q *cmdq) | ||||
| 			else | ||||
| 				sepstr = "\r"; | ||||
| 		} | ||||
| 		pflag = (wp->screen->mode & MODE_BRACKETPASTE); | ||||
| 		paste_send_pane(pb, wp, sepstr, args_has(args, 'p') && pflag); | ||||
| 		paste_send_pane(pb, wp, sepstr, args_has(args, 'p')); | ||||
| 	} | ||||
|  | ||||
| 	/* Delete the buffer if -d. */ | ||||
|   | ||||
							
								
								
									
										18
									
								
								input-keys.c
									
									
									
									
									
								
							
							
						
						
									
										18
									
								
								input-keys.c
									
									
									
									
									
								
							| @@ -205,6 +205,7 @@ input_mouse(struct window_pane *wp, struct session *s, struct mouse_event *m) | ||||
| 	char			 buf[40]; | ||||
| 	size_t			 len; | ||||
| 	struct paste_buffer	*pb; | ||||
| 	int			 event; | ||||
|  | ||||
| 	if (wp->screen->mode & ALL_MOUSE_MODES) { | ||||
| 		/* | ||||
| @@ -238,19 +239,16 @@ input_mouse(struct window_pane *wp, struct session *s, struct mouse_event *m) | ||||
| 		return; | ||||
| 	} | ||||
|  | ||||
| 	if (m->button == 1 && (m->event & MOUSE_EVENT_CLICK) && | ||||
| 	    options_get_number(&wp->window->options, "mode-mouse") == 1) { | ||||
| 	if (options_get_number(&wp->window->options, "mode-mouse") != 1) | ||||
| 		return; | ||||
| 	event = m->event & (MOUSE_EVENT_CLICK|MOUSE_EVENT_WHEEL); | ||||
| 	if (wp->mode == NULL && m->button == 1 && event == MOUSE_EVENT_CLICK) { | ||||
| 		pb = paste_get_top(); | ||||
| 		if (pb != NULL) { | ||||
| 			paste_send_pane(pb, wp, "\r", | ||||
| 			    wp->screen->mode & MODE_BRACKETPASTE); | ||||
| 		} | ||||
| 	} else if (m->button != 1 && | ||||
| 	    options_get_number(&wp->window->options, "mode-mouse") == 1) { | ||||
| 		if (window_pane_set_mode(wp, &window_copy_mode) == 0) { | ||||
| 		if (pb != NULL) | ||||
| 			paste_send_pane(pb, wp, "\r", 1); | ||||
| 	} else if (window_pane_set_mode(wp, &window_copy_mode) == 0) { | ||||
| 		window_copy_init_from_pane(wp); | ||||
| 		if (wp->mode->mouse != NULL) | ||||
| 			wp->mode->mouse(wp, s, m); | ||||
| 	} | ||||
| 	} | ||||
| } | ||||
|   | ||||
							
								
								
									
										4
									
								
								paste.c
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								paste.c
									
									
									
									
									
								
							| @@ -301,7 +301,7 @@ paste_send_pane(struct paste_buffer *pb, struct window_pane *wp, | ||||
| 	if (wp->flags & PANE_INPUTOFF) | ||||
| 		return; | ||||
|  | ||||
| 	if (bracket) | ||||
| 	if (bracket && (wp->screen->mode & MODE_BRACKETPASTE)) | ||||
| 		bufferevent_write(wp->event, "\033[200~", 6); | ||||
|  | ||||
| 	seplen = strlen(sep); | ||||
| @@ -315,6 +315,6 @@ paste_send_pane(struct paste_buffer *pb, struct window_pane *wp, | ||||
| 	if (end != data) | ||||
| 		bufferevent_write(wp->event, data, end - data); | ||||
|  | ||||
| 	if (bracket) | ||||
| 	if (bracket && (wp->screen->mode & MODE_BRACKETPASTE)) | ||||
| 		bufferevent_write(wp->event, "\033[201~", 6); | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 nicm
					nicm