diff options
author | nicm <nicm> | 2016-10-11 07:23:34 +0000 |
---|---|---|
committer | nicm <nicm> | 2016-10-11 07:23:34 +0000 |
commit | 76d6d3641f271be1756e41494960d96714e7ee58 (patch) | |
tree | ff2b551953111d90ed5f32919fe2f3b329357bc1 /cmd-command-prompt.c | |
parent | 8b804fb5894b6717de36c5c9c96f7fd29b14a864 (diff) | |
download | rtmux-76d6d3641f271be1756e41494960d96714e7ee58.tar.gz rtmux-76d6d3641f271be1756e41494960d96714e7ee58.tar.bz2 rtmux-76d6d3641f271be1756e41494960d96714e7ee58.zip |
Fundamental change to how copy mode key bindings work:
The vi-copy and emacs-copy mode key tables are gone, and instead copy
mode commands are bound in one of two normal key tables ("copy-mode" or
"copy-mode-vi"). Keys are bound to "send-keys -X copy-mode-command". So:
bind -temacs-copy C-Up scroll-up
bind -temacs-copy -R5 WheelUpPane scroll-up
Becomes:
bind -Tcopy-mode C-Up send -X scroll-up
bind -Tcopy-mode WheelUpPane send -N5 -X scroll-up
This allows the full command parser and command set to be used - for
example, we can use the normal command prompt for searching, jumping,
and so on instead of a custom one:
bind -Tcopy-mode C-r command-prompt -p'search up' "send -X search-backward '%%'"
command-prompt also gets a -1 option to only require on key press, which
is needed for jumping.
The plan is to get rid of mode keys entirely, so more to come eventually.
Diffstat (limited to 'cmd-command-prompt.c')
-rw-r--r-- | cmd-command-prompt.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/cmd-command-prompt.c b/cmd-command-prompt.c index a2fc1278..09ab9813 100644 --- a/cmd-command-prompt.c +++ b/cmd-command-prompt.c @@ -38,8 +38,8 @@ const struct cmd_entry cmd_command_prompt_entry = { .name = "command-prompt", .alias = NULL, - .args = { "I:p:t:", 0, 1 }, - .usage = "[-I inputs] [-p prompts] " CMD_TARGET_CLIENT_USAGE " " + .args = { "1I:p:t:", 0, 1 }, + .usage = "[-1] [-I inputs] [-p prompts] " CMD_TARGET_CLIENT_USAGE " " "[template]", .tflag = CMD_CLIENT, @@ -67,6 +67,7 @@ cmd_command_prompt_exec(struct cmd *self, struct cmd_q *cmdq) struct client *c = cmdq->state.c; char *prompt, *ptr, *input = NULL; size_t n; + int flags; if (c->prompt_string != NULL) return (CMD_RETURN_NORMAL); @@ -108,8 +109,11 @@ cmd_command_prompt_exec(struct cmd *self, struct cmd_q *cmdq) input = strsep(&cdata->next_input, ","); } + flags = 0; + if (args_has(args, '1')) + flags |= PROMPT_SINGLE; status_prompt_set(c, prompt, input, cmd_command_prompt_callback, - cmd_command_prompt_free, cdata, 0); + cmd_command_prompt_free, cdata, flags); free(prompt); return (CMD_RETURN_NORMAL); |