Update of /cvsroot/tmux/tmux
In directory vz-cvs-2.sog:/tmp/cvs-serv19811
Modified Files:
cmd-display-message.c cmd-pipe-pane.c server-client.c status.c
tmux.1 tmux.h
Log Message:
|PatchSet 876
|Date: 2011/03/29 20:30:16
|Author: nicm
|Branch: HEAD
|Tag: (none)
|Log:
|Change -t on display-message to be target-pane for the #[A-Z]
|replacements and add -c as target-client.
Index: server-client.c
===================================================================
RCS file: /cvsroot/tmux/tmux/server-client.c,v
retrieving revision 1.54
retrieving revision 1.55
diff -u -d -r1.54 -r1.55
--- server-client.c 15 Feb 2011 15:20:03 -0000 1.54
+++ server-client.c 6 Apr 2011 22:21:02 -0000 1.55
@@ -613,7 +613,7 @@
template = options_get_string(&s->options, "set-titles-string");
- title = status_replace(c, NULL, template, time(NULL), 1);
+ title = status_replace(c, NULL, NULL, NULL, template, time(NULL), 1);
if (c->title == NULL || strcmp(title, c->title) != 0) {
if (c->title != NULL)
xfree(c->title);
Index: cmd-pipe-pane.c
===================================================================
RCS file: /cvsroot/tmux/tmux/cmd-pipe-pane.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- cmd-pipe-pane.c 21 Jan 2011 23:44:13 -0000 1.17
+++ cmd-pipe-pane.c 6 Apr 2011 22:21:02 -0000 1.18
@@ -112,7 +112,8 @@
closefrom(STDERR_FILENO + 1);
- command = status_replace(c, NULL, args->argv[0], time(NULL), 0);
+ command = status_replace(
+ c, NULL, NULL, NULL, args->argv[0], time(NULL), 0);
execl(_PATH_BSHELL, "sh", "-c", command, (char *) NULL);
_exit(1);
default:
Index: tmux.1
===================================================================
RCS file: /cvsroot/tmux/tmux/tmux.1,v
retrieving revision 1.299
retrieving revision 1.300
diff -u -d -r1.299 -r1.300
--- tmux.1 6 Apr 2011 22:20:16 -0000 1.299
+++ tmux.1 6 Apr 2011 22:21:02 -0000 1.300
@@ -2615,7 +2615,8 @@
.Nm .
.It Xo Ic display-message
.Op Fl p
-.Op Fl t Ar target-client
+.Op Fl c Ar target-client
+.Op Fl t Ar target-pane
.Op Ar message
.Xc
.D1 (alias: Ic display )
@@ -2629,7 +2630,12 @@
.Ar message
is as for
.Ic status-left ,
-with the exception that #() are not handled.
+with the exception that #() are not handled; information is taken from
+.Ar target-pane
+if
+.Fl t
+is given, otherwise the active pane for the session attached to
+.Ar target-client .
.El
.Sh BUFFERS
.Nm
Index: cmd-display-message.c
===================================================================
RCS file: /cvsroot/tmux/tmux/cmd-display-message.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- cmd-display-message.c 7 Jan 2011 14:45:34 -0000 1.8
+++ cmd-display-message.c 6 Apr 2011 22:21:02 -0000 1.9
@@ -30,8 +30,8 @@
const struct cmd_entry cmd_display_message_entry = {
"display-message", "display",
- "pt:", 0, 1,
- "[-p] " CMD_TARGET_CLIENT_USAGE " [message]",
+ "c:pt:", 0, 1,
+ "[-p] [-c target-client] [-t target-pane] [message]",
0,
NULL,
NULL,
@@ -43,18 +43,31 @@
{
struct args *args = self->args;
struct client *c;
+ struct session *s;
+ struct winlink *wl;
+ struct window_pane *wp;
const char *template;
char *msg;
- if ((c = cmd_find_client(ctx, args_get(args, 't'))) == NULL)
+ if ((c = cmd_find_client(ctx, args_get(args, 'c'))) == NULL)
return (-1);
+ if (args_has(args, 't') != NULL) {
+ wl = cmd_find_pane(ctx, args_get(args, 't'), &s, &wp);
+ if (wl == NULL)
+ return (-1);
+ } else {
+ s = NULL;
+ wl = NULL;
+ wp = NULL;
+ }
+
if (args->argc == 0)
template = "[#S] #I:#W, current pane #P - (%H:%M %d-%b-%y)";
else
template = args->argv[0];
- msg = status_replace(c, NULL, template, time(NULL), 0);
+ msg = status_replace(c, s, wl, wp, template, time(NULL), 0);
if (args_has(self->args, 'p'))
ctx->print(ctx, "%s", msg);
else
Index: tmux.h
===================================================================
RCS file: /cvsroot/tmux/tmux/tmux.h,v
retrieving revision 1.615
retrieving revision 1.616
diff -u -d -r1.615 -r1.616
--- tmux.h 6 Apr 2011 22:18:56 -0000 1.615
+++ tmux.h 6 Apr 2011 22:21:02 -0000 1.616
@@ -1662,8 +1662,8 @@
void status_free_jobs(struct status_out_tree *);
void status_update_jobs(struct client *);
int status_redraw(struct client *);
-char *status_replace(
- struct client *, struct winlink *, const char *, time_t, int);
+char *status_replace(struct client *, struct session *,
+ struct winlink *, struct window_pane *, const char *, time_t, int);
void printflike2 status_message_set(struct client *, const char *, ...);
void status_message_clear(struct client *);
int status_message_redraw(struct client *);
Index: status.c
===================================================================
RCS file: /cvsroot/tmux/tmux/status.c,v
retrieving revision 1.156
retrieving revision 1.157
diff -u -d -r1.156 -r1.157
--- status.c 15 Feb 2011 15:20:03 -0000 1.156
+++ status.c 6 Apr 2011 22:21:02 -0000 1.157
@@ -38,8 +38,8 @@
void status_job_callback(struct job *);
char *status_print(
struct client *, struct winlink *, time_t, struct grid_cell *);
-void status_replace1(struct client *,
- struct winlink *, char **, char **, char *, size_t, int);
+void status_replace1(struct client *, struct session *, struct winlink *,
+ struct window_pane *, char **, char **, char *, size_t, int);
void status_message_callback(int, short, void *);
const char *status_prompt_up_history(u_int *);
@@ -80,8 +80,8 @@
if (attr != 0)
gc->attr = attr;
- left = status_replace(
- c, NULL, options_get_string(&s->options, "status-left"), t, 1);
+ left = status_replace(c, NULL,
+ NULL, NULL, options_get_string(&s->options, "status-left"), t, 1);
*size = options_get_number(&s->options, "status-left-length");
leftlen = screen_write_cstrlen(utf8flag, "%s", left);
@@ -110,8 +110,8 @@
if (attr != 0)
gc->attr = attr;
- right = status_replace(
- c, NULL, options_get_string(&s->options, "status-right"), t, 1);
+ right = status_replace(c, NULL,
+ NULL, NULL, options_get_string(&s->options, "status-right"), t, 1);
*size = options_get_number(&s->options, "status-right-length");
rightlen = screen_write_cstrlen(utf8flag, "%s", right);
@@ -347,16 +347,20 @@
/* Replace a single special sequence (prefixed by #). */
void
-status_replace1(struct client *c,struct winlink *wl,
- char **iptr, char **optr, char *out, size_t outsize, int jobsflag)
+status_replace1(struct client *c, struct session *s, struct winlink *wl,
+ struct window_pane *wp, char **iptr, char **optr, char *out,
+ size_t outsize, int jobsflag)
{
- struct session *s = c->session;
- char ch, tmp[256], *ptr, *endptr, *freeptr;
- size_t ptrlen;
- long limit;
+ char ch, tmp[256], *ptr, *endptr, *freeptr;
+ size_t ptrlen;
+ long limit;
+ if (s == NULL)
+ s = c->session;
if (wl == NULL)
wl = s->curw;
+ if (wp == NULL)
+ wp = wl->window->active;
errno = 0;
limit = strtol(*iptr, &endptr, 10);
@@ -379,6 +383,10 @@
if ((ptr = status_find_job(c, iptr)) == NULL)
return;
goto do_replace;
+ case 'D':
+ xsnprintf(tmp, sizeof tmp, "%%%u", wp->id);
+ ptr = tmp;
+ goto do_replace;
case 'H':
if (gethostname(tmp, sizeof tmp) != 0)
fatal("gethostname failed");
@@ -389,15 +397,15 @@
ptr = tmp;
goto do_replace;
case 'P':
- xsnprintf(tmp, sizeof tmp, "%u",
- window_pane_index(wl->window, wl->window->active));
+ xsnprintf(
+ tmp, sizeof tmp, "%u", window_pane_index(wl->window, wp));
ptr = tmp;
goto do_replace;
case 'S':
ptr = s->name;
goto do_replace;
case 'T':
- ptr = wl->window->active->base.title;
+ ptr = wp->base.title;
goto do_replace;
case 'W':
ptr = wl->window->name;
@@ -449,8 +457,8 @@
/* Replace special sequences in fmt. */
char *
-status_replace(struct client *c,
- struct winlink *wl, const char *fmt, time_t t, int jobsflag)
+status_replace(struct client *c, struct session *s, struct winlink *wl,
+ struct window_pane *wp, const char *fmt, time_t t, int jobsflag)
{
static char out[BUFSIZ];
char in[BUFSIZ], ch, *iptr, *optr;
@@ -470,7 +478,8 @@
*optr++ = ch;
continue;
}
- status_replace1(c, wl, &iptr, &optr, out, sizeof out, jobsflag);
+ status_replace1(
+ c, s, wl, wp, &iptr, &optr, out, sizeof out, jobsflag);
}
*optr = '\0';
@@ -657,7 +666,7 @@
gc->attr = attr;
}
- text = status_replace(c, wl, fmt, t, 1);
+ text = status_replace(c, NULL, wl, NULL, fmt, t, 1);
return (text);
}
------------------------------------------------------------------------------
Xperia(TM) PLAY
It's a major breakthrough. An authentic gaming
smartphone on the nation's most reliable network.
And it wants your games.
http://p.sf.net/sfu/verizon-sfdev
_______________________________________________
tmux-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tmux-cvs