From d1d2627781b4f72d3df46e82cad446aaacc25670 Mon Sep 17 00:00:00 2001 From: nicm Date: Tue, 5 Oct 2021 12:49:37 +0000 Subject: [PATCH] Make send-keys without any arguments send the key it is bound to (if any). GitHub issue 2904. --- usr.bin/tmux/cmd-send-keys.c | 8 +++++++- usr.bin/tmux/job.c | 3 +-- usr.bin/tmux/tmux.1 | 5 +++-- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/usr.bin/tmux/cmd-send-keys.c b/usr.bin/tmux/cmd-send-keys.c index 5a53b1d1909..f673394a468 100644 --- a/usr.bin/tmux/cmd-send-keys.c +++ b/usr.bin/tmux/cmd-send-keys.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-send-keys.c,v 1.68 2021/08/21 10:22:39 nicm Exp $ */ +/* $OpenBSD: cmd-send-keys.c,v 1.69 2021/10/05 12:49:37 nicm Exp $ */ /* * Copyright (c) 2008 Nicholas Marriott @@ -202,6 +202,12 @@ cmd_send_keys_exec(struct cmd *self, struct cmdq_item *item) wp->flags |= (PANE_STYLECHANGED|PANE_REDRAW); } + if (count == 0) { + for (; np != 0; np--) + cmd_send_keys_inject_key(item, NULL, event->key); + return (CMD_RETURN_NORMAL); + } + for (; np != 0; np--) { for (i = 0; i < count; i++) { after = cmd_send_keys_inject_string(item, after, args, diff --git a/usr.bin/tmux/job.c b/usr.bin/tmux/job.c index 314776f873b..71cda8ea6ed 100644 --- a/usr.bin/tmux/job.c +++ b/usr.bin/tmux/job.c @@ -1,4 +1,4 @@ -/* $OpenBSD: job.c,v 1.63 2021/10/05 12:46:02 nicm Exp $ */ +/* $OpenBSD: job.c,v 1.64 2021/10/05 12:49:37 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott @@ -339,7 +339,6 @@ job_check_died(pid_t pid, int status) log_debug("job died %p: %s, pid %ld", job, job->cmd, (long) job->pid); job->status = status; - log_debug("job %p status %d", job, job->status); if (job->state == JOB_CLOSED) { if (job->completecb != NULL) diff --git a/usr.bin/tmux/tmux.1 b/usr.bin/tmux/tmux.1 index ebdcb07af5c..b41bf19f32e 100644 --- a/usr.bin/tmux/tmux.1 +++ b/usr.bin/tmux/tmux.1 @@ -1,4 +1,4 @@ -.\" $OpenBSD: tmux.1,v 1.855 2021/08/27 17:15:57 nicm Exp $ +.\" $OpenBSD: tmux.1,v 1.856 2021/10/05 12:49:37 nicm Exp $ .\" .\" Copyright (c) 2007 Nicholas Marriott .\" @@ -14,7 +14,7 @@ .\" IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING .\" OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" -.Dd $Mdocdate: August 27 2021 $ +.Dd $Mdocdate: October 5 2021 $ .Dt TMUX 1 .Os .Sh NAME @@ -3123,6 +3123,7 @@ or to send; if the string is not recognised as a key, it is sent as a series of characters. All arguments are sent sequentially from first to last. +If no keys are given and the command is bound to a key, then that key is used. .Pp The .Fl l -- 2.20.1