From 9fe43d6acbc4468e3490f9a93df25b37c7dd18fa Mon Sep 17 00:00:00 2001 From: nicm Date: Tue, 15 Nov 2016 09:53:23 +0000 Subject: [PATCH] Add copy-pipe-and-cancel, from Artem Fokin. --- tmux.1 | 1 + window-copy.c | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/tmux.1 b/tmux.1 index 61612831..b474b578 100644 --- a/tmux.1 +++ b/tmux.1 @@ -1032,6 +1032,7 @@ The following commands are supported in copy mode: .It Li "copy-end-of-line" Ta "D" Ta "C-k" .It Li "copy-line" Ta "" Ta "" .It Li "copy-pipe " Ta "" Ta "" +.It Li "copy-pipe-and-cancel " Ta "" Ta "" .It Li "copy-selection" Ta "" Ta "" .It Li "copy-selection-and-cancel" Ta "Enter" Ta "M-w" .It Li "cursor-down" Ta "j" Ta "Down" diff --git a/window-copy.c b/window-copy.c index 507461d6..0d83db01 100644 --- a/window-copy.c +++ b/window-copy.c @@ -63,7 +63,7 @@ static void window_copy_goto_line(struct window_pane *, const char *); static void window_copy_update_cursor(struct window_pane *, u_int, u_int); static void window_copy_start_selection(struct window_pane *); static int window_copy_update_selection(struct window_pane *, int); -static void *window_copy_get_selection(struct window_pane *, size_t *); +static void *window_copy_get_selection(struct window_pane *, size_t *); static void window_copy_copy_buffer(struct window_pane *, const char *, void *, size_t); static void window_copy_copy_pipe(struct window_pane *, struct session *, @@ -761,6 +761,10 @@ window_copy_command(struct window_pane *wp, struct client *c, struct session *s, } else if (args->argc == 2 && *args->argv[1] != '\0') { argument = args->argv[1]; if (strcmp(command, "copy-pipe") == 0) { + if (s != NULL) + window_copy_copy_pipe(wp, s, NULL, argument); + } + if (strcmp(command, "copy-pipe-and-cancel") == 0) { if (s != NULL) { window_copy_copy_pipe(wp, s, NULL, argument); window_pane_reset_mode(wp);