sync with OpenBSD -current

This commit is contained in:
purplerain 2024-08-27 19:23:27 +00:00
parent 84a7643638
commit bf0d2e284c
Signed by: purplerain
GPG key ID: F42C07F07E2E35B7
48 changed files with 439 additions and 307 deletions

View file

@ -1,4 +1,4 @@
/* $OpenBSD: hyperlinks.c,v 1.3 2023/06/30 13:19:32 nicm Exp $ */
/* $OpenBSD: hyperlinks.c,v 1.4 2024/08/27 07:49:07 nicm Exp $ */
/*
* Copyright (c) 2021 Will <author@will.party>
@ -69,6 +69,7 @@ struct hyperlinks {
u_int next_inner;
struct hyperlinks_by_inner_tree by_inner;
struct hyperlinks_by_uri_tree by_uri;
u_int references;
};
static int
@ -206,6 +207,15 @@ hyperlinks_init(void)
hl->next_inner = 1;
RB_INIT(&hl->by_uri);
RB_INIT(&hl->by_inner);
hl->references = 1;
return (hl);
}
/* Copy hyperlink set. */
struct hyperlinks *
hyperlinks_copy(struct hyperlinks *hl)
{
hl->references++;
return (hl);
}
@ -223,6 +233,8 @@ hyperlinks_reset(struct hyperlinks *hl)
void
hyperlinks_free(struct hyperlinks *hl)
{
hyperlinks_reset(hl);
free(hl);
if (--hl->references == 0) {
hyperlinks_reset(hl);
free(hl);
}
}

View file

@ -1,4 +1,4 @@
/* $OpenBSD: server-client.c,v 1.406 2024/08/26 07:30:46 nicm Exp $ */
/* $OpenBSD: server-client.c,v 1.407 2024/08/27 07:25:27 nicm Exp $ */
/*
* Copyright (c) 2009 Nicholas Marriott <nicholas.marriott@gmail.com>
@ -783,8 +783,7 @@ have_event:
log_debug("mouse on pane %%%u border", wp->id);
m->wp = wp->id;
m->w = wp->window->id;
} else
m->wp = -1;
}
/* Stop dragging if needed. */
if (type != DRAG && type != WHEEL && c->tty.mouse_drag_flag != 0) {

View file

@ -1,4 +1,4 @@
.\" $OpenBSD: tmux.1,v 1.952 2024/08/26 07:09:34 nicm Exp $
.\" $OpenBSD: tmux.1,v 1.954 2024/08/27 07:49:07 nicm Exp $
.\"
.\" Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
.\"
@ -14,7 +14,7 @@
.\" IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
.\" OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
.Dd $Mdocdate: August 26 2024 $
.Dd $Mdocdate: August 27 2024 $
.Dt TMUX 1
.Os
.Sh NAME
@ -5498,6 +5498,7 @@ The following variables are available, where appropriate:
.It Li "command_list_name" Ta "" Ta "Command name if listing commands"
.It Li "command_list_usage" Ta "" Ta "Command usage if listing commands"
.It Li "config_files" Ta "" Ta "List of configuration files loaded"
.It Li "copy_cursor_hyperlink" Ta "" Ta "Hyperlink under cursor in copy mode"
.It Li "copy_cursor_line" Ta "" Ta "Line the cursor is on in copy mode"
.It Li "copy_cursor_word" Ta "" Ta "Word under cursor in copy mode"
.It Li "copy_cursor_x" Ta "" Ta "Cursor X position in copy mode"
@ -5584,6 +5585,8 @@ The following variables are available, where appropriate:
.It Li "scroll_position" Ta "" Ta "Scroll position in copy mode"
.It Li "scroll_region_lower" Ta "" Ta "Bottom of scroll region in pane"
.It Li "scroll_region_upper" Ta "" Ta "Top of scroll region in pane"
.It Li "search_count" Ta "" Ta "Count of search results"
.It Li "search_count_partial" Ta "" Ta "1 if search count is partial count"
.It Li "search_match" Ta "" Ta "Search match if any"
.It Li "search_present" Ta "" Ta "1 if search started in copy mode"
.It Li "selection_active" Ta "" Ta "1 if selection started and changes with the cursor in copy mode"

View file

@ -1,4 +1,4 @@
/* $OpenBSD: tmux.h,v 1.1225 2024/08/26 07:30:46 nicm Exp $ */
/* $OpenBSD: tmux.h,v 1.1226 2024/08/27 07:49:07 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@ -3434,6 +3434,7 @@ u_int hyperlinks_put(struct hyperlinks *, const char *,
int hyperlinks_get(struct hyperlinks *, u_int,
const char **, const char **, const char **);
struct hyperlinks *hyperlinks_init(void);
struct hyperlinks *hyperlinks_copy(struct hyperlinks *);
void hyperlinks_reset(struct hyperlinks *);
void hyperlinks_free(struct hyperlinks *);

View file

@ -1,4 +1,4 @@
/* $OpenBSD: window-copy.c,v 1.351 2024/08/26 07:09:34 nicm Exp $ */
/* $OpenBSD: window-copy.c,v 1.353 2024/08/27 07:49:07 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@ -450,6 +450,8 @@ window_copy_init(struct window_mode_entry *wme,
data->scroll_exit = args_has(args, 'e');
data->hide_position = args_has(args, 'H');
if (base->hyperlinks != NULL)
data->screen.hyperlinks = hyperlinks_copy(base->hyperlinks);
data->screen.cx = data->cx;
data->screen.cy = data->cy;
data->mx = data->cx;
@ -764,6 +766,18 @@ window_copy_get_line(struct window_pane *wp, u_int y)
return (format_grid_line(gd, gd->hsize + y));
}
static void *
window_copy_cursor_hyperlink_cb(struct format_tree *ft)
{
struct window_pane *wp = format_get_pane(ft);
struct window_mode_entry *wme = TAILQ_FIRST(&wp->modes);
struct window_copy_mode_data *data = wme->data;
struct grid *gd = data->screen.grid;
return (format_grid_hyperlink(gd, data->cx, gd->hsize + data->cy,
&data->screen));
}
static void *
window_copy_cursor_word_cb(struct format_tree *ft)
{
@ -825,10 +839,16 @@ window_copy_formats(struct window_mode_entry *wme, struct format_tree *ft)
}
format_add(ft, "search_present", "%d", data->searchmark != NULL);
if (data->searchcount != -1) {
format_add(ft, "search_count", "%d", data->searchcount);
format_add(ft, "search_count_partial", "%d", data->searchmore);
}
format_add_cb(ft, "search_match", window_copy_search_match_cb);
format_add_cb(ft, "copy_cursor_word", window_copy_cursor_word_cb);
format_add_cb(ft, "copy_cursor_line", window_copy_cursor_line_cb);
format_add_cb(ft, "copy_cursor_hyperlink",
window_copy_cursor_hyperlink_cb);
}
static void
@ -2482,7 +2502,8 @@ window_copy_cmd_refresh_from_pane(struct window_copy_cmd_state *cs)
screen_free(data->backing);
free(data->backing);
data->backing = window_copy_clone_screen(&wp->base, &data->screen, NULL, NULL, wme->swp != wme->wp);
data->backing = window_copy_clone_screen(&wp->base, &data->screen, NULL,
NULL, wme->swp != wme->wp);
window_copy_size_changed(wme);
return (WINDOW_COPY_CMD_REDRAW);