mirror of
				https://github.com/tmux/tmux.git
				synced 2025-10-26 12:27:15 +00:00 
			
		
		
		
	Merge branch 'obsd-master'
This commit is contained in:
		
							
								
								
									
										2
									
								
								client.c
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								client.c
									
									
									
									
									
								
							| @@ -646,7 +646,7 @@ client_read_open(void *data, size_t datalen) | |||||||
| 	struct msg_read_done	 reply; | 	struct msg_read_done	 reply; | ||||||
| 	struct client_file	 find, *cf; | 	struct client_file	 find, *cf; | ||||||
| 	const int		 flags = O_NONBLOCK|O_RDONLY; | 	const int		 flags = O_NONBLOCK|O_RDONLY; | ||||||
| 	int			 error = 0; | 	int			 error; | ||||||
|  |  | ||||||
| 	if (datalen < sizeof *msg) | 	if (datalen < sizeof *msg) | ||||||
| 		fatalx("bad MSG_READ_OPEN size"); | 		fatalx("bad MSG_READ_OPEN size"); | ||||||
|   | |||||||
							
								
								
									
										22
									
								
								cmd-find.c
									
									
									
									
									
								
							
							
						
						
									
										22
									
								
								cmd-find.c
									
									
									
									
									
								
							| @@ -1230,29 +1230,31 @@ no_pane: | |||||||
