summaryrefslogtreecommitdiffstats
path: root/cmd-send-keys.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@openbsd.org>2012-01-21 08:10:21 +0000
committerNicholas Marriott <nicm@openbsd.org>2012-01-21 08:10:21 +0000
commit66f04514cf23a6202ad2dae3cdb96cd0ae74010c (patch)
tree0ad359bb6c1e7c2de568114066fa55bdcfccd10e /cmd-send-keys.c
parentcd10f7322a5b33195a8864fa6b7a410387284d16 (diff)
Add a -R flag to send-keys to reset the terminal. Written ages ago and
Suggested by someone, I forget who.
Diffstat (limited to 'cmd-send-keys.c')
-rw-r--r--cmd-send-keys.c22
1 files changed, 20 insertions, 2 deletions
diff --git a/cmd-send-keys.c b/cmd-send-keys.c
index 8181e563..2e4775aa 100644
--- a/cmd-send-keys.c
+++ b/cmd-send-keys.c
@@ -19,6 +19,7 @@
#include <sys/types.h>
#include <stdlib.h>
+#include <string.h>
#include "tmux.h"
@@ -30,8 +31,8 @@ int cmd_send_keys_exec(struct cmd *, struct cmd_ctx *);
const struct cmd_entry cmd_send_keys_entry = {
"send-keys", "send",
- "t:", 0, -1,
- "[-t target-pane] key ...",
+ "Rt:", 0, -1,
+ "[-R] [-t target-pane] key ...",
0,
NULL,
NULL,
@@ -44,12 +45,29 @@ cmd_send_keys_exec(struct cmd *self, struct cmd_ctx *ctx)
struct args *args = self->args;
struct window_pane *wp;
struct session *s;
+ struct input_ctx *ictx;
const char *str;
int i, key;
if (cmd_find_pane(ctx, args_get(args, 't'), &s, &wp) == NULL)
return (-1);
+ if (args_has(args, 'R')) {
+ ictx = &wp->ictx;
+
+ memcpy(&ictx->cell, &grid_default_cell, sizeof ictx->cell);
+ memcpy(&ictx->old_cell, &ictx->cell, sizeof ictx->old_cell);
+ ictx->old_cx = 0;
+ ictx->old_cy = 0;
+
+ if (wp->mode == NULL)
+ screen_write_start(&ictx->ctx, wp, &wp->base);
+ else
+ screen_write_start(&ictx->ctx, NULL, &wp->base);
+ screen_write_reset(&ictx->ctx);
+ screen_write_stop(&ictx->ctx);
+ }
+
for (i = 0; i < args->argc; i++) {
str = args->argv[i];