Add a window "screen-no-collect" option to avoid skipping writes and to allow scrollup + mouse work to be usable/reliable like in "screen" within a single window, without having to activate copy-mode and/or the mouse option.
Signed-off-by: Andrea Arcangeli <[email protected]> --- cmd-set-option.c | 14 ++++++++++++++ options-table.c | 6 ++++++ screen-write.c | 2 +- tmux.h | 1 + window.c | 3 +++ 5 files changed, 25 insertions(+), 1 deletion(-) diff --git a/cmd-set-option.c b/cmd-set-option.c index 96428d73..3f681bd2 100644 --- a/cmd-set-option.c +++ b/cmd-set-option.c @@ -274,6 +274,20 @@ cmd_set_option_exec(struct cmd *self, struct cmdq_item *item) } RB_FOREACH(s, sessions, &sessions) status_update_cache(s); + if (strcmp(name, "screen-no-collect") == 0) { + RB_FOREACH(w, windows, &windows) { + int no_collect; + struct window_pane *wp; + no_collect = options_get_number(w->options, + "screen-no-collect"); + TAILQ_FOREACH(wp, &w->panes, entry) { + if (no_collect) + wp->screen->mode |= MODE_NO_COLLECT; + else + wp->screen->mode &= ~MODE_NO_COLLECT; + } + } + } /* * Update sizes and redraw. May not always be necessary but do it diff --git a/options-table.c b/options-table.c index 541e66f2..e2db6859 100644 --- a/options-table.c +++ b/options-table.c @@ -680,6 +680,12 @@ const struct options_table_entry options_table[] = { .default_num = 0 }, + { .name = "screen-no-collect", + .type = OPTIONS_TABLE_FLAG, + .scope = OPTIONS_TABLE_WINDOW, + .default_num = 0 + }, + { .name = "synchronize-panes", .type = OPTIONS_TABLE_FLAG, .scope = OPTIONS_TABLE_WINDOW, diff --git a/screen-write.c b/screen-write.c index 0d57b818..5b7ea886 100644 --- a/screen-write.c +++ b/screen-write.c @@ -1294,7 +1294,7 @@ screen_write_collect_add(struct screen_write_ctx *ctx, collect = 0; else if (~s->mode & MODE_WRAP) collect = 0; - else if (s->mode & MODE_INSERT) + else if (s->mode & (MODE_INSERT|MODE_NO_COLLECT)) collect = 0; else if (s->sel != NULL) collect = 0; diff --git a/tmux.h b/tmux.h index 71074f21..56854180 100644 --- a/tmux.h +++ b/tmux.h @@ -521,6 +521,7 @@ struct msg_stderr_data { #define MODE_FOCUSON 0x800 #define MODE_MOUSE_ALL 0x1000 #define MODE_ORIGIN 0x2000 +#define MODE_NO_COLLECT 0x4000 #define ALL_MODES 0xffffff #define ALL_MOUSE_MODES (MODE_MOUSE_STANDARD|MODE_MOUSE_BUTTON|MODE_MOUSE_ALL) diff --git a/window.c b/window.c index 4ed766ad..b189132f 100644 --- a/window.c +++ b/window.c @@ -839,6 +839,9 @@ window_pane_create(struct window *w, u_int sx, u_int sy, u_int hlimit) screen_init(&wp->base, sx, sy, hlimit); wp->screen = &wp->base; + if (options_get_number(w->options, "screen-no-collect")) + wp->screen->mode |= MODE_NO_COLLECT; + screen_init(&wp->status_screen, 1, 1, 0); if (gethostname(host, sizeof host) == 0) -- You received this message because you are subscribed to the Google Groups "tmux-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