| static struct client * | static struct client * | ||||||
| cmd_find_current_client(struct cmdq_item *item, int quiet) | cmd_find_current_client(struct cmdq_item *item, int quiet) | ||||||
| { | { | ||||||
| 	struct client		*c; | 	struct client		*c = NULL, *found; | ||||||
| 	struct session		*s; | 	struct session		*s; | ||||||
| 	struct window_pane	*wp; | 	struct window_pane	*wp; | ||||||
| 	struct cmd_find_state	 fs; | 	struct cmd_find_state	 fs; | ||||||
|  |  | ||||||
| 	if (item->client != NULL && item->client->session != NULL) | 	if (item != NULL) | ||||||
| 		return (item->client); | 		c = item->client; | ||||||
|  | 	if (c != NULL && c->session != NULL) | ||||||
|  | 		return (c); | ||||||
|  |  | ||||||
| 	c = NULL; | 	found = NULL; | ||||||
| 	if ((wp = cmd_find_inside_pane(item->client)) != NULL) { | 	if (c != NULL && (wp = cmd_find_inside_pane(c)) != NULL) { | ||||||
| 		cmd_find_clear_state(&fs, CMD_FIND_QUIET); | 		cmd_find_clear_state(&fs, CMD_FIND_QUIET); | ||||||
| 		fs.w = wp->window; | 		fs.w = wp->window; | ||||||
| 		if (cmd_find_best_session_with_window(&fs) == 0) | 		if (cmd_find_best_session_with_window(&fs) == 0) | ||||||
| 			c = cmd_find_best_client(fs.s); | 			found = cmd_find_best_client(fs.s); | ||||||
| 	} else { | 	} else { | ||||||
| 		s = cmd_find_best_session(NULL, 0, CMD_FIND_QUIET); | 		s = cmd_find_best_session(NULL, 0, CMD_FIND_QUIET); | ||||||
| 		if (s != NULL) | 		if (s != NULL) | ||||||
| 			c = cmd_find_best_client(s); | 			found = cmd_find_best_client(s); | ||||||
| 	} | 	} | ||||||
| 	if (c == NULL && !quiet) | 	if (found == NULL && item != NULL && !quiet) | ||||||
| 		cmdq_error(item, "no current client"); | 		cmdq_error(item, "no current client"); | ||||||
| 	log_debug("%s: no target, return %p", __func__, c); | 	log_debug("%s: no target, return %p", __func__, found); | ||||||
| 	return (c); | 	return (found); | ||||||
| } | } | ||||||
|  |  | ||||||
| /* Find the target client or report an error and return NULL. */ | /* Find the target client or report an error and return NULL. */ | ||||||
|   | |||||||
| @@ -269,7 +269,7 @@ cmd_list_keys_exec(struct cmd *self, struct cmdq_item *item) | |||||||
| 				tmpsize *= 2; | 				tmpsize *= 2; | ||||||
| 				tmp = xrealloc(tmp, tmpsize); | 				tmp = xrealloc(tmp, tmpsize); | ||||||
| 			} | 			} | ||||||
| 			tmpused = strlcat(tmp, cp, tmpsize); | 			strlcat(tmp, cp, tmpsize); | ||||||
| 			tmpused = strlcat(tmp, " ", tmpsize); | 			tmpused = strlcat(tmp, " ", tmpsize); | ||||||
| 			free(cp); | 			free(cp); | ||||||
|  |  | ||||||
| @@ -279,7 +279,7 @@ cmd_list_keys_exec(struct cmd *self, struct cmdq_item *item) | |||||||
| 				tmpsize *= 2; | 				tmpsize *= 2; | ||||||
| 				tmp = xrealloc(tmp, tmpsize); | 				tmp = xrealloc(tmp, tmpsize); | ||||||
| 			} | 			} | ||||||
| 			tmpused = strlcat(tmp, cp, tmpsize); | 			strlcat(tmp, cp, tmpsize); | ||||||
| 			tmpused = strlcat(tmp, " ", tmpsize); | 			tmpused = strlcat(tmp, " ", tmpsize); | ||||||
| 			free(cp); | 			free(cp); | ||||||
|  |  | ||||||
|   | |||||||
| @@ -207,7 +207,8 @@ cmd_new_session_exec(struct cmd *self, struct cmdq_item *item) | |||||||
| 				goto fail; | 				goto fail; | ||||||
| 			} | 			} | ||||||
| 		} | 		} | ||||||
| 	} | 	} else | ||||||
|  | 		dsx = 80; | ||||||
| 	if (args_has(args, 'y')) { | 	if (args_has(args, 'y')) { | ||||||
| 		tmp = args_get(args, 'y'); | 		tmp = args_get(args, 'y'); | ||||||
| 		if (strcmp(tmp, "-") == 0) { | 		if (strcmp(tmp, "-") == 0) { | ||||||
| @@ -222,7 +223,8 @@ cmd_new_session_exec(struct cmd *self, struct cmdq_item *item) | |||||||
| 				goto fail; | 				goto fail; | ||||||
| 			} | 			} | ||||||
| 		} | 		} | ||||||
| 	} | 	} else | ||||||
|  | 		dsy = 24; | ||||||
|  |  | ||||||
| 	/* Find new session size. */ | 	/* Find new session size. */ | ||||||
| 	if (!detached && !is_control) { | 	if (!detached && !is_control) { | ||||||
| @@ -233,14 +235,15 @@ cmd_new_session_exec(struct cmd *self, struct cmdq_item *item) | |||||||
| 	} else { | 	} else { | ||||||
| 		tmp = options_get_string(global_s_options, "default-size"); | 		tmp = options_get_string(global_s_options, "default-size"); | ||||||
| 		if (sscanf(tmp, "%ux%u", &sx, &sy) != 2) { | 		if (sscanf(tmp, "%ux%u", &sx, &sy) != 2) { | ||||||
| 			sx = 80; | 			sx = dsx; | ||||||
| 			sy = 24; | 			sy = dsy; | ||||||
| 		} | 		} else { | ||||||
| 			if (args_has(args, 'x')) | 			if (args_has(args, 'x')) | ||||||
| 				sx = dsx; | 				sx = dsx; | ||||||
| 			if (args_has(args, 'y')) | 			if (args_has(args, 'y')) | ||||||
| 				sy = dsy; | 				sy = dsy; | ||||||
| 		} | 		} | ||||||
|  | 	} | ||||||
| 	if (sx == 0) | 	if (sx == 0) | ||||||
| 		sx = 1; | 		sx = 1; | ||||||
| 	if (sy == 0) | 	if (sy == 0) | ||||||
|   | |||||||
| @@ -152,7 +152,7 @@ cmd_send_keys_exec(struct cmd *self, struct cmdq_item *item) | |||||||
| 			return (CMD_RETURN_ERROR); | 			return (CMD_RETURN_ERROR); | ||||||
| 		} | 		} | ||||||
| 		if (wme != NULL && (args_has(args, 'X') || args->argc == 0)) { | 		if (wme != NULL && (args_has(args, 'X') || args->argc == 0)) { | ||||||
| 			if (wme == NULL || wme->mode->command == NULL) { | 			if (wme->mode->command == NULL) { | ||||||
| 				cmdq_error(item, "not in a mode"); | 				cmdq_error(item, "not in a mode"); | ||||||
| 				return (CMD_RETURN_ERROR); | 				return (CMD_RETURN_ERROR); | ||||||
| 			} | 			} | ||||||
|   | |||||||
| @@ -211,11 +211,9 @@ cmd_show_options_all(struct cmd *self, struct cmdq_item *item, int scope, | |||||||
|  |  | ||||||
| 		if ((self->entry != &cmd_show_hooks_entry && | 		if ((self->entry != &cmd_show_hooks_entry && | ||||||
| 		    !args_has(self->args, 'H') && | 		    !args_has(self->args, 'H') && | ||||||
| 		    oe != NULL && |  | ||||||
| 		    (oe->flags & OPTIONS_TABLE_IS_HOOK)) || | 		    (oe->flags & OPTIONS_TABLE_IS_HOOK)) || | ||||||
| 		    (self->entry == &cmd_show_hooks_entry && | 		    (self->entry == &cmd_show_hooks_entry && | ||||||
| 		    (oe == NULL || | 		    (~oe->flags & OPTIONS_TABLE_IS_HOOK))) | ||||||
| 		    (~oe->flags & OPTIONS_TABLE_IS_HOOK)))) |  | ||||||
| 			continue; | 			continue; | ||||||
|  |  | ||||||
| 		o = options_get_only(oo, oe->name); | 		o = options_get_only(oo, oe->name); | ||||||
|   | |||||||
| @@ -73,7 +73,6 @@ cmd_switch_client_exec(struct cmd *self, struct cmdq_item *item) | |||||||
| 		return (CMD_RETURN_ERROR); | 		return (CMD_RETURN_ERROR); | ||||||
| 	s = item->target.s; | 	s = item->target.s; | ||||||
| 	wl = item->target.wl; | 	wl = item->target.wl; | ||||||
| 	w = wl->window; |  | ||||||
| 	wp = item->target.wp; | 	wp = item->target.wp; | ||||||
|  |  | ||||||
| 	if (args_has(args, 'r')) | 	if (args_has(args, 'r')) | ||||||
| @@ -115,6 +114,7 @@ cmd_switch_client_exec(struct cmd *self, struct cmdq_item *item) | |||||||
| 		if (item->client == NULL) | 		if (item->client == NULL) | ||||||
| 			return (CMD_RETURN_NORMAL); | 			return (CMD_RETURN_NORMAL); | ||||||
| 		if (wl != NULL && wp != NULL) { | 		if (wl != NULL && wp != NULL) { | ||||||
|  | 			w = wl->window; | ||||||
| 			if (window_push_zoom(w, args_has(self->args, 'Z'))) | 			if (window_push_zoom(w, args_has(self->args, 'Z'))) | ||||||
| 				server_redraw_window(w); | 				server_redraw_window(w); | ||||||
| 			window_redraw_active_switch(w, wp); | 			window_redraw_active_switch(w, wp); | ||||||
|   | |||||||
							
								
								
									
										6
									
								
								format.c
									
									
									
									
									
								
							
							
						
						
									
										6
									
								
								format.c
									
									
									
									
									
								
							| @@ -900,11 +900,12 @@ static void | |||||||
| format_cb_pane_at_top(struct format_tree *ft, struct format_entry *fe) | format_cb_pane_at_top(struct format_tree *ft, struct format_entry *fe) | ||||||
| { | { | ||||||
| 	struct window_pane	*wp = ft->wp; | 	struct window_pane	*wp = ft->wp; | ||||||
| 	struct window		*w = wp->window; | 	struct window		*w; | ||||||
| 	int			 status, flag; | 	int			 status, flag; | ||||||
|  |  | ||||||
| 	if (wp == NULL) | 	if (wp == NULL) | ||||||
| 		return; | 		return; | ||||||
|  | 	w = wp->window; | ||||||
|  |  | ||||||
| 	status = options_get_number(w->options, "pane-border-status"); | 	status = options_get_number(w->options, "pane-border-status"); | ||||||
| 	if (status == PANE_STATUS_TOP) | 	if (status == PANE_STATUS_TOP) | ||||||
| @@ -919,11 +920,12 @@ static void | |||||||
| format_cb_pane_at_bottom(struct format_tree *ft, struct format_entry *fe) | format_cb_pane_at_bottom(struct format_tree *ft, struct format_entry *fe) | ||||||
| { | { | ||||||
| 	struct window_pane	*wp = ft->wp; | 	struct window_pane	*wp = ft->wp; | ||||||
| 	struct window		*w = wp->window; | 	struct window		*w; | ||||||
| 	int			 status, flag; | 	int			 status, flag; | ||||||
|  |  | ||||||
| 	if (wp == NULL) | 	if (wp == NULL) | ||||||
| 		return; | 		return; | ||||||
|  | 	w = wp->window; | ||||||
|  |  | ||||||
| 	status = options_get_number(w->options, "pane-border-status"); | 	status = options_get_number(w->options, "pane-border-status"); | ||||||
| 	if (status == PANE_STATUS_BOTTOM) | 	if (status == PANE_STATUS_BOTTOM) | ||||||
|   | |||||||
							
								
								
									
										8
									
								
								grid.c
									
									
									
									
									
								
							
							
						
						
									
										8
									
								
								grid.c
									
									
									
									
									
								
							| @@ -1343,18 +1343,14 @@ grid_wrap_position(struct grid *gd, u_int px, u_int py, u_int *wx, u_int *wy) | |||||||
| void | void | ||||||
| grid_unwrap_position(struct grid *gd, u_int *px, u_int *py, u_int wx, u_int wy) | grid_unwrap_position(struct grid *gd, u_int *px, u_int *py, u_int wx, u_int wy) | ||||||
| { | { | ||||||
| 	u_int	yy, ax = 0, ay = 0; | 	u_int	yy, ay = 0; | ||||||
|  |  | ||||||
| 	for (yy = 0; yy < gd->hsize + gd->sy - 1; yy++) { | 	for (yy = 0; yy < gd->hsize + gd->sy - 1; yy++) { | ||||||
| 		if (ay == wy) | 		if (ay == wy) | ||||||
| 			break; | 			break; | ||||||
| 		if (gd->linedata[yy].flags & GRID_LINE_WRAPPED) | 		if (~gd->linedata[yy].flags & GRID_LINE_WRAPPED) | ||||||
| 			ax += gd->linedata[yy].cellused; |  | ||||||
| 		else { |  | ||||||
| 			ax = 0; |  | ||||||
| 			ay++; | 			ay++; | ||||||
| 	} | 	} | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	/* | 	/* | ||||||
| 	 * yy is now 0 on the unwrapped line which contains wx. Walk forwards | 	 * yy is now 0 on the unwrapped line which contains wx. Walk forwards | ||||||
|   | |||||||
| @@ -229,10 +229,8 @@ key_string_lookup_string(const char *string) | |||||||
| 			key -= 64; | 			key -= 64; | ||||||
| 		else if (key == 32) | 		else if (key == 32) | ||||||
| 			key = 0; | 			key = 0; | ||||||
| 		else if (key == '?') |  | ||||||
| 			key = 127; |  | ||||||
| 		else if (key == 63) | 		else if (key == 63) | ||||||
| 			key = KEYC_BSPACE; | 			key = 127; | ||||||
| 		else | 		else | ||||||
| 			return (KEYC_UNKNOWN); | 			return (KEYC_UNKNOWN); | ||||||
| 		modifiers &= ~KEYC_CTRL; | 		modifiers &= ~KEYC_CTRL; | ||||||
|   | |||||||
							
								
								
									
										3
									
								
								regsub.c
									
									
									
									
									
								
							
							
						
						
									
										3
									
								
								regsub.c
									
									
									
									
									
								
							| @@ -24,8 +24,7 @@ | |||||||
| #include "tmux.h" | #include "tmux.h" | ||||||
|  |  | ||||||
| static void | static void | ||||||
| regsub_copy(char **buf, size_t *len, const char *text, size_t start, | regsub_copy(char **buf, size_t *len, const char *text, size_t start, size_t end) | ||||||
|     size_t end) |  | ||||||
| { | { | ||||||
| 	size_t	add = end - start; | 	size_t	add = end - start; | ||||||
|  |  | ||||||
|   | |||||||
| @@ -604,10 +604,9 @@ have_event: | |||||||
| 			wp = window_get_active_at(s->curw->window, px, py); | 			wp = window_get_active_at(s->curw->window, px, py); | ||||||
| 			if (wp != NULL) | 			if (wp != NULL) | ||||||
| 				where = PANE; | 				where = PANE; | ||||||
| 		} | 			else | ||||||
|  |  | ||||||
| 		if (where == NOWHERE) |  | ||||||
| 				return (KEYC_UNKNOWN); | 				return (KEYC_UNKNOWN); | ||||||
|  | 		} | ||||||
| 		if (where == PANE) | 		if (where == PANE) | ||||||
| 			log_debug("mouse %u,%u on pane %%%u", x, y, wp->id); | 			log_debug("mouse %u,%u on pane %%%u", x, y, wp->id); | ||||||
| 		else if (where == BORDER) | 		else if (where == BORDER) | ||||||
| @@ -1541,7 +1540,7 @@ server_client_reset_state(struct client *c) | |||||||
| 	struct window_pane	*wp = w->active, *loop; | 	struct window_pane	*wp = w->active, *loop; | ||||||
| 	struct screen		*s; | 	struct screen		*s; | ||||||
| 	struct options		*oo = c->session->options; | 	struct options		*oo = c->session->options; | ||||||
| 	int			 mode, cursor = 0; | 	int			 mode, cursor; | ||||||
| 	u_int			 cx = 0, cy = 0, ox, oy, sx, sy; | 	u_int			 cx = 0, cy = 0, ox, oy, sx, sy; | ||||||
|  |  | ||||||
| 	if (c->flags & (CLIENT_CONTROL|CLIENT_SUSPENDED)) | 	if (c->flags & (CLIENT_CONTROL|CLIENT_SUSPENDED)) | ||||||
|   | |||||||
							
								
								
									
										1
									
								
								tmux.h
									
									
									
									
									
								
							
							
						
						
									
										1
									
								
								tmux.h
									
									
									
									
									
								
							| @@ -2471,7 +2471,6 @@ void	 screen_select_cell(struct screen *, struct grid_cell *, | |||||||
| void	 screen_alternate_on(struct screen *, struct grid_cell *, int); | void	 screen_alternate_on(struct screen *, struct grid_cell *, int); | ||||||
| void	 screen_alternate_off(struct screen *, struct grid_cell *, int); | void	 screen_alternate_off(struct screen *, struct grid_cell *, int); | ||||||
|  |  | ||||||
|  |  | ||||||
| /* window.c */ | /* window.c */ | ||||||
| extern struct windows windows; | extern struct windows windows; | ||||||
| extern struct window_pane_tree all_window_panes; | extern struct window_pane_tree all_window_panes; | ||||||
|   | |||||||
| @@ -347,9 +347,8 @@ window_buffer_do_paste(void *modedata, void *itemdata, struct client *c, | |||||||
| { | { | ||||||
| 	struct window_buffer_modedata	*data = modedata; | 	struct window_buffer_modedata	*data = modedata; | ||||||
| 	struct window_buffer_itemdata	*item = itemdata; | 	struct window_buffer_itemdata	*item = itemdata; | ||||||
| 	struct paste_buffer		*pb; |  | ||||||
|  |  | ||||||
| 	if ((pb = paste_get_name(item->name)) != NULL) | 	if (paste_get_name(item->name) != NULL) | ||||||
| 		mode_tree_run_command(c, NULL, data->command, item->name); | 		mode_tree_run_command(c, NULL, data->command, item->name); | ||||||
| } | } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1055,14 +1055,15 @@ window_copy_cmd_history_bottom(struct window_copy_cmd_state *cs) | |||||||
| { | { | ||||||
| 	struct window_mode_entry	*wme = cs->wme; | 	struct window_mode_entry	*wme = cs->wme; | ||||||
| 	struct window_copy_mode_data	*data = wme->data; | 	struct window_copy_mode_data	*data = wme->data; | ||||||
|  | 	struct screen			*s = data->backing; | ||||||
| 	u_int				 oy; | 	u_int				 oy; | ||||||
|  |  | ||||||
| 	oy = screen_hsize(data->backing) + data->cy - data->oy; | 	oy = screen_hsize(s) + data->cy - data->oy; | ||||||
| 	if (data->lineflag == LINE_SEL_RIGHT_LEFT && oy == data->endsely) | 	if (data->lineflag == LINE_SEL_RIGHT_LEFT && oy == data->endsely) | ||||||
| 		window_copy_other_end(wme); | 		window_copy_other_end(wme); | ||||||
|  |  | ||||||
| 	data->cy = screen_size_y(&data->screen) - 1; | 	data->cy = screen_size_y(&data->screen) - 1; | ||||||
| 	data->cx = window_copy_find_length(wme, data->cy); | 	data->cx = window_copy_find_length(wme, screen_hsize(s) + data->cy); | ||||||
| 	data->oy = 0; | 	data->oy = 0; | ||||||
|  |  | ||||||
| 	if (data->searchmark != NULL && !data->timeout) | 	if (data->searchmark != NULL && !data->timeout) | ||||||
| @@ -4151,7 +4152,6 @@ window_copy_cursor_previous_word_pos(struct window_mode_entry *wme, | |||||||
| 				    data->oy >= | 				    data->oy >= | ||||||
| 				    screen_hsize(data->backing) - 1)) | 				    screen_hsize(data->backing) - 1)) | ||||||
| 					goto out; | 					goto out; | ||||||
| 				py--; |  | ||||||
|  |  | ||||||
| 				py = screen_hsize(data->backing) + data->cy - | 				py = screen_hsize(data->backing) + data->cy - | ||||||
| 				    data->oy; | 				    data->oy; | ||||||
| @@ -4360,7 +4360,7 @@ window_copy_start_drag(struct client *c, struct mouse_event *m) | |||||||
| 		data->selflag = SEL_CHAR; | 		data->selflag = SEL_CHAR; | ||||||
| 	switch (data->selflag) { | 	switch (data->selflag) { | ||||||
| 		case SEL_WORD: | 		case SEL_WORD: | ||||||
| 			if (data->ws) { | 			if (data->ws != NULL) { | ||||||
| 				window_copy_update_cursor(wme, x, y); | 				window_copy_update_cursor(wme, x, y); | ||||||
| 				window_copy_cursor_previous_word_pos(wme, | 				window_copy_cursor_previous_word_pos(wme, | ||||||
| 				    data->ws, 0, &x, &y); | 				    data->ws, 0, &x, &y); | ||||||
|   | |||||||
							
								
								
									
										2
									
								
								window.c
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								window.c
									
									
									
									
									
								
							| @@ -1223,7 +1223,7 @@ window_pane_search(struct window_pane *wp, const char *term, int regex, | |||||||
| 		} | 		} | ||||||
| 		log_debug("%s: %s", __func__, line); | 		log_debug("%s: %s", __func__, line); | ||||||
| 		if (!regex) | 		if (!regex) | ||||||
| 			found = (fnmatch(new, line, 0) == 0); | 			found = (fnmatch(new, line, flags) == 0); | ||||||
| 		else | 		else | ||||||
| 			found = (regexec(&r, line, 0, NULL, 0) == 0); | 			found = (regexec(&r, line, 0, NULL, 0) == 0); | ||||||
| 		free(line); | 		free(line); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Thomas Adam
					Thomas Adam