aboutsummaryrefslogtreecommitdiff
path: root/status.c
diff options
context:
space:
mode:
authorTiago Cunha <tcunha@gmx.com>2009-07-17 18:32:54 +0000
committerTiago Cunha <tcunha@gmx.com>2009-07-17 18:32:54 +0000
commitae7dda10ceaf340fdeb4b365b79ca77789ebd844 (patch)
tree0e383c65c0da8455c9d9ed17a35c1648a7c8f508 /status.c
parent646632de1d1d88049c8e06604214104c99b9c97d (diff)
downloadrtmux-ae7dda10ceaf340fdeb4b365b79ca77789ebd844.tar.gz
rtmux-ae7dda10ceaf340fdeb4b365b79ca77789ebd844.tar.bz2
rtmux-ae7dda10ceaf340fdeb4b365b79ca77789ebd844.zip
- New command display-message (alias display) to display a message in the
status line (bound to "i" by default). - Add support for including the window index, pane index, and window name in status-left, or status-right. - Bump protocol version.
Diffstat (limited to 'status.c')
-rw-r--r--status.c23
1 files changed, 20 insertions, 3 deletions
diff --git a/status.c b/status.c
index a7b112fb..1b8e5a0b 100644
--- a/status.c
+++ b/status.c
@@ -1,4 +1,4 @@
-/* $Id: status.c,v 1.97 2009-07-17 09:26:21 nicm Exp $ */
+/* $Id: status.c,v 1.98 2009-07-17 18:32:54 tcunha Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -29,7 +29,6 @@
#include "tmux.h"
-char *status_replace(struct session *, char *, time_t);
char *status_replace_popen(char **);
size_t status_width(struct winlink *);
char *status_print(struct session *, struct winlink *, struct grid_cell *);
@@ -275,7 +274,7 @@ out:
}
char *
-status_replace(struct session *s, char *fmt, time_t t)
+status_replace(struct session *s, const char *fmt, time_t t)
{
struct winlink *wl = s->curw;
static char out[BUFSIZ];
@@ -323,6 +322,20 @@ status_replace(struct session *s, char *fmt, time_t t)
ptr = tmp;
}
/* FALLTHROUGH */
+ case 'I':
+ if (ptr == NULL) {
+ xsnprintf(tmp, sizeof tmp, "%d", wl->idx);
+ ptr = tmp;
+ }
+ /* FALLTHROUGH */
+ case 'P':
+ if (ptr == NULL) {
+ xsnprintf(tmp, sizeof tmp, "%u",
+ window_pane_index(wl->window,
+ wl->window->active));
+ ptr = tmp;
+ }
+ /* FALLTHOUGH */
case 'S':
if (ptr == NULL)
ptr = s->name;
@@ -330,6 +343,10 @@ status_replace(struct session *s, char *fmt, time_t t)
case 'T':
if (ptr == NULL)
ptr = wl->window->active->base.title;
+ /* FALLTHROUGH */
+ case 'W':
+ if (ptr == NULL)
+ ptr = wl->window->name;
len = strlen(ptr);
if ((size_t) n < len)
len = n;