on clear, from Robert Lange in GitHub issue 3121.
-/* $OpenBSD: options-table.c,v 1.160 2022/03/16 17:00:17 nicm Exp $ */
+/* $OpenBSD: options-table.c,v 1.161 2022/03/17 11:35:37 nicm Exp $ */
/*
* Copyright (c) 2011 Nicholas Marriott <nicholas.marriott@gmail.com>
"remain-on-exit is enabled."
},
+ { .name = "scroll-on-clear",
+ .type = OPTIONS_TABLE_FLAG,
+ .scope = OPTIONS_TABLE_WINDOW|OPTIONS_TABLE_PANE,
+ .default_num = 1,
+ .text = "Whether the contents of the screen should be scrolled into"
+ "history when clearing the whole screen."
+ },
+
{ .name = "synchronize-panes",
.type = OPTIONS_TABLE_FLAG,
.scope = OPTIONS_TABLE_WINDOW|OPTIONS_TABLE_PANE,
-/* $OpenBSD: screen-write.c,v 1.205 2021/10/26 12:22:23 nicm Exp $ */
+/* $OpenBSD: screen-write.c,v 1.206 2022/03/17 11:35:37 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
ttyctx.bg = bg;
/* Scroll into history if it is enabled and clearing entire screen. */
- if (s->cx == 0 && s->cy == 0 && (gd->flags & GRID_HISTORY))
+ if (s->cx == 0 &&
+ s->cy == 0 &&
+ (gd->flags & GRID_HISTORY) &&
+ ctx->wp != NULL &&
+ options_get_number(ctx->wp->options, "scroll-on-clear"))
grid_view_clear_history(gd, bg);
else {
if (s->cx <= sx - 1)
-.\" $OpenBSD: tmux.1,v 1.883 2022/03/16 17:00:17 nicm Exp $
+.\" $OpenBSD: tmux.1,v 1.884 2022/03/17 11:35:37 nicm Exp $
.\"
.\" Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
.\"
.\" IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
.\" OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
-.Dd $Mdocdate: March 16 2022 $
+.Dd $Mdocdate: March 17 2022 $
.Dt TMUX 1
.Os
.Sh NAME
.Ic remain-on-exit
is enabled.
.Pp
+.It Xo Ic scroll-on-clear
+.Op Ic on | off
+.Xc
+When the entire screen is cleared and this option is on, scroll the contents of
+the screen into history before clearing it.
+.Pp
.It Xo Ic synchronize-panes
.Op Ic on | off
.Xc