Merge branch 'obsd-master'

pull/2195/head
Thomas Adam 2020-04-17 10:01:38 +01:00
commit 413c4cfd1b
4 changed files with 38 additions and 24 deletions

View File

@ -333,10 +333,10 @@ key_bindings_init(void)
"bind -n MouseDown2Pane select-pane -t=\\; if -F '#{||:#{pane_in_mode},#{mouse_any_flag}}' { send -M } { paste -p }",
/* Mouse button 1 double click on pane. */
"bind -n DoubleClick1Pane select-pane -t=\\; if -F '#{||:#{pane_in_mode},#{mouse_any_flag}}' { send -M } { copy-mode -H; send -X select-word; run -d0.3; send -X copy-selection-and-cancel }",
"bind -n DoubleClick1Pane select-pane -t=\\; if -F '#{||:#{pane_in_mode},#{mouse_any_flag}}' { send -M } { copy-mode -H; send -X select-word; run -d0.3; send -X copy-pipe-and-cancel }",
/* Mouse button 1 triple click on pane. */
"bind -n TripleClick1Pane select-pane -t=\\; if -F '#{||:#{pane_in_mode},#{mouse_any_flag}}' { send -M } { copy-mode -H; send -X select-line; run -d0.3; send -X copy-selection-and-cancel }",
"bind -n TripleClick1Pane select-pane -t=\\; if -F '#{||:#{pane_in_mode},#{mouse_any_flag}}' { send -M } { copy-mode -H; send -X select-line; run -d0.3; send -X copy-pipe-and-cancel }",
/* Mouse button 1 drag on border. */
"bind -n MouseDrag1Border resize-pane -M",
@ -374,7 +374,7 @@ key_bindings_init(void)
"bind -Tcopy-mode C-r command-prompt -ip'(search up)' -I'#{pane_search_string}' 'send -X search-backward-incremental \"%%%\"'",
"bind -Tcopy-mode C-s command-prompt -ip'(search down)' -I'#{pane_search_string}' 'send -X search-forward-incremental \"%%%\"'",
"bind -Tcopy-mode C-v send -X page-down",
"bind -Tcopy-mode C-w send -X copy-selection-and-cancel",
"bind -Tcopy-mode C-w send -X copy-pipe-and-cancel",
"bind -Tcopy-mode Escape send -X cancel",
"bind -Tcopy-mode Space send -X page-down",
"bind -Tcopy-mode , send -X jump-reverse",
@ -393,11 +393,11 @@ key_bindings_init(void)
"bind -Tcopy-mode End send -X end-of-line",
"bind -Tcopy-mode MouseDown1Pane select-pane",
"bind -Tcopy-mode MouseDrag1Pane select-pane\\; send -X begin-selection",
"bind -Tcopy-mode MouseDragEnd1Pane send -X copy-selection-and-cancel",
"bind -Tcopy-mode MouseDragEnd1Pane send -X copy-pipe-and-cancel",
"bind -Tcopy-mode WheelUpPane select-pane\\; send -N5 -X scroll-up",
"bind -Tcopy-mode WheelDownPane select-pane\\; send -N5 -X scroll-down",
"bind -Tcopy-mode DoubleClick1Pane select-pane\\; send -X select-word\\; run -d0.3\\; send -X copy-selection-and-cancel",
"bind -Tcopy-mode TripleClick1Pane select-pane\\; send -X select-line\\; run -d0.3\\; send -X copy-selection-and-cancel",
"bind -Tcopy-mode DoubleClick1Pane select-pane\\; send -X select-word\\; run -d0.3\\; send -X copy-pipe-and-cancel",
"bind -Tcopy-mode TripleClick1Pane select-pane\\; send -X select-line\\; run -d0.3\\; send -X copy-pipe-and-cancel",
"bind -Tcopy-mode NPage send -X page-down",
"bind -Tcopy-mode PPage send -X page-up",
"bind -Tcopy-mode Up send -X cursor-up",
@ -423,7 +423,7 @@ key_bindings_init(void)
"bind -Tcopy-mode M-m send -X back-to-indentation",
"bind -Tcopy-mode M-r send -X middle-line",
"bind -Tcopy-mode M-v send -X page-up",
"bind -Tcopy-mode M-w send -X copy-selection-and-cancel",
"bind -Tcopy-mode M-w send -X copy-pipe-and-cancel",
"bind -Tcopy-mode 'M-{' send -X previous-paragraph",
"bind -Tcopy-mode 'M-}' send -X next-paragraph",
"bind -Tcopy-mode M-Up send -X halfpage-up",
@ -440,8 +440,8 @@ key_bindings_init(void)
"bind -Tcopy-mode-vi C-b send -X page-up",
"bind -Tcopy-mode-vi C-f send -X page-down",
"bind -Tcopy-mode-vi C-h send -X cursor-left",
"bind -Tcopy-mode-vi C-j send -X copy-selection-and-cancel",
"bind -Tcopy-mode-vi Enter send -X copy-selection-and-cancel",
"bind -Tcopy-mode-vi C-j send -X copy-pipe-and-cancel",
"bind -Tcopy-mode-vi Enter send -X copy-pipe-and-cancel",
"bind -Tcopy-mode-vi C-u send -X halfpage-up",
"bind -Tcopy-mode-vi C-v send -X rectangle-toggle",
"bind -Tcopy-mode-vi C-y send -X scroll-up",
@ -499,11 +499,11 @@ key_bindings_init(void)
"bind -Tcopy-mode-vi % send -X next-matching-bracket",
"bind -Tcopy-mode-vi MouseDown1Pane select-pane",
"bind -Tcopy-mode-vi MouseDrag1Pane select-pane\\; send -X begin-selection",
"bind -Tcopy-mode-vi MouseDragEnd1Pane send -X copy-selection-and-cancel",
"bind -Tcopy-mode-vi MouseDragEnd1Pane send -X copy-pipe-and-cancel",
"bind -Tcopy-mode-vi WheelUpPane select-pane\\; send -N5 -X scroll-up",
"bind -Tcopy-mode-vi WheelDownPane select-pane\\; send -N5 -X scroll-down",
"bind -Tcopy-mode-vi DoubleClick1Pane select-pane\\; send -X select-word\\; run -d0.3\\; send -X copy-selection-and-cancel",
"bind -Tcopy-mode-vi TripleClick1Pane select-pane\\; send -X select-line\\; run -d0.3\\; send -X copy-selection-and-cancel",
"bind -Tcopy-mode-vi DoubleClick1Pane select-pane\\; send -X select-word\\; run -d0.3\\; send -X copy-pipe-and-cancel",
"bind -Tcopy-mode-vi TripleClick1Pane select-pane\\; send -X select-line\\; run -d0.3\\; send -X copy-pipe-and-cancel",
"bind -Tcopy-mode-vi BSpace send -X cursor-left",
"bind -Tcopy-mode-vi NPage send -X page-down",
"bind -Tcopy-mode-vi PPage send -X page-up",

