mirror of
				https://github.com/tmux/tmux.git
				synced 2025-11-04 00:56: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:
		@@ -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)
 | 
			
		||||
{
 | 
			
		||||
@@ -833,6 +847,8 @@ window_copy_formats(struct window_mode_entry *wme, struct format_tree *ft)
 | 
			
		||||
 | 
			
		||||
	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
 | 
			
		||||
@@ -2486,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);
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user