summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2015-02-09 23:18:20 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2015-02-09 23:18:20 +0000
commitb7215c44d0a052d4dd760c854ffab7d76e17bb69 (patch)
treec11905800757c6b934a593fb79a47f18d1854b44
parent8e3eb13f8784dc91d33df8398915069f8205f27a (diff)
Merge clock-mode command into copy-mode.
-rw-r--r--usr.bin/tmux/Makefile3
-rw-r--r--usr.bin/tmux/cmd-clock-mode.c49
-rw-r--r--usr.bin/tmux/cmd-copy-mode.c17
3 files changed, 16 insertions, 53 deletions
diff --git a/usr.bin/tmux/Makefile b/usr.bin/tmux/Makefile
index 6c3a379e4c4..16d471a35f9 100644
--- a/usr.bin/tmux/Makefile
+++ b/usr.bin/tmux/Makefile
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile,v 1.76 2014/10/27 22:40:29 nicm Exp $
+# $OpenBSD: Makefile,v 1.77 2015/02/09 23:18:19 nicm Exp $
PROG= tmux
SRCS= arguments.c \
@@ -13,7 +13,6 @@ SRCS= arguments.c \
cmd-choose-client.c \
cmd-choose-tree.c \
cmd-clear-history.c \
- cmd-clock-mode.c \
cmd-command-prompt.c \
cmd-confirm-before.c \
cmd-copy-mode.c \
diff --git a/usr.bin/tmux/cmd-clock-mode.c b/usr.bin/tmux/cmd-clock-mode.c
deleted file mode 100644
index a852fbc05b7..00000000000
--- a/usr.bin/tmux/cmd-clock-mode.c
+++ /dev/null
@@ -1,49 +0,0 @@
-/* $OpenBSD: cmd-clock-mode.c,v 1.10 2014/10/20 22:29:25 nicm Exp $ */
-
-/*
- * Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
- * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
- * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-#include <sys/types.h>
-
-#include "tmux.h"
-
-/*
- * Enter clock mode.
- */
-
-enum cmd_retval cmd_clock_mode_exec(struct cmd *, struct cmd_q *);
-
-const struct cmd_entry cmd_clock_mode_entry = {
- "clock-mode", NULL,
- "t:", 0, 0,
- CMD_TARGET_PANE_USAGE,
- 0,
- cmd_clock_mode_exec
-};
-
-enum cmd_retval
-cmd_clock_mode_exec(struct cmd *self, struct cmd_q *cmdq)
-{
- struct args *args = self->args;
- struct window_pane *wp;
-
- if (cmd_find_pane(cmdq, args_get(args, 't'), NULL, &wp) == NULL)
- return (CMD_RETURN_ERROR);
-
- window_pane_set_mode(wp, &window_clock_mode);
-
- return (CMD_RETURN_NORMAL);
-}
diff --git a/usr.bin/tmux/cmd-copy-mode.c b/usr.bin/tmux/cmd-copy-mode.c
index 1b6cf3bf4b6..12adde12c69 100644
--- a/usr.bin/tmux/cmd-copy-mode.c
+++ b/usr.bin/tmux/cmd-copy-mode.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd-copy-mode.c,v 1.17 2014/10/20 22:29:25 nicm Exp $ */
+/* $OpenBSD: cmd-copy-mode.c,v 1.18 2015/02/09 23:18:19 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -21,7 +21,7 @@
#include "tmux.h"
/*
- * Enter copy mode.
+ * Enter copy or clock mode.
*/
enum cmd_retval cmd_copy_mode_exec(struct cmd *, struct cmd_q *);
@@ -34,6 +34,14 @@ const struct cmd_entry cmd_copy_mode_entry = {
cmd_copy_mode_exec
};
+const struct cmd_entry cmd_clock_mode_entry = {
+ "clock-mode", NULL,
+ "t:", 0, 0,
+ CMD_TARGET_PANE_USAGE,
+ 0,
+ cmd_copy_mode_exec
+};
+
enum cmd_retval
cmd_copy_mode_exec(struct cmd *self, struct cmd_q *cmdq)
{
@@ -43,6 +51,11 @@ cmd_copy_mode_exec(struct cmd *self, struct cmd_q *cmdq)
if (cmd_find_pane(cmdq, args_get(args, 't'), NULL, &wp) == NULL)
return (CMD_RETURN_ERROR);
+ if (self->entry == &cmd_clock_mode_entry) {
+ window_pane_set_mode(wp, &window_clock_mode);
+ return (CMD_RETURN_NORMAL);
+ }
+
if (wp->mode != &window_copy_mode) {
if (window_pane_set_mode(wp, &window_copy_mode) != 0)
return (CMD_RETURN_NORMAL);