summaryrefslogtreecommitdiff
path: root/usr.bin/tmux/mode-key.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2013-03-22 15:52:43 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2013-03-22 15:52:43 +0000
commit50047bf5bd06d7e1c60053cb48afbb3e925b51c4 (patch)
treefda91716bd53e83b22b1d5dc2f1a16c307cfa8a0 /usr.bin/tmux/mode-key.c
parentb5b006fafbbbab706603de741e249fa4a663f25d (diff)
Add copy-pipe mode command to copy selection and also pipe to a command.
Diffstat (limited to 'usr.bin/tmux/mode-key.c')
-rw-r--r--usr.bin/tmux/mode-key.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/usr.bin/tmux/mode-key.c b/usr.bin/tmux/mode-key.c
index 012a0c97c02..538562c3bb9 100644
--- a/usr.bin/tmux/mode-key.c
+++ b/usr.bin/tmux/mode-key.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mode-key.c,v 1.51 2013/03/21 16:54:37 nicm Exp $ */
+/* $OpenBSD: mode-key.c,v 1.52 2013/03/22 15:52:40 nicm Exp $ */
/*
* Copyright (c) 2008 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -99,6 +99,7 @@ const struct mode_key_cmdstr mode_key_cmdstr_copy[] = {
{ MODEKEYCOPY_BOTTOMLINE, "bottom-line" },
{ MODEKEYCOPY_CANCEL, "cancel" },
{ MODEKEYCOPY_CLEARSELECTION, "clear-selection" },
+ { MODEKEYCOPY_COPYPIPE, "copy-pipe" },
{ MODEKEYCOPY_COPYLINE, "copy-line" },
{ MODEKEYCOPY_COPYENDOFLINE, "copy-end-of-line" },
{ MODEKEYCOPY_COPYSELECTION, "copy-selection" },
@@ -513,6 +514,7 @@ mode_key_init_trees(void)
mbind->key = ment->key;
mbind->mode = ment->mode;
mbind->cmd = ment->cmd;
+ mbind->arg = NULL;
RB_INSERT(mode_key_tree, mtab->tree, mbind);
}
}
@@ -526,7 +528,7 @@ mode_key_init(struct mode_key_data *mdata, struct mode_key_tree *mtree)
}
enum mode_key_cmd
-mode_key_lookup(struct mode_key_data *mdata, int key)
+mode_key_lookup(struct mode_key_data *mdata, int key, const char **arg)
{
struct mode_key_binding *mbind, mtmp;
@@ -546,6 +548,8 @@ mode_key_lookup(struct mode_key_data *mdata, int key)
mdata->mode = 1 - mdata->mode;
/* FALLTHROUGH */
default:
+ if (arg != NULL)
+ *arg = mbind->arg;
return (mbind->cmd);
}
}