Update of /cvsroot/tmux/tmux
In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv11695
Modified Files:
cmd-new-window.c cmd-split-window.c tmux.1
Log Message:
Sync OpenBSD patchset 820:
Add a -P option to new-window and split-window to print the new window
or pane index in target form (useful to pass it into other commands).
Index: cmd-split-window.c
===================================================================
RCS file: /cvsroot/tmux/tmux/cmd-split-window.c,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -d -r1.35 -r1.36
--- cmd-split-window.c 2 Jul 2010 02:49:19 -0000 1.35
+++ cmd-split-window.c 3 Jan 2011 23:29:09 -0000 1.36
@@ -38,13 +38,14 @@
char *cmd;
int flag_detached;
int flag_horizontal;
+ int flag_print;
int percentage;
int size;
};
const struct cmd_entry cmd_split_window_entry = {
"split-window", "splitw",
- "[-dhv] [-p percentage|-l size] [-t target-pane] [command]",
+ "[-dhvP] [-p percentage|-l size] [-t target-pane] [command]",
0, "",
cmd_split_window_init,
cmd_split_window_parse,
@@ -63,6 +64,7 @@
data->cmd = NULL;
data->flag_detached = 0;
data->flag_horizontal = 0;
+ data->flag_print = 0;
data->percentage = -1;
data->size = -1;
@@ -86,7 +88,7 @@
self->entry->init(self, KEYC_NONE);
data = self->data;
- while ((opt = getopt(argc, argv, "dhl:p:t:v")) != -1) {
+ while ((opt = getopt(argc, argv, "dhl:p:Pt:v")) != -1) {
switch (opt) {
case 'd':
data->flag_detached = 1;
@@ -116,6 +118,9 @@
goto error;
}
break;
+ case 'P':
+ data->flag_print = 1;
+ break;
case 'v':
data->flag_horizontal = 0;
break;
@@ -152,7 +157,7 @@
struct environ env;
char *cmd, *cwd, *cause;
const char *shell;
- u_int hlimit;
+ u_int hlimit, paneidx;
int size;
enum layout_type type;
struct layout_cell *lc;
@@ -216,6 +221,11 @@
server_status_session(s);
environ_free(&env);
+
+ if (data->flag_print) {
+ paneidx = window_pane_index(wl->window, new_wp);
+ ctx->print(ctx, "%s:%u.%u", s->name, wl->idx, paneidx);
+ }
return (0);
error:
@@ -252,6 +262,8 @@
off += xsnprintf(buf + off, len - off, " -d");
if (off < len && data->flag_horizontal)
off += xsnprintf(buf + off, len - off, " -h");
+ if (off < len && data->flag_print)
+ off += xsnprintf(buf + off, len - off, " -P");
if (off < len && data->size > 0)
off += xsnprintf(buf + off, len - off, " -l %d", data->size);
if (off < len && data->percentage > 0) {
Index: cmd-new-window.c
===================================================================
RCS file: /cvsroot/tmux/tmux/cmd-new-window.c,v
retrieving revision 1.47
retrieving revision 1.48
diff -u -d -r1.47 -r1.48
--- cmd-new-window.c 2 Jul 2010 02:49:19 -0000 1.47
+++ cmd-new-window.c 3 Jan 2011 23:29:09 -0000 1.48
@@ -39,11 +39,12 @@
int flag_insert_after;
int flag_detached;
int flag_kill;
+ int flag_print;
};
const struct cmd_entry cmd_new_window_entry = {
"new-window", "neww",
- "[-adk] [-n window-name] [-t target-window] [command]",
+ "[-adkP] [-n window-name] [-t target-window] [command]",
0, "",
cmd_new_window_init,
cmd_new_window_parse,
@@ -65,6 +66,7 @@
data->flag_insert_after = 0;
data->flag_detached = 0;
data->flag_kill = 0;
+ data->flag_print = 0;
}
int
@@ -76,7 +78,7 @@
self->entry->init(self, KEYC_NONE);
data = self->data;
- while ((opt = getopt(argc, argv, "adkt:n:")) != -1) {
+ while ((opt = getopt(argc, argv, "adkt:n:P")) != -1) {
switch (opt) {
case 'a':
data->flag_insert_after = 1;
@@ -95,6 +97,9 @@
if (data->name == NULL)
data->name = xstrdup(optarg);
break;
+ case 'P':
+ data->flag_print = 1;
+ break;
default:
goto usage;
}
@@ -198,6 +203,8 @@
} else
server_status_session_group(s);
+ if (data->flag_print)
+ ctx->print(ctx, "%s:%u", s->name, wl->idx);
return (0);
}
@@ -226,6 +233,8 @@
return (off);
if (off < len && data->flag_detached)
off += xsnprintf(buf + off, len - off, " -d");
+ if (off < len && data->flag_print)
+ off += xsnprintf(buf + off, len - off, " -P");
if (off < len && data->target != NULL)
off += cmd_prarg(buf + off, len - off, " -t ", data->target);
if (off < len && data->name != NULL)
Index: tmux.1
===================================================================
RCS file: /cvsroot/tmux/tmux/tmux.1,v
retrieving revision 1.283
retrieving revision 1.284
diff -u -d -r1.283 -r1.284
--- tmux.1 31 Dec 2010 02:00:30 -0000 1.283
+++ tmux.1 3 Jan 2011 23:29:09 -0000 1.284
@@ -1101,7 +1101,7 @@
is moved to
.Ar dst-window .
.It Xo Ic new-window
-.Op Fl adk
+.Op Fl adkP
.Op Fl n Ar window-name
.Op Fl t Ar target-window
.Op Ar shell-command
@@ -1149,6 +1149,10 @@
.Dq TERM=screen
added to their environment, but care must be taken not to reset this in shell
start-up files.
+.Pp
+The
+.Fl P
+option prints the location of the new window after it has been created.
.It Ic next-layout Op Fl t Ar target-window
.D1 (alias: Ic nextl )
Move a window to the next layout and rearrange the panes to fit.
@@ -1285,7 +1289,7 @@
Select the window at
.Ar target-window .
.It Xo Ic split-window
-.Op Fl dhv
+.Op Fl dhvP
.Oo Fl l
.Ar size |
.Fl p Ar percentage Oc
------------------------------------------------------------------------------
Learn how Oracle Real Application Clusters (RAC) One Node allows customers
to consolidate database storage, standardize their database environment, and,
should the need arise, upgrade to a full multi-node Oracle RAC database
without downtime or disruption
http://p.sf.net/sfu/oracle-sfdevnl
_______________________________________________
tmux-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tmux-cvs