Update of /cvsroot/tmux/tmux
In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv1807
Modified Files:
cmd-lock-server.c cmd-select-layout.c cmd-select-pane.c
cmd-select-window.c cmd-set-option.c cmd-show-options.c tmux.1
Removed Files:
cmd-last-pane.c cmd-last-window.c cmd-lock-client.c
cmd-lock-session.c cmd-next-layout.c cmd-next-window.c
cmd-previous-layout.c cmd-previous-window.c
cmd-set-window-option.c cmd-show-window-options.c
Log Message:
Sync OpenBSD patchset 831:
Now that parsing is common, merge some of the small, related commands
together to use the same code.
Also add some arguments (such as -n and -p) to some commands to match
existing commands.
--- cmd-show-window-options.c DELETED ---
--- cmd-lock-session.c DELETED ---
--- cmd-next-layout.c DELETED ---
Index: tmux.1
===================================================================
RCS file: /cvsroot/tmux/tmux/tmux.1,v
retrieving revision 1.286
retrieving revision 1.287
diff -u -d -r1.286 -r1.287
--- tmux.1 7 Jan 2011 14:34:45 -0000 1.286
+++ tmux.1 7 Jan 2011 15:02:38 -0000 1.287
@@ -1259,6 +1259,7 @@
.Fl U
or downward (numerically higher).
.It Xo Ic select-layout
+.Op Fl np
.Op Fl t Ar target-window
.Op Ar layout-name
.Xc
@@ -1267,8 +1268,16 @@
If
.Ar layout-name
is not given, the last preset layout used (if any) is reapplied.
+.Fl n
+and
+.Fl p
+are equivalent to the
+.Ic next-layout
+and
+.Ic previous-layout
+commands.
.It Xo Ic select-pane
-.Op Fl DLRU
+.Op Fl lDLRU
.Op Fl t Ar target-pane
.Xc
.D1 (alias: Ic selectp )
@@ -1284,10 +1293,27 @@
.Fl U
is used, respectively the pane below, to the left, to the right, or above the
target pane is used.
-.It Ic select-window Op Fl t Ar target-window
+.Fl l
+is the same as using the
+.Ic last-pane
+command.
+.It Xo Ic select-window
+.Op Fl lnp
+.Op Fl t Ar target-window
+.Xc
.D1 (alias: Ic selectw )
Select the window at
.Ar target-window .
+.Fl l ,
+.Fl n
+and
+.Fl p
+are equivalent to the
+.Ic last-window ,
+.Ic next-window
+and
+.Ic previous-window
+commands.
.It Xo Ic split-window
.Op Fl dhvP
.Oo Fl l
Index: cmd-show-options.c
===================================================================
RCS file: /cvsroot/tmux/tmux/cmd-show-options.c,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -d -r1.23 -r1.24
--- cmd-show-options.c 7 Jan 2011 14:45:34 -0000 1.23
+++ cmd-show-options.c 7 Jan 2011 15:02:38 -0000 1.24
@@ -39,6 +39,16 @@
cmd_show_options_exec
};
+const struct cmd_entry cmd_show_window_options_entry = {
+ "show-window-options", "showw",
+ "gt:", 0, 0,
+ "[-g] " CMD_TARGET_WINDOW_USAGE,
+ 0,
+ NULL,
+ NULL,
+ cmd_show_options_exec
+};
+
int
cmd_show_options_exec(struct cmd *self, struct cmd_ctx *ctx)
{
@@ -53,7 +63,8 @@
if (args_has(self->args, 's')) {
oo = &global_options;
table = server_options_table;
- } else if (args_has(self->args, 'w')) {
+ } else if (args_has(self->args, 'w') ||
+ self->entry == &cmd_show_window_options_entry) {
table = window_options_table;
if (args_has(self->args, 'g'))
oo = &global_w_options;
--- cmd-set-window-option.c DELETED ---
--- cmd-previous-window.c DELETED ---
Index: cmd-select-window.c
===================================================================
RCS file: /cvsroot/tmux/tmux/cmd-select-window.c,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -d -r1.25 -r1.26
--- cmd-select-window.c 7 Jan 2011 14:45:34 -0000 1.25
+++ cmd-select-window.c 7 Jan 2011 15:02:38 -0000 1.26
@@ -31,23 +31,56 @@
const struct cmd_entry cmd_select_window_entry = {
"select-window", "selectw",
- "t:", 0, 0,
- CMD_TARGET_WINDOW_USAGE,
+ "lnpt:", 0, 0,
+ "[-lnp] " CMD_TARGET_WINDOW_USAGE,
+ 0,
+ cmd_select_window_key_binding,
+ NULL,
+ cmd_select_window_exec
+};
+
+const struct cmd_entry cmd_next_window_entry = {
+ "next-window", "next",
+ "at:", 0, 0,
+ "[-a] " CMD_TARGET_SESSION_USAGE,
+ 0,
+ cmd_select_window_key_binding,
+ NULL,
+ cmd_select_window_exec
+};
+
+const struct cmd_entry cmd_previous_window_entry = {
+ "previous-window", "prev",
+ "at:", 0, 0,
+ "[-a] " CMD_TARGET_SESSION_USAGE,
0,
cmd_select_window_key_binding,
NULL,
cmd_select_window_exec
};
+const struct cmd_entry cmd_last_window_entry = {
+ "last-window", "last",
+ "t:", 0, 0,
+ CMD_TARGET_SESSION_USAGE,
+ 0,
+ NULL,
+ NULL,
+ cmd_select_window_exec
+};
+
void
cmd_select_window_key_binding(struct cmd *self, int key)
{
char tmp[16];
- xsnprintf(tmp, sizeof tmp, ":%d", key - '0');
-
self->args = args_create(0);
- args_set(self->args, 't', tmp);
+ if (key >= '0' && key <= '9') {
+ xsnprintf(tmp, sizeof tmp, ":%d", key - '0');
+ args_set(self->args, 't', tmp);
+ }
+ if (key == ('n' | KEYC_ESCAPE) || key == ('p' | KEYC_ESCAPE))
+ args_set(self->args, 'a', NULL);
}
int
@@ -56,12 +89,50 @@
struct args *args = self->args;
struct winlink *wl;
struct session *s;
+ int next, previous, last, activity;
- if ((wl = cmd_find_window(ctx, args_get(args, 't'), &s)) == NULL)
- return (-1);
+ next = self->entry == &cmd_next_window_entry;
+ if (args_has(self->args, 'n'))
+ next = 1;
+ previous = self->entry == &cmd_previous_window_entry;
+ if (args_has(self->args, 'p'))
+ previous = 1;
+ last = self->entry == &cmd_last_window_entry;
+ if (args_has(self->args, 'l'))
+ last = 1;
+
+ if (next || previous || last) {
+ s = cmd_find_session(ctx, args_get(args, 't'));
+ if (s == NULL)
+ return (-1);
+
+ activity = args_has(self->args, 'a');
+ if (next) {
+ if (session_next(s, activity) != 0) {
+ ctx->error(ctx, "no next window");
+ return (-1);
+ }
+ } else if (previous) {
+ if (session_previous(s, activity) != 0) {
+ ctx->error(ctx, "no previous window");
+ return (-1);
+ }
+ } else {
+ if (session_last(s) != 0) {
+ ctx->error(ctx, "no last window");
+ return (-1);
+ }
+ }
- if (session_select(s, wl->idx) == 0)
server_redraw_session(s);
+ } else {
+ wl = cmd_find_window(ctx, args_get(args, 't'), &s);
+ if (wl == NULL)
+ return (-1);
+
+ if (session_select(s, wl->idx) == 0)
+ server_redraw_session(s);
+ }
recalculate_sizes();
return (0);
--- cmd-last-window.c DELETED ---
Index: cmd-lock-server.c
===================================================================
RCS file: /cvsroot/tmux/tmux/cmd-lock-server.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- cmd-lock-server.c 7 Jan 2011 14:45:34 -0000 1.10
+++ cmd-lock-server.c 7 Jan 2011 15:02:38 -0000 1.11
@@ -25,7 +25,7 @@
#include "tmux.h"
/*
- * Lock server.
+ * Lock commands.
*/
int cmd_lock_server_exec(struct cmd *, struct cmd_ctx *);
@@ -40,11 +40,45 @@
cmd_lock_server_exec
};
+const struct cmd_entry cmd_lock_session_entry = {
+ "lock-session", "locks",
+ "t:", 0, 0,
+ CMD_TARGET_SESSION_USAGE,
+ 0,
+ NULL,
+ NULL,
+ cmd_lock_server_exec
+};
+
+const struct cmd_entry cmd_lock_client_entry = {
+ "lock-client", "lockc",
+ "t:", 0, 0,
+ CMD_TARGET_CLIENT_USAGE,
+ 0,
+ NULL,
+ NULL,
+ cmd_lock_server_exec
+};
+
/* ARGSUSED */
int
-cmd_lock_server_exec(unused struct cmd *self, unused struct cmd_ctx *ctx)
+cmd_lock_server_exec(struct cmd *self, unused struct cmd_ctx *ctx)
{
- server_lock();
+ struct args *args = self->args;
+ struct client *c;
+ struct session *s;
+
+ if (self->entry == &cmd_lock_server_entry)
+ server_lock();
+ else if (self->entry == &cmd_lock_session_entry) {
+ if ((s = cmd_find_session(ctx, args_get(args, 't'))) == NULL)
+ return (-1);
+ server_lock_session(s);
+ } else {
+ if ((c = cmd_find_client(ctx, args_get(args, 't'))) == NULL)
+ return (-1);
+ server_lock_client(c);
+ }
recalculate_sizes();
return (0);
Index: cmd-select-pane.c
===================================================================
RCS file: /cvsroot/tmux/tmux/cmd-select-pane.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- cmd-select-pane.c 7 Jan 2011 14:45:34 -0000 1.14
+++ cmd-select-pane.c 7 Jan 2011 15:02:38 -0000 1.15
@@ -29,14 +29,24 @@
const struct cmd_entry cmd_select_pane_entry = {
"select-pane", "selectp",
- "DLRt:U", 0, 0,
- "[-DLRU] " CMD_TARGET_PANE_USAGE,
+ "lDLRt:U", 0, 0,
+ "[-lDLRU] " CMD_TARGET_PANE_USAGE,
0,
cmd_select_pane_key_binding,
NULL,
cmd_select_pane_exec
};
+const struct cmd_entry cmd_last_pane_entry = {
+ "last-pane", "lastp",
+ "t:", 0, 0,
+ CMD_TARGET_WINDOW_USAGE,
+ 0,
+ NULL,
+ NULL,
+ cmd_select_pane_exec
+};
+
void
cmd_select_pane_key_binding(struct cmd *self, int key)
{
@@ -60,6 +70,19 @@
struct winlink *wl;
struct window_pane *wp;
+ if (self->entry == &cmd_last_pane_entry || args_has(args, 'l')) {
+ wl = cmd_find_window(ctx, args_get(args, 't'), NULL);
+ if (wl == NULL)
+ return (-1);
+
+ if (wl->window->last == NULL) {
+ ctx->error(ctx, "no last pane");
+ return (-1);
+ }
+ window_set_active_pane(wl->window, wl->window->last);
+ return (0);
+ }
+
if ((wl = cmd_find_pane(ctx, args_get(args, 't'), NULL, &wp)) == NULL)
return (-1);
--- cmd-last-pane.c DELETED ---
--- cmd-next-window.c DELETED ---
--- cmd-lock-client.c DELETED ---
Index: cmd-select-layout.c
===================================================================
RCS file: /cvsroot/tmux/tmux/cmd-select-layout.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- cmd-select-layout.c 7 Jan 2011 14:45:34 -0000 1.13
+++ cmd-select-layout.c 7 Jan 2011 15:02:38 -0000 1.14
@@ -29,14 +29,34 @@
const struct cmd_entry cmd_select_layout_entry = {
"select-layout", "selectl",
- "t:", 0, 1,
- CMD_TARGET_WINDOW_USAGE " [layout-name]",
+ "npt:", 0, 1,
+ "[-np] " CMD_TARGET_WINDOW_USAGE " [layout-name]",
0,
cmd_select_layout_key_binding,
NULL,
cmd_select_layout_exec
};
+const struct cmd_entry cmd_next_layout_entry = {
+ "next-layout", "nextl",
+ "t:", 0, 0,
+ CMD_TARGET_WINDOW_USAGE,
+ 0,
+ NULL,
+ NULL,
+ cmd_select_layout_exec
+};
+
+const struct cmd_entry cmd_previous_layout_entry = {
+ "previous-layout", "prevl",
+ "t:", 0, 0,
+ CMD_TARGET_WINDOW_USAGE,
+ 0,
+ NULL,
+ NULL,
+ cmd_select_layout_exec
+};
+
void
cmd_select_layout_key_binding(struct cmd *self, int key)
{
@@ -68,11 +88,27 @@
struct args *args = self->args;
struct winlink *wl;
const char *layoutname;
- int layout;
+ int next, previous, layout;
if ((wl = cmd_find_window(ctx, args_get(args, 't'), NULL)) == NULL)
return (-1);
+ next = self->entry == &cmd_next_layout_entry;
+ if (args_has(self->args, 'n'))
+ next = 1;
+ previous = self->entry == &cmd_previous_layout_entry;
+ if (args_has(self->args, 'p'))
+ previous = 1;
+
+ if (next || previous) {
+ if (next)
+ layout = layout_set_next(wl->window);
+ else
+ layout = layout_set_previous(wl->window);
+ ctx->info(ctx, "arranging in: %s", layout_set_name(layout));
+ return (0);
+ }
+
if (args->argc == 0)
layout = wl->window->lastlayout;
else
--- cmd-previous-layout.c DELETED ---
Index: cmd-set-option.c
===================================================================
RCS file: /cvsroot/tmux/tmux/cmd-set-option.c,v
retrieving revision 1.106
retrieving revision 1.107
diff -u -d -r1.106 -r1.107
--- cmd-set-option.c 7 Jan 2011 14:51:54 -0000 1.106
+++ cmd-set-option.c 7 Jan 2011 15:02:38 -0000 1.107
@@ -68,6 +68,16 @@
cmd_set_option_exec
};
+const struct cmd_entry cmd_set_window_option_entry = {
+ "set-window-option", "setw",
+ "agt:u", 1, 2,
+ "[-agu] " CMD_TARGET_WINDOW_USAGE " option [value]",
+ 0,
+ NULL,
+ NULL,
+ cmd_set_option_exec
+};
+
int
cmd_set_option_exec(struct cmd *self, struct cmd_ctx *ctx)
{
@@ -87,7 +97,8 @@
if (args_has(self->args, 's')) {
oo = &global_options;
table = server_options_table;
- } else if (args_has(self->args, 'w')) {
+ } else if (args_has(self->args, 'w') ||
+ self->entry == &cmd_set_window_option_entry) {
table = window_options_table;
if (args_has(self->args, 'g'))
oo = &global_w_options;
------------------------------------------------------------------------------
Gaining the trust of online customers is vital for the success of any company
that requires sensitive data to be transmitted over the Web. Learn how to
best implement a security strategy that keeps consumers' information secure
and instills the confidence they need to proceed with transactions.
http://p.sf.net/sfu/oracle-sfdevnl
_______________________________________________
tmux-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tmux-cvs