aboutsummaryrefslogtreecommitdiff
path: root/status.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@openbsd.org>2009-07-17 18:45:08 +0000
committerNicholas Marriott <nicm@openbsd.org>2009-07-17 18:45:08 +0000
commit6f5150a943425d7d5d65ae443f956931fcb82d0b (patch)
treec216bcb4894a8b6b330cc4775e8490e10a8b18b3 /status.c
parentad006bc6b66f335e87c0876d1b77af3541a4b517 (diff)
downloadrtmux-6f5150a943425d7d5d65ae443f956931fcb82d0b.tar.gz
rtmux-6f5150a943425d7d5d65ae443f956931fcb82d0b.tar.bz2
rtmux-6f5150a943425d7d5d65ae443f956931fcb82d0b.zip
- New command display-message (alias display) to display a message in the
status line (bound to "i" and displays the current window and time by default). The same substitutions are applied as for status-left/right. - Add support for including the window index (#I), pane index (#P) and window name (#W) in the message, and status-left or status-right. - Bump protocol version. From Tiago Cunha, thanks!
Diffstat (limited to 'status.c')
-rw-r--r--status.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/status.c b/status.c
index 32effe5d..c5190b54 100644
--- a/status.c
+++ b/status.c
@@ -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;