summaryrefslogtreecommitdiff
path: root/usr.bin/tmux/window.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2024-11-15 09:01:17 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2024-11-15 09:01:17 +0000
commitbae92ec6e921e6f16d040d805a371e027dd9a23f (patch)
tree77cb48d1e05e6347ed628d7e179a584d47def693 /usr.bin/tmux/window.c
parent7441a91517b2a793c77137605c7577f1da70f509 (diff)
Turn off scrollbar when pane is in alternate screen, from Michael Grant,
GitHub issue 4231.
Diffstat (limited to 'usr.bin/tmux/window.c')
-rw-r--r--usr.bin/tmux/window.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/usr.bin/tmux/window.c b/usr.bin/tmux/window.c
index e916410608c..f30a30ffd91 100644
--- a/usr.bin/tmux/window.c
+++ b/usr.bin/tmux/window.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: window.c,v 1.296 2024/11/05 09:41:17 nicm Exp $ */
+/* $OpenBSD: window.c,v 1.297 2024/11/15 09:01:16 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -1726,3 +1726,16 @@ window_pane_mode(struct window_pane *wp)
}
return (WINDOW_PANE_NO_MODE);
}
+
+/* Return 1 if scrollbar is or should be displayed. */
+int
+window_pane_show_scrollbar(struct window_pane *wp, int sb_option)
+{
+ if (SCREEN_IS_ALTERNATE(wp->screen))
+ return (0);
+ if (sb_option == PANE_SCROLLBARS_ALWAYS ||
+ (sb_option == PANE_SCROLLBARS_MODAL &&
+ window_pane_mode(wp) != WINDOW_PANE_NO_MODE))
+ return (1);
+ return (0);
+}