1
0
mirror of https://github.com/tmux/tmux.git synced 2025-03-24 14:58:47 +00:00

Fix mouse_hyperlink format in copy mode. From someone in GitHub issue

4418.
This commit is contained in:
nicm 2025-03-21 14:04:26 +00:00
parent a541be3951
commit f101762d1b
3 changed files with 17 additions and 0 deletions

View File

@ -1173,6 +1173,12 @@ format_cb_mouse_hyperlink(struct format_tree *ft)
return (NULL);
if (cmd_mouse_at(wp, &ft->m, &x, &y, 0) != 0)
return (NULL);
if (!TAILQ_EMPTY(&wp->modes)) {
if (window_pane_mode(wp) != WINDOW_PANE_NO_MODE)
return (window_copy_get_hyperlink(wp, x, y));
return (NULL);
}
gd = wp->base.grid;
return (format_grid_hyperlink(gd, x, gd->hsize + y, wp->screen));
}

1
tmux.h
View File

@ -3338,6 +3338,7 @@ char *window_copy_get_word(struct window_pane *, u_int, u_int);
char *window_copy_get_line(struct window_pane *, u_int);
int window_copy_get_current_offset(struct window_pane *, u_int *,
u_int *);
char *window_copy_get_hyperlink(struct window_pane *, u_int, u_int);
/* window-option.c */
extern const struct window_mode window_customize_mode;

View File

@ -884,6 +884,16 @@ window_copy_get_line(struct window_pane *wp, u_int y)
return (format_grid_line(gd, gd->hsize + y));
}
char *
window_copy_get_hyperlink(struct window_pane *wp, u_int x, u_int y)
{
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, x, gd->hsize + y, wp->screen));
}
static void *
window_copy_cursor_hyperlink_cb(struct format_tree *ft)
{