mirror of
https://github.com/tmux/tmux.git
synced 2025-01-12 03:08:46 +00:00
Merge branch 'obsd-master'
This commit is contained in:
commit
a1009e7bd3
1
cfg.c
1
cfg.c
@ -347,7 +347,6 @@ cfg_show_causes(struct session *s)
|
||||
return;
|
||||
wp = s->curw->window->active;
|
||||
|
||||
window_pane_set_mode(wp, &window_copy_mode, NULL, NULL);
|
||||
window_copy_init_for_output(wp);
|
||||
for (i = 0; i < cfg_ncauses; i++) {
|
||||
window_copy_add(wp, "%s", cfg_causes[i]);
|
||||
|
@ -426,12 +426,7 @@ cmdq_print(struct cmdq_item *item, const char *fmt, ...)
|
||||
server_client_push_stdout(c);
|
||||
} else {
|
||||
w = c->session->curw->window;
|
||||
if (w->active->mode != &window_copy_mode) {
|
||||
window_pane_reset_mode(w->active);
|
||||
window_pane_set_mode(w->active, &window_copy_mode, NULL,
|
||||
NULL);
|
||||
window_copy_init_for_output(w->active);
|
||||
}
|
||||
window_copy_init_for_output(w->active);
|
||||
window_copy_vadd(w->active, fmt, ap);
|
||||
}
|
||||
|
||||
|
@ -75,10 +75,8 @@ cmd_run_shell_print(struct job *job, const char *msg)
|
||||
return;
|
||||
}
|
||||
|
||||
if (window_pane_set_mode(wp, &window_copy_mode, NULL, NULL) == 0)
|
||||
window_copy_init_for_output(wp);
|
||||
if (wp->mode == &window_copy_mode)
|
||||
window_copy_add(wp, "%s", msg);
|
||||
window_copy_init_for_output(wp);
|
||||
window_copy_add(wp, "%s", msg);
|
||||
}
|
||||
|
||||
static enum cmd_retval
|
||||
|
3
format.c
3
format.c
@ -1569,7 +1569,8 @@ 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);
|
||||
|
||||
window_copy_add_formats(wp, ft);
|
||||
if (wp->mode != NULL && wp->mode->formats != NULL)
|
||||
wp->mode->formats(wp, ft);
|
||||
|
||||
format_add(ft, "alternate_on", "%d", wp->saved_grid ? 1 : 0);
|
||||
format_add(ft, "alternate_saved_x", "%u", wp->saved_cx);
|
||||
|
4
tmux.h
4
tmux.h
@ -45,6 +45,7 @@ struct cmdq_item;
|
||||
struct cmdq_list;
|
||||
struct environ;
|
||||
struct format_job_tree;
|
||||
struct format_tree;
|
||||
struct input_ctx;
|
||||
struct job;
|
||||
struct mode_tree_data;
|
||||
@ -709,6 +710,7 @@ struct window_mode {
|
||||
void (*command)(struct window_pane *, struct client *,
|
||||
struct session *, struct winlink *, struct args *,
|
||||
struct mouse_event *);
|
||||
void (*formats)(struct window_pane *, struct format_tree *);
|
||||
};
|
||||
#define WINDOW_MODE_TIMEOUT 180
|
||||
|
||||
@ -2306,8 +2308,6 @@ 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 *);
|
||||
void window_copy_add_formats(struct window_pane *,
|
||||
struct format_tree *);
|
||||
|
||||
/* names.c */
|
||||
void check_window_name(struct window *);
|
||||
|
@ -31,10 +31,11 @@ static void window_copy_command(struct window_pane *, struct client *,
|
||||
static struct screen *window_copy_init(struct window_pane *,
|
||||
struct cmd_find_state *, struct args *);
|
||||
static void window_copy_free(struct window_pane *);
|
||||
static void window_copy_resize(struct window_pane *, u_int, u_int);
|
||||
static void window_copy_formats(struct window_pane *, struct format_tree *);
|
||||
static int window_copy_pagedown(struct window_pane *, int, int);
|
||||
static void window_copy_next_paragraph(struct window_pane *);
|
||||
static void window_copy_previous_paragraph(struct window_pane *);
|
||||
static void window_copy_resize(struct window_pane *, u_int, u_int);
|
||||
|
||||
static void window_copy_redraw_selection(struct window_pane *, u_int);
|
||||
static void window_copy_redraw_lines(struct window_pane *, u_int, u_int);
|
||||
@ -113,6 +114,7 @@ const struct window_mode window_copy_mode = {
|
||||
.resize = window_copy_resize,
|
||||
.key_table = window_copy_key_table,
|
||||
.command = window_copy_command,
|
||||
.formats = window_copy_formats,
|
||||
};
|
||||
|
||||
enum {
|
||||
@ -261,6 +263,12 @@ window_copy_init_for_output(struct window_pane *wp)
|
||||
{
|
||||
struct window_copy_mode_data *data = wp->modedata;
|
||||
|
||||
if (wp->mode == &window_copy_mode && data->backing != &wp->base)
|
||||
return;
|
||||
window_pane_reset_mode(wp);
|
||||
window_pane_set_mode(wp, &window_copy_mode, NULL, NULL);
|
||||
|
||||
data = wp->modedata;
|
||||
data->backing = xmalloc(sizeof *data->backing);
|
||||
screen_init(data->backing, screen_size_x(&wp->base),
|
||||
screen_size_y(&wp->base), UINT_MAX);
|
||||
@ -472,6 +480,16 @@ window_copy_next_paragraph(struct window_pane *wp)
|
||||
window_copy_scroll_to(wp, ox, oy);
|
||||
}
|
||||
|
||||
static void
|
||||
window_copy_formats(struct window_pane *wp, struct format_tree *ft)
|
||||
{
|
||||
struct window_copy_mode_data *data = wp->modedata;
|
||||
|
||||
format_add(ft, "selection_present", "%d", data->screen.sel != NULL);
|
||||
format_add(ft, "scroll_position", "%d", data->oy);
|
||||
format_add(ft, "rectangle_toggle", "%d", data->rectflag);
|
||||
}
|
||||
|
||||
static void
|
||||
window_copy_resize(struct window_pane *wp, u_int sx, u_int sy)
|
||||
{
|
||||
@ -2447,19 +2465,6 @@ window_copy_scroll_down(struct window_pane *wp, u_int ny)
|
||||
screen_write_stop(&ctx);
|
||||
}
|
||||
|
||||
void
|
||||
window_copy_add_formats(struct window_pane *wp, struct format_tree *ft)
|
||||
{
|
||||
struct window_copy_mode_data *data = wp->modedata;
|
||||
|
||||
if (wp->mode != &window_copy_mode)
|
||||
return;
|
||||
|
||||
format_add(ft, "selection_present", "%d", data->screen.sel != NULL);
|
||||
format_add(ft, "scroll_position", "%d", data->oy);
|
||||
format_add(ft, "rectangle_toggle", "%d", data->rectflag);
|
||||
}
|
||||
|
||||
static void
|
||||
window_copy_rectangle_toggle(struct window_pane *wp)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user