mirror of
https://github.com/tmux/tmux.git
synced 2025-09-02 05:21:10 +00:00
Display hyperlinks in copy mode and add copy_cursor_hyperlink format to
get the hyperlink under the cursor.
This commit is contained in:
16
hyperlinks.c
16
hyperlinks.c
@ -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);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user