summaryrefslogtreecommitdiffstats
path: root/screen-write.c
diff options
context:
space:
mode:
authornicm <nicm>2022-03-17 11:35:37 +0000
committernicm <nicm>2022-03-17 11:35:37 +0000
commit10d689e7354f789f951016f7f4d57a0c2d14e124 (patch)
treeb1c366cc8c0df2551c2e4b66341dde7959e2c5b1 /screen-write.c
parente6e737ac0bf9a5be729b5c71f3a582355432d041 (diff)
Add an option (scroll-on-clear) to control if tmux scrolls into history
on clear, from Robert Lange in GitHub issue 3121.
Diffstat (limited to 'screen-write.c')
-rw-r--r--screen-write.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/screen-write.c b/screen-write.c
index 0d70f668..aa898f78 100644
--- a/screen-write.c
+++ b/screen-write.c
@@ -1427,7 +1427,11 @@ screen_write_clearendofscreen(struct screen_write_ctx *ctx, u_int bg)
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)