diff options
author | Nicholas Marriott <nicm@cvs.openbsd.org> | 2014-03-31 21:37:56 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@cvs.openbsd.org> | 2014-03-31 21:37:56 +0000 |
commit | 1820c0bf92d35e84f577fa470a19b89bd2efc18a (patch) | |
tree | 05dde3d8d1fa5f45dc60f9d1054ff3998a908bdd /usr.bin | |
parent | 8fe4c7041a496e8f3273ba22ebd417872f39af65 (diff) |
Make session_attached a count and add session_many_attached flag.
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/tmux/format.c | 8 | ||||
-rw-r--r-- | usr.bin/tmux/resize.c | 4 | ||||
-rw-r--r-- | usr.bin/tmux/tmux.1 | 7 | ||||
-rw-r--r-- | usr.bin/tmux/tmux.h | 4 |
4 files changed, 13 insertions, 10 deletions
diff --git a/usr.bin/tmux/format.c b/usr.bin/tmux/format.c index 5280c9344d6..badbde88e19 100644 --- a/usr.bin/tmux/format.c +++ b/usr.bin/tmux/format.c @@ -1,4 +1,4 @@ -/* $OpenBSD: format.c,v 1.40 2013/11/24 11:29:09 nicm Exp $ */ +/* $OpenBSD: format.c,v 1.41 2014/03/31 21:37:55 nicm Exp $ */ /* * Copyright (c) 2011 Nicholas Marriott <nicm@users.sourceforge.net> @@ -401,10 +401,8 @@ format_session(struct format_tree *ft, struct session *s) *strchr(tim, '\n') = '\0'; format_add(ft, "session_created_string", "%s", tim); - if (s->flags & SESSION_UNATTACHED) - format_add(ft, "session_attached", "%d", 0); - else - format_add(ft, "session_attached", "%d", 1); + format_add(ft, "session_attached", "%u", s->attached); + format_add(ft, "session_many_attached", "%u", s->attached > 1); } /* Set default format keys for a client. */ diff --git a/usr.bin/tmux/resize.c b/usr.bin/tmux/resize.c index 4e56301ec08..0f7fa24364b 100644 --- a/usr.bin/tmux/resize.c +++ b/usr.bin/tmux/resize.c @@ -1,4 +1,4 @@ -/* $OpenBSD: resize.c,v 1.11 2013/10/10 11:46:00 nicm Exp $ */ +/* $OpenBSD: resize.c,v 1.12 2014/03/31 21:37:55 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -55,6 +55,7 @@ recalculate_sizes(void) RB_FOREACH(s, sessions, &sessions) { has_status = options_get_number(&s->options, "status"); + s->attached = 0; ssx = ssy = UINT_MAX; for (j = 0; j < ARRAY_LENGTH(&clients); j++) { c = ARRAY_ITEM(&clients, j); @@ -69,6 +70,7 @@ recalculate_sizes(void) ssy = c->tty.sy - 1; else if (c->tty.sy < ssy) ssy = c->tty.sy; + s->attached++; } } if (ssx == UINT_MAX || ssy == UINT_MAX) { diff --git a/usr.bin/tmux/tmux.1 b/usr.bin/tmux/tmux.1 index a7bda5e613d..7c6256da1c4 100644 --- a/usr.bin/tmux/tmux.1 +++ b/usr.bin/tmux/tmux.1 @@ -1,4 +1,4 @@ -.\" $OpenBSD: tmux.1,v 1.381 2014/02/23 00:53:06 nicm Exp $ +.\" $OpenBSD: tmux.1,v 1.382 2014/03/31 21:37:55 nicm Exp $ .\" .\" Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> .\" @@ -14,7 +14,7 @@ .\" 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: February 23 2014 $ +.Dd $Mdocdate: March 31 2014 $ .Dt TMUX 1 .Os .Sh NAME @@ -3136,13 +3136,14 @@ The following variables are available, where appropriate: .It Li "saved_cursor_y" Ta "" Ta "Saved cursor Y in pane" .It Li "scroll_region_lower" Ta "" Ta "Bottom of scroll region in pane" .It Li "scroll_region_upper" Ta "" Ta "Top of scroll region in pane" -.It Li "session_attached" Ta "" Ta "1 if session attached" +.It Li "session_attached" Ta "" Ta "Number of clients session is attached to" .It Li "session_created" Ta "" Ta "Integer time session created" .It Li "session_created_string" Ta "" Ta "String time session created" .It Li "session_group" Ta "" Ta "Number of session group" .It Li "session_grouped" Ta "" Ta "1 if session in a group" .It Li "session_height" Ta "" Ta "Height of session" .It Li "session_id" Ta "" Ta "Unique session ID" +.It Li "session_many_attached" Ta "" Ta "1 if multiple clients attached" .It Li "session_name" Ta "#S" Ta "Name of session" .It Li "session_width" Ta "" Ta "Width of session" .It Li "session_windows" Ta "" Ta "Number of windows in session" diff --git a/usr.bin/tmux/tmux.h b/usr.bin/tmux/tmux.h index e7c4e66cba3..636deceac1a 100644 --- a/usr.bin/tmux/tmux.h +++ b/usr.bin/tmux/tmux.h @@ -1,4 +1,4 @@ -/* $OpenBSD: tmux.h,v 1.439 2014/03/31 21:36:43 nicm Exp $ */ +/* $OpenBSD: tmux.h,v 1.440 2014/03/31 21:37:55 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -1086,6 +1086,8 @@ struct session { #define SESSION_UNATTACHED 0x1 /* not attached to any clients */ int flags; + u_int attached; + struct termios *tio; struct environ environ; |