summaryrefslogtreecommitdiff
path: root/usr.bin/tmux/window.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2024-08-26 07:14:41 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2024-08-26 07:14:41 +0000
commit4badb095c84081908b1f0efc7f13ddee41a37d08 (patch)
treedf4d060738c2db072dc14d5ff871ed45c6e0a486 /usr.bin/tmux/window.c
parent5ba59de62f3f1bbd38a64db53f9cedcec6e81547 (diff)
Add window_pane_mode helper function to tell if a pane is in copy mode,
from Michael Grant.
Diffstat (limited to 'usr.bin/tmux/window.c')
-rw-r--r--usr.bin/tmux/window.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/usr.bin/tmux/window.c b/usr.bin/tmux/window.c
index 5aebeedaa52..1a085966a34 100644
--- a/usr.bin/tmux/window.c
+++ b/usr.bin/tmux/window.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: window.c,v 1.291 2024/06/24 08:30:50 nicm Exp $ */
+/* $OpenBSD: window.c,v 1.292 2024/08/26 07:14:40 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -1662,3 +1662,15 @@ window_pane_default_cursor(struct window_pane *wp)
s->default_mode = 0;
screen_set_cursor_style(c, &s->default_cstyle, &s->default_mode);
}
+
+int
+window_pane_mode(struct window_pane *wp)
+{
+ if (TAILQ_FIRST(&wp->modes) != NULL) {
+ if (TAILQ_FIRST(&wp->modes)->mode == &window_copy_mode)
+ return (WINDOW_PANE_COPY_MODE);
+ if (TAILQ_FIRST(&wp->modes)->mode == &window_view_mode)
+ return (WINDOW_PANE_VIEW_MODE);
+ }
+ return (WINDOW_PANE_NO_MODE);
+}