View File

@ -197,6 +197,12 @@ const struct options_table_entry options_table[] = {
.separator = ","
},
{ .name = "copy-command",
.type = OPTIONS_TABLE_STRING,
.scope = OPTIONS_TABLE_SERVER,
.default_str = ""
},
{ .name = "default-terminal",
.type = OPTIONS_TABLE_STRING,
.scope = OPTIONS_TABLE_SERVER,

10
tmux.1
View File

@ -1483,9 +1483,9 @@ The following commands are supported in copy mode:
.It Li "clear-selection" Ta "Escape" Ta "C-g"
.It Li "copy-end-of-line [<prefix>]" Ta "D" Ta "C-k"
.It Li "copy-line [<prefix>]" Ta "" Ta ""
.It Li "copy-pipe <command> [<prefix>]" Ta "" Ta ""
.It Li "copy-pipe-no-clear <command> [<prefix>]" Ta "" Ta ""
.It Li "copy-pipe-and-cancel <command> [<prefix>]" Ta "" Ta ""
.It Li "copy-pipe [<command>] [<prefix>]" Ta "" Ta ""
.It Li "copy-pipe-no-clear [<command>] [<prefix>]" Ta "" Ta ""
.It Li "copy-pipe-and-cancel [<command>] [<prefix>]" Ta "" Ta ""
.It Li "copy-selection [<prefix>]" Ta "" Ta ""
.It Li "copy-selection-no-clear [<prefix>]" Ta "" Ta ""
.It Li "copy-selection-and-cancel [<prefix>]" Ta "Enter" Ta "M-w"
@ -3090,6 +3090,10 @@ be set to
.Ql screen ,
.Ql tmux
or a derivative of them.
.It Ic copy-command Ar shell-command
Give the command to pipe to if the
.Ic copy-pipe
copy mode command is used without arguments.
.It Ic escape-time Ar time
Set the time in milliseconds for which
.Nm

View File

@ -1728,11 +1728,10 @@ window_copy_cmd_copy_pipe_no_clear(struct window_copy_cmd_state *cs)
if (cs->args->argc == 3)
prefix = format_single(NULL, cs->args->argv[2], c, s, wl, wp);
if (s != NULL && *cs->args->argv[1] != '\0') {
if (s != NULL && cs->args->argc > 1 && *cs->args->argv[1] != '\0')
command = format_single(NULL, cs->args->argv[1], c, s, wl, wp);
window_copy_copy_pipe(wme, s, prefix, command);
free(command);
}
window_copy_copy_pipe(wme, s, prefix, command);
free(command);
free(prefix);
return (WINDOW_COPY_CMD_NOTHING);
@ -2066,11 +2065,11 @@ static const struct {
window_copy_cmd_copy_end_of_line },
{ "copy-line", 0, 1, 0,
window_copy_cmd_copy_line },
{ "copy-pipe-no-clear", 1, 2, 0,
{ "copy-pipe-no-clear", 0, 2, 0,
window_copy_cmd_copy_pipe_no_clear },
{ "copy-pipe", 1, 2, 0,
{ "copy-pipe", 0, 2, 0,
window_copy_cmd_copy_pipe },
{ "copy-pipe-and-cancel", 1, 2, 0,
{ "copy-pipe-and-cancel", 0, 2, 0,
window_copy_cmd_copy_pipe_and_cancel },
{ "copy-selection-no-clear", 0, 1, 0,
window_copy_cmd_copy_selection_no_clear },
@ -3471,8 +3470,13 @@ window_copy_copy_pipe(struct window_mode_entry *wme, struct session *s,
if (buf == NULL)
return;
job = job_run(cmd, s, NULL, NULL, NULL, NULL, NULL, JOB_NOWAIT, -1, -1);
bufferevent_write(job_get_event(job), buf, len);
if (cmd == NULL || *cmd == '\0')
cmd = options_get_string(global_options, "copy-command");
if (cmd != NULL && *cmd != '\0') {
job = job_run(cmd, s, NULL, NULL, NULL, NULL, NULL, JOB_NOWAIT,
-1, -1);
bufferevent_write(job_get_event(job), buf, len);
}
window_copy_copy_buffer(wme, prefix, buf, len);
}