mirror of
https://github.com/tmux/tmux.git
synced 2025-01-05 23:38:48 +00:00
Add selection_present format so commands in copy mode can use it, GitHub
issue 1028.
This commit is contained in:
parent
b4c9f6edba
commit
6f9b9655d7
6
format.c
6
format.c
@ -1373,7 +1373,7 @@ format_defaults_pane(struct format_tree *ft, struct window_pane *wp)
|
||||
{
|
||||
struct grid *gd = wp->base.grid;
|
||||
u_int idx;
|
||||
int status, scroll_position;
|
||||
int status;
|
||||
|
||||
if (ft->w == NULL)
|
||||
ft->w = wp->window;
|
||||
@ -1430,9 +1430,7 @@ format_defaults_pane(struct format_tree *ft, struct window_pane *wp)
|
||||
format_add(ft, "scroll_region_upper", "%u", wp->base.rupper);
|
||||
format_add(ft, "scroll_region_lower", "%u", wp->base.rlower);
|
||||
|
||||
scroll_position = window_copy_scroll_position(wp);
|
||||
if (scroll_position != -1)
|
||||
format_add(ft, "scroll_position", "%d", scroll_position);
|
||||
window_copy_add_formats(wp, ft);
|
||||
|
||||
format_add(ft, "alternate_on", "%d", wp->saved_grid ? 1 : 0);
|
||||
format_add(ft, "alternate_saved_x", "%u", wp->saved_cx);
|
||||
|
1
tmux.1
1
tmux.1
@ -3639,6 +3639,7 @@ The following variables are available, where appropriate:
|
||||
.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 "scroll_position" Ta "" Ta "Scroll position in copy mode"
|
||||
.It Li "selection_present" Ta "" Ta "1 if selection started in copy mode"
|
||||
.It Li "session_alerts" Ta "" Ta "List of window indexes with alerts"
|
||||
.It Li "session_attached" Ta "" Ta "Number of clients session is attached to"
|
||||
.It Li "session_activity" Ta "" Ta "Integer time of session last activity"
|
||||
|
3
tmux.h
3
tmux.h
@ -2257,7 +2257,8 @@ void printflike(2, 3) window_copy_add(struct window_pane *, const char *, ...);
|
||||
void window_copy_vadd(struct window_pane *, const char *, va_list);
|
||||
void window_copy_pageup(struct window_pane *, int);
|
||||
void window_copy_start_drag(struct client *, struct mouse_event *);
|
||||
int window_copy_scroll_position(struct window_pane *);
|
||||
void window_copy_add_formats(struct window_pane *,
|
||||
struct format_tree *);
|
||||
|
||||
/* names.c */
|
||||
void check_window_name(struct window *);
|
||||
|
@ -2407,14 +2407,17 @@ window_copy_scroll_down(struct window_pane *wp, u_int ny)
|
||||
screen_write_stop(&ctx);
|
||||
}
|
||||
|
||||
int
|
||||
window_copy_scroll_position(struct window_pane *wp)
|
||||
void
|
||||
window_copy_add_formats(struct window_pane *wp, struct format_tree *ft)
|
||||
{
|
||||
struct window_copy_mode_data *data = wp->modedata;
|
||||
struct screen *s = &data->screen;
|
||||
|
||||
if (wp->mode != &window_copy_mode)
|
||||
return (-1);
|
||||
return (data->oy);
|
||||
return;
|
||||
|
||||
format_add(ft, "selection_present", "%d", s->sel.flag);
|
||||
format_add(ft, "scroll_position", "%d", data->oy);
|
||||
}
|
||||
|
||||
static void
|
||||
|
Loading…
Reference in New Issue
Block a user