mirror of
https://github.com/tmux/tmux.git
synced 2024-12-13 01:48:47 +00:00
Allow repeat count to be specified in mode key tables with bind-key -R,
and set the default repeat count to 5 for WheelUp and WheelDown in copy-mode.
This commit is contained in:
parent
fed1e384ad
commit
2e5584c2b4
@ -36,9 +36,9 @@ const struct cmd_entry cmd_bind_key_entry = {
|
|||||||
.name = "bind-key",
|
.name = "bind-key",
|
||||||
.alias = "bind",
|
.alias = "bind",
|
||||||
|
|
||||||
.args = { "cnrt:T:", 1, -1 },
|
.args = { "cnrR:t:T:", 1, -1 },
|
||||||
.usage = "[-cnr] [-t mode-table] [-T key-table] key command "
|
.usage = "[-cnr] [-t mode-table] [-R repeat-count] [-T key-table] key "
|
||||||
"[arguments]",
|
"command [arguments]",
|
||||||
|
|
||||||
.flags = 0,
|
.flags = 0,
|
||||||
.exec = cmd_bind_key_exec
|
.exec = cmd_bind_key_exec
|
||||||
@ -97,11 +97,12 @@ enum cmd_retval
|
|||||||
cmd_bind_key_mode_table(struct cmd *self, struct cmd_q *cmdq, key_code key)
|
cmd_bind_key_mode_table(struct cmd *self, struct cmd_q *cmdq, key_code key)
|
||||||
{
|
{
|
||||||
struct args *args = self->args;
|
struct args *args = self->args;
|
||||||
const char *tablename;
|
const char *tablename, *arg;
|
||||||
const struct mode_key_table *mtab;
|
const struct mode_key_table *mtab;
|
||||||
struct mode_key_binding *mbind, mtmp;
|
struct mode_key_binding *mbind, mtmp;
|
||||||
enum mode_key_cmd cmd;
|
enum mode_key_cmd cmd;
|
||||||
const char *arg;
|
char *cause;
|
||||||
|
u_int repeat;
|
||||||
|
|
||||||
tablename = args_get(args, 't');
|
tablename = args_get(args, 't');
|
||||||
if ((mtab = mode_key_findtable(tablename)) == NULL) {
|
if ((mtab = mode_key_findtable(tablename)) == NULL) {
|
||||||
@ -145,6 +146,16 @@ cmd_bind_key_mode_table(struct cmd *self, struct cmd_q *cmdq, key_code key)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
repeat = 1;
|
||||||
|
if (args_has(args, 'R')) {
|
||||||
|
repeat = args_strtonum(args, 'R', 1, SHRT_MAX, &cause);
|
||||||
|
if (cause != NULL) {
|
||||||
|
cmdq_error(cmdq, "repeat count %s", cause);
|
||||||
|
free(cause);
|
||||||
|
return (CMD_RETURN_ERROR);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
mtmp.key = key;
|
mtmp.key = key;
|
||||||
mtmp.mode = !!args_has(args, 'c');
|
mtmp.mode = !!args_has(args, 'c');
|
||||||
if ((mbind = RB_FIND(mode_key_tree, mtab->tree, &mtmp)) == NULL) {
|
if ((mbind = RB_FIND(mode_key_tree, mtab->tree, &mtmp)) == NULL) {
|
||||||
@ -153,6 +164,7 @@ cmd_bind_key_mode_table(struct cmd *self, struct cmd_q *cmdq, key_code key)
|
|||||||
mbind->mode = mtmp.mode;
|
mbind->mode = mtmp.mode;
|
||||||
RB_INSERT(mode_key_tree, mtab->tree, mbind);
|
RB_INSERT(mode_key_tree, mtab->tree, mbind);
|
||||||
}
|
}
|
||||||
|
mbind->repeat = repeat;
|
||||||
mbind->cmd = cmd;
|
mbind->cmd = cmd;
|
||||||
mbind->arg = arg != NULL ? xstrdup(arg) : NULL;
|
mbind->arg = arg != NULL ? xstrdup(arg) : NULL;
|
||||||
return (CMD_RETURN_NORMAL);
|
return (CMD_RETURN_NORMAL);
|
||||||
|
@ -135,11 +135,11 @@ static enum cmd_retval
|
|||||||
cmd_list_keys_table(struct cmd *self, struct cmd_q *cmdq)
|
cmd_list_keys_table(struct cmd *self, struct cmd_q *cmdq)
|
||||||
{
|
{
|
||||||
struct args *args = self->args;
|
struct args *args = self->args;
|
||||||
const char *tablename;
|
const char *tablename, *key, *cmdstr, *mode;
|
||||||
const struct mode_key_table *mtab;
|
const struct mode_key_table *mtab;
|
||||||
struct mode_key_binding *mbind;
|
struct mode_key_binding *mbind;
|
||||||
const char *key, *cmdstr, *mode;
|
char repeat[16];
|
||||||
int width, keywidth, any_mode;
|
int width, keywidth, repeatwidth, any_mode;
|
||||||
|
|
||||||
tablename = args_get(args, 't');
|
tablename = args_get(args, 't');
|
||||||
if ((mtab = mode_key_findtable(tablename)) == NULL) {
|
if ((mtab = mode_key_findtable(tablename)) == NULL) {
|
||||||
@ -147,7 +147,7 @@ cmd_list_keys_table(struct cmd *self, struct cmd_q *cmdq)
|
|||||||
return (CMD_RETURN_ERROR);
|
return (CMD_RETURN_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
width = 0;
|
keywidth = repeatwidth = 0;
|
||||||
any_mode = 0;
|
any_mode = 0;
|
||||||
RB_FOREACH(mbind, mode_key_tree, mtab->tree) {
|
RB_FOREACH(mbind, mode_key_tree, mtab->tree) {
|
||||||
key = key_string_lookup_key(mbind->key);
|
key = key_string_lookup_key(mbind->key);
|
||||||
@ -155,9 +155,16 @@ cmd_list_keys_table(struct cmd *self, struct cmd_q *cmdq)
|
|||||||
if (mbind->mode != 0)
|
if (mbind->mode != 0)
|
||||||
any_mode = 1;
|
any_mode = 1;
|
||||||
|
|
||||||
keywidth = strlen(key);
|
width = strlen(key);
|
||||||
if (keywidth > width)
|
if (width > keywidth)
|
||||||
width = keywidth;
|
keywidth = width;
|
||||||
|
|
||||||
|
if (mbind->repeat != 1) {
|
||||||
|
snprintf(repeat, sizeof repeat, "%u", mbind->repeat);
|
||||||
|
width = strlen(repeat);
|
||||||
|
if (width > repeatwidth)
|
||||||
|
repeatwidth = width;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
RB_FOREACH(mbind, mode_key_tree, mtab->tree) {
|
RB_FOREACH(mbind, mode_key_tree, mtab->tree) {
|
||||||
@ -166,11 +173,17 @@ cmd_list_keys_table(struct cmd *self, struct cmd_q *cmdq)
|
|||||||
mode = "";
|
mode = "";
|
||||||
if (mbind->mode != 0)
|
if (mbind->mode != 0)
|
||||||
mode = "c";
|
mode = "c";
|
||||||
|
snprintf(repeat, sizeof repeat, "%u", mbind->repeat);
|
||||||
cmdstr = mode_key_tostring(mtab->cmdstr, mbind->cmd);
|
cmdstr = mode_key_tostring(mtab->cmdstr, mbind->cmd);
|
||||||
if (cmdstr != NULL) {
|
if (cmdstr != NULL) {
|
||||||
cmdq_print(cmdq, "bind-key -%st %s%s %*s %s%s%s%s",
|
cmdq_print(cmdq,
|
||||||
|
"bind-key -%st %s%s%s%*s %*s %s%s%s%s",
|
||||||
mode, any_mode && *mode == '\0' ? " " : "",
|
mode, any_mode && *mode == '\0' ? " " : "",
|
||||||
mtab->name, (int) width, key, cmdstr,
|
mtab->name,
|
||||||
|
mbind->repeat != 1 ? " -R " :
|
||||||
|
(repeatwidth == 0 ? "" : " "),
|
||||||
|
repeatwidth, mbind->repeat != 1 ? repeat : "",
|
||||||
|
(int)keywidth, key, cmdstr,
|
||||||
mbind->arg != NULL ? " \"" : "",
|
mbind->arg != NULL ? " \"" : "",
|
||||||
mbind->arg != NULL ? mbind->arg : "",
|
mbind->arg != NULL ? mbind->arg : "",
|
||||||
mbind->arg != NULL ? "\"": "");
|
mbind->arg != NULL ? "\"": "");
|
||||||
|
613
mode-key.c
613
mode-key.c
@ -50,6 +50,7 @@ struct mode_key_entry {
|
|||||||
*/
|
*/
|
||||||
int mode;
|
int mode;
|
||||||
enum mode_key_cmd cmd;
|
enum mode_key_cmd cmd;
|
||||||
|
u_int repeat;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Edit keys command strings. */
|
/* Edit keys command strings. */
|
||||||
@ -170,341 +171,341 @@ const struct mode_key_cmdstr mode_key_cmdstr_copy[] = {
|
|||||||
|
|
||||||
/* vi editing keys. */
|
/* vi editing keys. */
|
||||||
const struct mode_key_entry mode_key_vi_edit[] = {
|
const struct mode_key_entry mode_key_vi_edit[] = {
|
||||||
{ '\003' /* C-c */, 0, MODEKEYEDIT_CANCEL },
|
{ '\003' /* C-c */, 0, MODEKEYEDIT_CANCEL, 1 },
|
||||||
{ '\010' /* C-h */, 0, MODEKEYEDIT_BACKSPACE },
|
{ '\010' /* C-h */, 0, MODEKEYEDIT_BACKSPACE, 1 },
|
||||||
{ '\011' /* Tab */, 0, MODEKEYEDIT_COMPLETE },
|
{ '\011' /* Tab */, 0, MODEKEYEDIT_COMPLETE, 1 },
|
||||||
{ '\025' /* C-u */, 0, MODEKEYEDIT_DELETELINE },
|
{ '\025' /* C-u */, 0, MODEKEYEDIT_DELETELINE, 1 },
|
||||||
{ '\027' /* C-w */, 0, MODEKEYEDIT_DELETEWORD },
|
{ '\027' /* C-w */, 0, MODEKEYEDIT_DELETEWORD, 1 },
|
||||||
{ '\033' /* Escape */, 0, MODEKEYEDIT_SWITCHMODE },
|
{ '\033' /* Escape */, 0, MODEKEYEDIT_SWITCHMODE, 1 },
|
||||||
{ '\n', 0, MODEKEYEDIT_ENTER },
|
{ '\n', 0, MODEKEYEDIT_ENTER, 1 },
|
||||||
{ '\r', 0, MODEKEYEDIT_ENTER },
|
{ '\r', 0, MODEKEYEDIT_ENTER, 1 },
|
||||||
{ KEYC_BSPACE, 0, MODEKEYEDIT_BACKSPACE },
|
{ KEYC_BSPACE, 0, MODEKEYEDIT_BACKSPACE, 1 },
|
||||||
{ KEYC_DC, 0, MODEKEYEDIT_DELETE },
|
{ KEYC_DC, 0, MODEKEYEDIT_DELETE, 1 },
|
||||||
{ KEYC_DOWN, 0, MODEKEYEDIT_HISTORYDOWN },
|
{ KEYC_DOWN, 0, MODEKEYEDIT_HISTORYDOWN, 1 },
|
||||||
{ KEYC_LEFT, 0, MODEKEYEDIT_CURSORLEFT },
|
{ KEYC_LEFT, 0, MODEKEYEDIT_CURSORLEFT, 1 },
|
||||||
{ KEYC_RIGHT, 0, MODEKEYEDIT_CURSORRIGHT },
|
{ KEYC_RIGHT, 0, MODEKEYEDIT_CURSORRIGHT, 1 },
|
||||||
{ KEYC_UP, 0, MODEKEYEDIT_HISTORYUP },
|
{ KEYC_UP, 0, MODEKEYEDIT_HISTORYUP, 1 },
|
||||||
{ KEYC_HOME, 0, MODEKEYEDIT_STARTOFLINE },
|
{ KEYC_HOME, 0, MODEKEYEDIT_STARTOFLINE, 1 },
|
||||||
{ KEYC_END, 0, MODEKEYEDIT_ENDOFLINE },
|
{ KEYC_END, 0, MODEKEYEDIT_ENDOFLINE, 1 },
|
||||||
|
|
||||||
{ '$', 1, MODEKEYEDIT_ENDOFLINE },
|
{ '$', 1, MODEKEYEDIT_ENDOFLINE, 1 },
|
||||||
{ '0', 1, MODEKEYEDIT_STARTOFLINE },
|
{ '0', 1, MODEKEYEDIT_STARTOFLINE, 1 },
|
||||||
{ 'A', 1, MODEKEYEDIT_SWITCHMODEAPPENDLINE },
|
{ 'A', 1, MODEKEYEDIT_SWITCHMODEAPPENDLINE, 1 },
|
||||||
{ 'B', 1, MODEKEYEDIT_PREVIOUSSPACE },
|
{ 'B', 1, MODEKEYEDIT_PREVIOUSSPACE, 1 },
|
||||||
{ 'C', 1, MODEKEYEDIT_SWITCHMODECHANGELINE },
|
{ 'C', 1, MODEKEYEDIT_SWITCHMODECHANGELINE, 1 },
|
||||||
{ 'D', 1, MODEKEYEDIT_DELETETOENDOFLINE },
|
{ 'D', 1, MODEKEYEDIT_DELETETOENDOFLINE, 1 },
|
||||||
{ 'E', 1, MODEKEYEDIT_NEXTSPACEEND },
|
{ 'E', 1, MODEKEYEDIT_NEXTSPACEEND, 1 },
|
||||||
{ 'I', 1, MODEKEYEDIT_SWITCHMODEBEGINLINE },
|
{ 'I', 1, MODEKEYEDIT_SWITCHMODEBEGINLINE, 1 },
|
||||||
{ 'S', 1, MODEKEYEDIT_SWITCHMODESUBSTITUTELINE },
|
{ 'S', 1, MODEKEYEDIT_SWITCHMODESUBSTITUTELINE, 1 },
|
||||||
{ 'W', 1, MODEKEYEDIT_NEXTSPACE },
|
{ 'W', 1, MODEKEYEDIT_NEXTSPACE, 1 },
|
||||||
{ 'X', 1, MODEKEYEDIT_BACKSPACE },
|
{ 'X', 1, MODEKEYEDIT_BACKSPACE, 1 },
|
||||||
{ '\003' /* C-c */, 1, MODEKEYEDIT_CANCEL },
|
{ '\003' /* C-c */, 1, MODEKEYEDIT_CANCEL, 1 },
|
||||||
{ '\010' /* C-h */, 1, MODEKEYEDIT_BACKSPACE },
|
{ '\010' /* C-h */, 1, MODEKEYEDIT_BACKSPACE, 1 },
|
||||||
{ '\n', 1, MODEKEYEDIT_ENTER },
|
{ '\n', 1, MODEKEYEDIT_ENTER, 1 },
|
||||||
{ '\r', 1, MODEKEYEDIT_ENTER },
|
{ '\r', 1, MODEKEYEDIT_ENTER, 1 },
|
||||||
{ '^', 1, MODEKEYEDIT_STARTOFLINE },
|
{ '^', 1, MODEKEYEDIT_STARTOFLINE, 1 },
|
||||||
{ 'a', 1, MODEKEYEDIT_SWITCHMODEAPPEND },
|
{ 'a', 1, MODEKEYEDIT_SWITCHMODEAPPEND, 1 },
|
||||||
{ 'b', 1, MODEKEYEDIT_PREVIOUSWORD },
|
{ 'b', 1, MODEKEYEDIT_PREVIOUSWORD, 1 },
|
||||||
{ 'd', 1, MODEKEYEDIT_DELETELINE },
|
{ 'd', 1, MODEKEYEDIT_DELETELINE, 1 },
|
||||||
{ 'e', 1, MODEKEYEDIT_NEXTWORDEND },
|
{ 'e', 1, MODEKEYEDIT_NEXTWORDEND, 1 },
|
||||||
{ 'h', 1, MODEKEYEDIT_CURSORLEFT },
|
{ 'h', 1, MODEKEYEDIT_CURSORLEFT, 1 },
|
||||||
{ 'i', 1, MODEKEYEDIT_SWITCHMODE },
|
{ 'i', 1, MODEKEYEDIT_SWITCHMODE, 1 },
|
||||||
{ 'j', 1, MODEKEYEDIT_HISTORYDOWN },
|
{ 'j', 1, MODEKEYEDIT_HISTORYDOWN, 1 },
|
||||||
{ 'k', 1, MODEKEYEDIT_HISTORYUP },
|
{ 'k', 1, MODEKEYEDIT_HISTORYUP, 1 },
|
||||||
{ 'l', 1, MODEKEYEDIT_CURSORRIGHT },
|
{ 'l', 1, MODEKEYEDIT_CURSORRIGHT, 1 },
|
||||||
{ 'p', 1, MODEKEYEDIT_PASTE },
|
{ 'p', 1, MODEKEYEDIT_PASTE, 1 },
|
||||||
{ 's', 1, MODEKEYEDIT_SWITCHMODESUBSTITUTE },
|
{ 's', 1, MODEKEYEDIT_SWITCHMODESUBSTITUTE, 1 },
|
||||||
{ 'w', 1, MODEKEYEDIT_NEXTWORD },
|
{ 'w', 1, MODEKEYEDIT_NEXTWORD, 1 },
|
||||||
{ 'x', 1, MODEKEYEDIT_DELETE },
|
{ 'x', 1, MODEKEYEDIT_DELETE, 1 },
|
||||||
{ KEYC_BSPACE, 1, MODEKEYEDIT_BACKSPACE },
|
{ KEYC_BSPACE, 1, MODEKEYEDIT_BACKSPACE, 1 },
|
||||||
{ KEYC_DC, 1, MODEKEYEDIT_DELETE },
|
{ KEYC_DC, 1, MODEKEYEDIT_DELETE, 1 },
|
||||||
{ KEYC_DOWN, 1, MODEKEYEDIT_HISTORYDOWN },
|
{ KEYC_DOWN, 1, MODEKEYEDIT_HISTORYDOWN, 1 },
|
||||||
{ KEYC_LEFT, 1, MODEKEYEDIT_CURSORLEFT },
|
{ KEYC_LEFT, 1, MODEKEYEDIT_CURSORLEFT, 1 },
|
||||||
{ KEYC_RIGHT, 1, MODEKEYEDIT_CURSORRIGHT },
|
{ KEYC_RIGHT, 1, MODEKEYEDIT_CURSORRIGHT, 1 },
|
||||||
{ KEYC_UP, 1, MODEKEYEDIT_HISTORYUP },
|
{ KEYC_UP, 1, MODEKEYEDIT_HISTORYUP, 1 },
|
||||||
|
|
||||||
{ 0, -1, 0 }
|
{ 0, -1, 0, 1 }
|
||||||
};
|
};
|
||||||
struct mode_key_tree mode_key_tree_vi_edit;
|
struct mode_key_tree mode_key_tree_vi_edit;
|
||||||
|
|
||||||
/* vi choice selection keys. */
|
/* vi choice selection keys. */
|
||||||
const struct mode_key_entry mode_key_vi_choice[] = {
|
const struct mode_key_entry mode_key_vi_choice[] = {
|
||||||
{ '0' | KEYC_ESCAPE, 0, MODEKEYCHOICE_STARTNUMBERPREFIX },
|
{ '0' | KEYC_ESCAPE, 0, MODEKEYCHOICE_STARTNUMBERPREFIX, 1 },
|
||||||
{ '1' | KEYC_ESCAPE, 0, MODEKEYCHOICE_STARTNUMBERPREFIX },
|
{ '1' | KEYC_ESCAPE, 0, MODEKEYCHOICE_STARTNUMBERPREFIX, 1 },
|
||||||
{ '2' | KEYC_ESCAPE, 0, MODEKEYCHOICE_STARTNUMBERPREFIX },
|
{ '2' | KEYC_ESCAPE, 0, MODEKEYCHOICE_STARTNUMBERPREFIX, 1 },
|
||||||
{ '3' | KEYC_ESCAPE, 0, MODEKEYCHOICE_STARTNUMBERPREFIX },
|
{ '3' | KEYC_ESCAPE, 0, MODEKEYCHOICE_STARTNUMBERPREFIX, 1 },
|
||||||
{ '4' | KEYC_ESCAPE, 0, MODEKEYCHOICE_STARTNUMBERPREFIX },
|
{ '4' | KEYC_ESCAPE, 0, MODEKEYCHOICE_STARTNUMBERPREFIX, 1 },
|
||||||
{ '5' | KEYC_ESCAPE, 0, MODEKEYCHOICE_STARTNUMBERPREFIX },
|
{ '5' | KEYC_ESCAPE, 0, MODEKEYCHOICE_STARTNUMBERPREFIX, 1 },
|
||||||
{ '6' | KEYC_ESCAPE, 0, MODEKEYCHOICE_STARTNUMBERPREFIX },
|
{ '6' | KEYC_ESCAPE, 0, MODEKEYCHOICE_STARTNUMBERPREFIX, 1 },
|
||||||
{ '7' | KEYC_ESCAPE, 0, MODEKEYCHOICE_STARTNUMBERPREFIX },
|
{ '7' | KEYC_ESCAPE, 0, MODEKEYCHOICE_STARTNUMBERPREFIX, 1 },
|
||||||
{ '8' | KEYC_ESCAPE, 0, MODEKEYCHOICE_STARTNUMBERPREFIX },
|
{ '8' | KEYC_ESCAPE, 0, MODEKEYCHOICE_STARTNUMBERPREFIX, 1 },
|
||||||
{ '9' | KEYC_ESCAPE, 0, MODEKEYCHOICE_STARTNUMBERPREFIX },
|
{ '9' | KEYC_ESCAPE, 0, MODEKEYCHOICE_STARTNUMBERPREFIX, 1 },
|
||||||
{ '\002' /* C-b */, 0, MODEKEYCHOICE_PAGEUP },
|
{ '\002' /* C-b */, 0, MODEKEYCHOICE_PAGEUP, 1 },
|
||||||
{ '\003' /* C-c */, 0, MODEKEYCHOICE_CANCEL },
|
{ '\003' /* C-c */, 0, MODEKEYCHOICE_CANCEL, 1 },
|
||||||
{ '\005' /* C-e */, 0, MODEKEYCHOICE_SCROLLDOWN },
|
{ '\005' /* C-e */, 0, MODEKEYCHOICE_SCROLLDOWN, 1 },
|
||||||
{ '\006' /* C-f */, 0, MODEKEYCHOICE_PAGEDOWN },
|
{ '\006' /* C-f */, 0, MODEKEYCHOICE_PAGEDOWN, 1 },
|
||||||
{ '\031' /* C-y */, 0, MODEKEYCHOICE_SCROLLUP },
|
{ '\031' /* C-y */, 0, MODEKEYCHOICE_SCROLLUP, 1 },
|
||||||
{ '\n', 0, MODEKEYCHOICE_CHOOSE },
|
{ '\n', 0, MODEKEYCHOICE_CHOOSE, 1 },
|
||||||
{ '\r', 0, MODEKEYCHOICE_CHOOSE },
|
{ '\r', 0, MODEKEYCHOICE_CHOOSE, 1 },
|
||||||
{ 'j', 0, MODEKEYCHOICE_DOWN },
|
{ 'j', 0, MODEKEYCHOICE_DOWN, 1 },
|
||||||
{ 'k', 0, MODEKEYCHOICE_UP },
|
{ 'k', 0, MODEKEYCHOICE_UP, 1 },
|
||||||
{ 'q', 0, MODEKEYCHOICE_CANCEL },
|
{ 'q', 0, MODEKEYCHOICE_CANCEL, 1 },
|
||||||
{ KEYC_HOME, 0, MODEKEYCHOICE_STARTOFLIST },
|
{ KEYC_HOME, 0, MODEKEYCHOICE_STARTOFLIST, 1 },
|
||||||
{ 'g', 0, MODEKEYCHOICE_STARTOFLIST },
|
{ 'g', 0, MODEKEYCHOICE_STARTOFLIST, 1 },
|
||||||
{ 'H', 0, MODEKEYCHOICE_TOPLINE },
|
{ 'H', 0, MODEKEYCHOICE_TOPLINE, 1 },
|
||||||
{ 'L', 0, MODEKEYCHOICE_BOTTOMLINE },
|
{ 'L', 0, MODEKEYCHOICE_BOTTOMLINE, 1 },
|
||||||
{ 'G', 0, MODEKEYCHOICE_ENDOFLIST },
|
{ 'G', 0, MODEKEYCHOICE_ENDOFLIST, 1 },
|
||||||
{ KEYC_END, 0, MODEKEYCHOICE_ENDOFLIST },
|
{ KEYC_END, 0, MODEKEYCHOICE_ENDOFLIST, 1 },
|
||||||
{ KEYC_BSPACE, 0, MODEKEYCHOICE_BACKSPACE },
|
{ KEYC_BSPACE, 0, MODEKEYCHOICE_BACKSPACE, 1 },
|
||||||
{ KEYC_DOWN | KEYC_CTRL, 0, MODEKEYCHOICE_SCROLLDOWN },
|
{ KEYC_DOWN | KEYC_CTRL, 0, MODEKEYCHOICE_SCROLLDOWN, 1 },
|
||||||
{ KEYC_DOWN, 0, MODEKEYCHOICE_DOWN },
|
{ KEYC_DOWN, 0, MODEKEYCHOICE_DOWN, 1 },
|
||||||
{ KEYC_NPAGE, 0, MODEKEYCHOICE_PAGEDOWN },
|
{ KEYC_NPAGE, 0, MODEKEYCHOICE_PAGEDOWN, 1 },
|
||||||
{ KEYC_PPAGE, 0, MODEKEYCHOICE_PAGEUP },
|
{ KEYC_PPAGE, 0, MODEKEYCHOICE_PAGEUP, 1 },
|
||||||
{ KEYC_UP | KEYC_CTRL, 0, MODEKEYCHOICE_SCROLLUP },
|
{ KEYC_UP | KEYC_CTRL, 0, MODEKEYCHOICE_SCROLLUP, 1 },
|
||||||
{ KEYC_UP, 0, MODEKEYCHOICE_UP },
|
{ KEYC_UP, 0, MODEKEYCHOICE_UP, 1 },
|
||||||
{ ' ', 0, MODEKEYCHOICE_TREE_TOGGLE },
|
{ ' ', 0, MODEKEYCHOICE_TREE_TOGGLE, 1 },
|
||||||
{ KEYC_LEFT, 0, MODEKEYCHOICE_TREE_COLLAPSE },
|
{ KEYC_LEFT, 0, MODEKEYCHOICE_TREE_COLLAPSE, 1 },
|
||||||
{ KEYC_RIGHT, 0, MODEKEYCHOICE_TREE_EXPAND },
|
{ KEYC_RIGHT, 0, MODEKEYCHOICE_TREE_EXPAND, 1 },
|
||||||
{ KEYC_LEFT | KEYC_CTRL, 0, MODEKEYCHOICE_TREE_COLLAPSE_ALL },
|
{ KEYC_LEFT | KEYC_CTRL, 0, MODEKEYCHOICE_TREE_COLLAPSE_ALL, 1 },
|
||||||
{ KEYC_RIGHT | KEYC_CTRL, 0, MODEKEYCHOICE_TREE_EXPAND_ALL },
|
{ KEYC_RIGHT | KEYC_CTRL, 0, MODEKEYCHOICE_TREE_EXPAND_ALL, 1 },
|
||||||
{ KEYC_MOUSEDOWN1_PANE, 0, MODEKEYCHOICE_CHOOSE },
|
{ KEYC_MOUSEDOWN1_PANE, 0, MODEKEYCHOICE_CHOOSE, 1 },
|
||||||
{ KEYC_MOUSEDOWN3_PANE, 0, MODEKEYCHOICE_TREE_TOGGLE },
|
{ KEYC_MOUSEDOWN3_PANE, 0, MODEKEYCHOICE_TREE_TOGGLE, 1 },
|
||||||
{ KEYC_WHEELUP_PANE, 0, MODEKEYCHOICE_UP },
|
{ KEYC_WHEELUP_PANE, 0, MODEKEYCHOICE_UP, 1 },
|
||||||
{ KEYC_WHEELDOWN_PANE, 0, MODEKEYCHOICE_DOWN },
|
{ KEYC_WHEELDOWN_PANE, 0, MODEKEYCHOICE_DOWN, 1 },
|
||||||
|
|
||||||
{ 0, -1, 0 }
|
{ 0, -1, 0, 1 }
|
||||||
};
|
};
|
||||||
struct mode_key_tree mode_key_tree_vi_choice;
|
struct mode_key_tree mode_key_tree_vi_choice;
|
||||||
|
|
||||||
/* vi copy mode keys. */
|
/* vi copy mode keys. */
|
||||||
const struct mode_key_entry mode_key_vi_copy[] = {
|
const struct mode_key_entry mode_key_vi_copy[] = {
|
||||||
{ ' ', 0, MODEKEYCOPY_STARTSELECTION },
|
{ ' ', 0, MODEKEYCOPY_STARTSELECTION, 1 },
|
||||||
{ '"', 0, MODEKEYCOPY_STARTNAMEDBUFFER },
|
{ '"', 0, MODEKEYCOPY_STARTNAMEDBUFFER, 1 },
|
||||||
{ '$', 0, MODEKEYCOPY_ENDOFLINE },
|
{ '$', 0, MODEKEYCOPY_ENDOFLINE, 1 },
|
||||||
{ ',', 0, MODEKEYCOPY_JUMPREVERSE },
|
{ ',', 0, MODEKEYCOPY_JUMPREVERSE, 1 },
|
||||||
{ ';', 0, MODEKEYCOPY_JUMPAGAIN },
|
{ ';', 0, MODEKEYCOPY_JUMPAGAIN, 1 },
|
||||||
{ '/', 0, MODEKEYCOPY_SEARCHDOWN },
|
{ '/', 0, MODEKEYCOPY_SEARCHDOWN, 1 },
|
||||||
{ '0', 0, MODEKEYCOPY_STARTOFLINE },
|
{ '0', 0, MODEKEYCOPY_STARTOFLINE, 1 },
|
||||||
{ '1', 0, MODEKEYCOPY_STARTNUMBERPREFIX },
|
{ '1', 0, MODEKEYCOPY_STARTNUMBERPREFIX, 1 },
|
||||||
{ '2', 0, MODEKEYCOPY_STARTNUMBERPREFIX },
|
{ '2', 0, MODEKEYCOPY_STARTNUMBERPREFIX, 1 },
|
||||||
{ '3', 0, MODEKEYCOPY_STARTNUMBERPREFIX },
|
{ '3', 0, MODEKEYCOPY_STARTNUMBERPREFIX, 1 },
|
||||||
{ '4', 0, MODEKEYCOPY_STARTNUMBERPREFIX },
|
{ '4', 0, MODEKEYCOPY_STARTNUMBERPREFIX, 1 },
|
||||||
{ '5', 0, MODEKEYCOPY_STARTNUMBERPREFIX },
|
{ '5', 0, MODEKEYCOPY_STARTNUMBERPREFIX, 1 },
|
||||||
{ '6', 0, MODEKEYCOPY_STARTNUMBERPREFIX },
|
{ '6', 0, MODEKEYCOPY_STARTNUMBERPREFIX, 1 },
|
||||||
{ '7', 0, MODEKEYCOPY_STARTNUMBERPREFIX },
|
{ '7', 0, MODEKEYCOPY_STARTNUMBERPREFIX, 1 },
|
||||||
{ '8', 0, MODEKEYCOPY_STARTNUMBERPREFIX },
|
{ '8', 0, MODEKEYCOPY_STARTNUMBERPREFIX, 1 },
|
||||||
{ '9', 0, MODEKEYCOPY_STARTNUMBERPREFIX },
|
{ '9', 0, MODEKEYCOPY_STARTNUMBERPREFIX, 1 },
|
||||||
{ ':', 0, MODEKEYCOPY_GOTOLINE },
|
{ ':', 0, MODEKEYCOPY_GOTOLINE, 1 },
|
||||||
{ '?', 0, MODEKEYCOPY_SEARCHUP },
|
{ '?', 0, MODEKEYCOPY_SEARCHUP, 1 },
|
||||||
{ 'A', 0, MODEKEYCOPY_APPENDSELECTION },
|
{ 'A', 0, MODEKEYCOPY_APPENDSELECTION, 1 },
|
||||||
{ 'B', 0, MODEKEYCOPY_PREVIOUSSPACE },
|
{ 'B', 0, MODEKEYCOPY_PREVIOUSSPACE, 1 },
|
||||||
{ 'D', 0, MODEKEYCOPY_COPYENDOFLINE },
|
{ 'D', 0, MODEKEYCOPY_COPYENDOFLINE, 1 },
|
||||||
{ 'E', 0, MODEKEYCOPY_NEXTSPACEEND },
|
{ 'E', 0, MODEKEYCOPY_NEXTSPACEEND, 1 },
|
||||||
{ 'F', 0, MODEKEYCOPY_JUMPBACK },
|
{ 'F', 0, MODEKEYCOPY_JUMPBACK, 1 },
|
||||||
{ 'G', 0, MODEKEYCOPY_HISTORYBOTTOM },
|
{ 'G', 0, MODEKEYCOPY_HISTORYBOTTOM, 1 },
|
||||||
{ 'H', 0, MODEKEYCOPY_TOPLINE },
|
{ 'H', 0, MODEKEYCOPY_TOPLINE, 1 },
|
||||||
{ 'J', 0, MODEKEYCOPY_SCROLLDOWN },
|
{ 'J', 0, MODEKEYCOPY_SCROLLDOWN, 1 },
|
||||||
{ 'K', 0, MODEKEYCOPY_SCROLLUP },
|
{ 'K', 0, MODEKEYCOPY_SCROLLUP, 1 },
|
||||||
{ 'L', 0, MODEKEYCOPY_BOTTOMLINE },
|
{ 'L', 0, MODEKEYCOPY_BOTTOMLINE, 1 },
|
||||||
{ 'M', 0, MODEKEYCOPY_MIDDLELINE },
|
{ 'M', 0, MODEKEYCOPY_MIDDLELINE, 1 },
|
||||||
{ 'N', 0, MODEKEYCOPY_SEARCHREVERSE },
|
{ 'N', 0, MODEKEYCOPY_SEARCHREVERSE, 1 },
|
||||||
{ 'T', 0, MODEKEYCOPY_JUMPTOBACK },
|
{ 'T', 0, MODEKEYCOPY_JUMPTOBACK, 1 },
|
||||||
{ 'V', 0, MODEKEYCOPY_SELECTLINE },
|
{ 'V', 0, MODEKEYCOPY_SELECTLINE, 1 },
|
||||||
{ 'W', 0, MODEKEYCOPY_NEXTSPACE },
|
{ 'W', 0, MODEKEYCOPY_NEXTSPACE, 1 },
|
||||||
{ '\002' /* C-b */, 0, MODEKEYCOPY_PREVIOUSPAGE },
|
{ '\002' /* C-b */, 0, MODEKEYCOPY_PREVIOUSPAGE, 1 },
|
||||||
{ '\003' /* C-c */, 0, MODEKEYCOPY_CANCEL },
|
{ '\003' /* C-c */, 0, MODEKEYCOPY_CANCEL, 1 },
|
||||||
{ '\004' /* C-d */, 0, MODEKEYCOPY_HALFPAGEDOWN },
|
{ '\004' /* C-d */, 0, MODEKEYCOPY_HALFPAGEDOWN, 1 },
|
||||||
{ '\005' /* C-e */, 0, MODEKEYCOPY_SCROLLDOWN },
|
{ '\005' /* C-e */, 0, MODEKEYCOPY_SCROLLDOWN, 1 },
|
||||||
{ '\006' /* C-f */, 0, MODEKEYCOPY_NEXTPAGE },
|
{ '\006' /* C-f */, 0, MODEKEYCOPY_NEXTPAGE, 1 },
|
||||||
{ '\010' /* C-h */, 0, MODEKEYCOPY_LEFT },
|
{ '\010' /* C-h */, 0, MODEKEYCOPY_LEFT, 1 },
|
||||||
{ '\025' /* C-u */, 0, MODEKEYCOPY_HALFPAGEUP },
|
{ '\025' /* C-u */, 0, MODEKEYCOPY_HALFPAGEUP, 1 },
|
||||||
{ '\031' /* C-y */, 0, MODEKEYCOPY_SCROLLUP },
|
{ '\031' /* C-y */, 0, MODEKEYCOPY_SCROLLUP, 1 },
|
||||||
{ '\033' /* Escape */, 0, MODEKEYCOPY_CLEARSELECTION },
|
{ '\033' /* Escape */, 0, MODEKEYCOPY_CLEARSELECTION, 1 },
|
||||||
{ '\n', 0, MODEKEYCOPY_COPYSELECTION },
|
{ '\n', 0, MODEKEYCOPY_COPYSELECTION, 1 },
|
||||||
{ '\r', 0, MODEKEYCOPY_COPYSELECTION },
|
{ '\r', 0, MODEKEYCOPY_COPYSELECTION, 1 },
|
||||||
{ '^', 0, MODEKEYCOPY_BACKTOINDENTATION },
|
{ '^', 0, MODEKEYCOPY_BACKTOINDENTATION, 1 },
|
||||||
{ 'b', 0, MODEKEYCOPY_PREVIOUSWORD },
|
{ 'b', 0, MODEKEYCOPY_PREVIOUSWORD, 1 },
|
||||||
{ 'e', 0, MODEKEYCOPY_NEXTWORDEND },
|
{ 'e', 0, MODEKEYCOPY_NEXTWORDEND, 1 },
|
||||||
{ 'f', 0, MODEKEYCOPY_JUMP },
|
{ 'f', 0, MODEKEYCOPY_JUMP, 1 },
|
||||||
{ 'g', 0, MODEKEYCOPY_HISTORYTOP },
|
{ 'g', 0, MODEKEYCOPY_HISTORYTOP, 1 },
|
||||||
{ 'h', 0, MODEKEYCOPY_LEFT },
|
{ 'h', 0, MODEKEYCOPY_LEFT, 1 },
|
||||||
{ 'j', 0, MODEKEYCOPY_DOWN },
|
{ 'j', 0, MODEKEYCOPY_DOWN, 1 },
|
||||||
{ 'k', 0, MODEKEYCOPY_UP },
|
{ 'k', 0, MODEKEYCOPY_UP, 1 },
|
||||||
{ 'l', 0, MODEKEYCOPY_RIGHT },
|
{ 'l', 0, MODEKEYCOPY_RIGHT, 1 },
|
||||||
{ 'n', 0, MODEKEYCOPY_SEARCHAGAIN },
|
{ 'n', 0, MODEKEYCOPY_SEARCHAGAIN, 1 },
|
||||||
{ 'o', 0, MODEKEYCOPY_OTHEREND },
|
{ 'o', 0, MODEKEYCOPY_OTHEREND, 1 },
|
||||||
{ 't', 0, MODEKEYCOPY_JUMPTO },
|
{ 't', 0, MODEKEYCOPY_JUMPTO, 1 },
|
||||||
{ 'q', 0, MODEKEYCOPY_CANCEL },
|
{ 'q', 0, MODEKEYCOPY_CANCEL, 1 },
|
||||||
{ 'v', 0, MODEKEYCOPY_RECTANGLETOGGLE },
|
{ 'v', 0, MODEKEYCOPY_RECTANGLETOGGLE, 1 },
|
||||||
{ 'w', 0, MODEKEYCOPY_NEXTWORD },
|
{ 'w', 0, MODEKEYCOPY_NEXTWORD, 1 },
|
||||||
{ '{', 0, MODEKEYCOPY_PREVIOUSPARAGRAPH },
|
{ '{', 0, MODEKEYCOPY_PREVIOUSPARAGRAPH, 1 },
|
||||||
{ '}', 0, MODEKEYCOPY_NEXTPARAGRAPH },
|
{ '}', 0, MODEKEYCOPY_NEXTPARAGRAPH, 1 },
|
||||||
{ KEYC_BSPACE, 0, MODEKEYCOPY_LEFT },
|
{ KEYC_BSPACE, 0, MODEKEYCOPY_LEFT, 1 },
|
||||||
{ KEYC_DOWN | KEYC_CTRL, 0, MODEKEYCOPY_SCROLLDOWN },
|
{ KEYC_DOWN | KEYC_CTRL, 0, MODEKEYCOPY_SCROLLDOWN, 1 },
|
||||||
{ KEYC_DOWN, 0, MODEKEYCOPY_DOWN },
|
{ KEYC_DOWN, 0, MODEKEYCOPY_DOWN, 1 },
|
||||||
{ KEYC_LEFT, 0, MODEKEYCOPY_LEFT },
|
{ KEYC_LEFT, 0, MODEKEYCOPY_LEFT, 1 },
|
||||||
{ KEYC_NPAGE, 0, MODEKEYCOPY_NEXTPAGE },
|
{ KEYC_NPAGE, 0, MODEKEYCOPY_NEXTPAGE, 1 },
|
||||||
{ KEYC_PPAGE, 0, MODEKEYCOPY_PREVIOUSPAGE },
|
{ KEYC_PPAGE, 0, MODEKEYCOPY_PREVIOUSPAGE, 1 },
|
||||||
{ KEYC_RIGHT, 0, MODEKEYCOPY_RIGHT },
|
{ KEYC_RIGHT, 0, MODEKEYCOPY_RIGHT, 1 },
|
||||||
{ KEYC_UP | KEYC_CTRL, 0, MODEKEYCOPY_SCROLLUP },
|
{ KEYC_UP | KEYC_CTRL, 0, MODEKEYCOPY_SCROLLUP, 1 },
|
||||||
{ KEYC_UP, 0, MODEKEYCOPY_UP },
|
{ KEYC_UP, 0, MODEKEYCOPY_UP, 1 },
|
||||||
{ KEYC_WHEELUP_PANE, 0, MODEKEYCOPY_SCROLLUP },
|
{ KEYC_WHEELUP_PANE, 0, MODEKEYCOPY_SCROLLUP, 1 },
|
||||||
{ KEYC_WHEELDOWN_PANE, 0, MODEKEYCOPY_SCROLLDOWN },
|
{ KEYC_WHEELDOWN_PANE, 0, MODEKEYCOPY_SCROLLDOWN, 1 },
|
||||||
{ KEYC_MOUSEDRAG1_PANE, 0, MODEKEYCOPY_STARTSELECTION },
|
{ KEYC_MOUSEDRAG1_PANE, 0, MODEKEYCOPY_STARTSELECTION, 1 },
|
||||||
{ KEYC_MOUSEDRAGEND1_PANE, 0, MODEKEYCOPY_COPYSELECTION },
|
{ KEYC_MOUSEDRAGEND1_PANE, 0, MODEKEYCOPY_COPYSELECTION, 1 },
|
||||||
|
|
||||||
{ 0, -1, 0 }
|
{ 0, -1, 0, 1 }
|
||||||
};
|
};
|
||||||
struct mode_key_tree mode_key_tree_vi_copy;
|
struct mode_key_tree mode_key_tree_vi_copy;
|
||||||
|
|
||||||
/* emacs editing keys. */
|
/* emacs editing keys. */
|
||||||
const struct mode_key_entry mode_key_emacs_edit[] = {
|
const struct mode_key_entry mode_key_emacs_edit[] = {
|
||||||
{ '\001' /* C-a */, 0, MODEKEYEDIT_STARTOFLINE },
|
{ '\001' /* C-a */, 0, MODEKEYEDIT_STARTOFLINE, 1 },
|
||||||
{ '\002' /* C-b */, 0, MODEKEYEDIT_CURSORLEFT },
|
{ '\002' /* C-b */, 0, MODEKEYEDIT_CURSORLEFT, 1 },
|
||||||
{ '\003' /* C-c */, 0, MODEKEYEDIT_CANCEL },
|
{ '\003' /* C-c */, 0, MODEKEYEDIT_CANCEL, 1 },
|
||||||
{ '\004' /* C-d */, 0, MODEKEYEDIT_DELETE },
|
{ '\004' /* C-d */, 0, MODEKEYEDIT_DELETE, 1 },
|
||||||
{ '\005' /* C-e */, 0, MODEKEYEDIT_ENDOFLINE },
|
{ '\005' /* C-e */, 0, MODEKEYEDIT_ENDOFLINE, 1 },
|
||||||
{ '\006' /* C-f */, 0, MODEKEYEDIT_CURSORRIGHT },
|
{ '\006' /* C-f */, 0, MODEKEYEDIT_CURSORRIGHT, 1 },
|
||||||
{ '\010' /* C-H */, 0, MODEKEYEDIT_BACKSPACE },
|
{ '\010' /* C-H */, 0, MODEKEYEDIT_BACKSPACE, 1 },
|
||||||
{ '\011' /* Tab */, 0, MODEKEYEDIT_COMPLETE },
|
{ '\011' /* Tab */, 0, MODEKEYEDIT_COMPLETE, 1 },
|
||||||
{ '\013' /* C-k */, 0, MODEKEYEDIT_DELETETOENDOFLINE },
|
{ '\013' /* C-k */, 0, MODEKEYEDIT_DELETETOENDOFLINE, 1 },
|
||||||
{ '\016' /* C-n */, 0, MODEKEYEDIT_HISTORYDOWN },
|
{ '\016' /* C-n */, 0, MODEKEYEDIT_HISTORYDOWN, 1 },
|
||||||
{ '\020' /* C-p */, 0, MODEKEYEDIT_HISTORYUP },
|
{ '\020' /* C-p */, 0, MODEKEYEDIT_HISTORYUP, 1 },
|
||||||
{ '\024' /* C-t */, 0, MODEKEYEDIT_TRANSPOSECHARS },
|
{ '\024' /* C-t */, 0, MODEKEYEDIT_TRANSPOSECHARS, 1 },
|
||||||
{ '\025' /* C-u */, 0, MODEKEYEDIT_DELETELINE },
|
{ '\025' /* C-u */, 0, MODEKEYEDIT_DELETELINE, 1 },
|
||||||
{ '\027' /* C-w */, 0, MODEKEYEDIT_DELETEWORD },
|
{ '\027' /* C-w */, 0, MODEKEYEDIT_DELETEWORD, 1 },
|
||||||
{ '\031' /* C-y */, 0, MODEKEYEDIT_PASTE },
|
{ '\031' /* C-y */, 0, MODEKEYEDIT_PASTE, 1 },
|
||||||
{ '\033' /* Escape */, 0, MODEKEYEDIT_CANCEL },
|
{ '\033' /* Escape */, 0, MODEKEYEDIT_CANCEL, 1 },
|
||||||
{ '\n', 0, MODEKEYEDIT_ENTER },
|
{ '\n', 0, MODEKEYEDIT_ENTER, 1 },
|
||||||
{ '\r', 0, MODEKEYEDIT_ENTER },
|
{ '\r', 0, MODEKEYEDIT_ENTER, 1 },
|
||||||
{ 'b' | KEYC_ESCAPE, 0, MODEKEYEDIT_PREVIOUSWORD },
|
{ 'b' | KEYC_ESCAPE, 0, MODEKEYEDIT_PREVIOUSWORD, 1 },
|
||||||
{ 'f' | KEYC_ESCAPE, 0, MODEKEYEDIT_NEXTWORDEND },
|
{ 'f' | KEYC_ESCAPE, 0, MODEKEYEDIT_NEXTWORDEND, 1 },
|
||||||
{ 'm' | KEYC_ESCAPE, 0, MODEKEYEDIT_STARTOFLINE },
|
{ 'm' | KEYC_ESCAPE, 0, MODEKEYEDIT_STARTOFLINE, 1 },
|
||||||
{ KEYC_BSPACE, 0, MODEKEYEDIT_BACKSPACE },
|
{ KEYC_BSPACE, 0, MODEKEYEDIT_BACKSPACE, 1 },
|
||||||
{ KEYC_DC, 0, MODEKEYEDIT_DELETE },
|
{ KEYC_DC, 0, MODEKEYEDIT_DELETE, 1 },
|
||||||
{ KEYC_DOWN, 0, MODEKEYEDIT_HISTORYDOWN },
|
{ KEYC_DOWN, 0, MODEKEYEDIT_HISTORYDOWN, 1 },
|
||||||
{ KEYC_LEFT, 0, MODEKEYEDIT_CURSORLEFT },
|
{ KEYC_LEFT, 0, MODEKEYEDIT_CURSORLEFT, 1 },
|
||||||
{ KEYC_RIGHT, 0, MODEKEYEDIT_CURSORRIGHT },
|
{ KEYC_RIGHT, 0, MODEKEYEDIT_CURSORRIGHT, 1 },
|
||||||
{ KEYC_UP, 0, MODEKEYEDIT_HISTORYUP },
|
{ KEYC_UP, 0, MODEKEYEDIT_HISTORYUP, 1 },
|
||||||
{ KEYC_HOME, 0, MODEKEYEDIT_STARTOFLINE },
|
{ KEYC_HOME, 0, MODEKEYEDIT_STARTOFLINE, 1 },
|
||||||
{ KEYC_END, 0, MODEKEYEDIT_ENDOFLINE },
|
{ KEYC_END, 0, MODEKEYEDIT_ENDOFLINE, 1 },
|
||||||
|
|
||||||
{ 0, -1, 0 }
|
{ 0, -1, 0, 1 }
|
||||||
};
|
};
|
||||||
struct mode_key_tree mode_key_tree_emacs_edit;
|
struct mode_key_tree mode_key_tree_emacs_edit;
|
||||||
|
|
||||||
/* emacs choice selection keys. */
|
/* emacs choice selection keys. */
|
||||||
const struct mode_key_entry mode_key_emacs_choice[] = {
|
const struct mode_key_entry mode_key_emacs_choice[] = {
|
||||||
{ '0' | KEYC_ESCAPE, 0, MODEKEYCHOICE_STARTNUMBERPREFIX },
|
{ '0' | KEYC_ESCAPE, 0, MODEKEYCHOICE_STARTNUMBERPREFIX, 1 },
|
||||||
{ '1' | KEYC_ESCAPE, 0, MODEKEYCHOICE_STARTNUMBERPREFIX },
|
{ '1' | KEYC_ESCAPE, 0, MODEKEYCHOICE_STARTNUMBERPREFIX, 1 },
|
||||||
{ '2' | KEYC_ESCAPE, 0, MODEKEYCHOICE_STARTNUMBERPREFIX },
|
{ '2' | KEYC_ESCAPE, 0, MODEKEYCHOICE_STARTNUMBERPREFIX, 1 },
|
||||||
{ '3' | KEYC_ESCAPE, 0, MODEKEYCHOICE_STARTNUMBERPREFIX },
|
{ '3' | KEYC_ESCAPE, 0, MODEKEYCHOICE_STARTNUMBERPREFIX, 1 },
|
||||||
{ '4' | KEYC_ESCAPE, 0, MODEKEYCHOICE_STARTNUMBERPREFIX },
|
{ '4' | KEYC_ESCAPE, 0, MODEKEYCHOICE_STARTNUMBERPREFIX, 1 },
|
||||||
{ '5' | KEYC_ESCAPE, 0, MODEKEYCHOICE_STARTNUMBERPREFIX },
|
{ '5' | KEYC_ESCAPE, 0, MODEKEYCHOICE_STARTNUMBERPREFIX, 1 },
|
||||||
{ '6' | KEYC_ESCAPE, 0, MODEKEYCHOICE_STARTNUMBERPREFIX },
|
{ '6' | KEYC_ESCAPE, 0, MODEKEYCHOICE_STARTNUMBERPREFIX, 1 },
|
||||||
{ '7' | KEYC_ESCAPE, 0, MODEKEYCHOICE_STARTNUMBERPREFIX },
|
{ '7' | KEYC_ESCAPE, 0, MODEKEYCHOICE_STARTNUMBERPREFIX, 1 },
|
||||||
{ '8' | KEYC_ESCAPE, 0, MODEKEYCHOICE_STARTNUMBERPREFIX },
|
{ '8' | KEYC_ESCAPE, 0, MODEKEYCHOICE_STARTNUMBERPREFIX, 1 },
|
||||||
{ '9' | KEYC_ESCAPE, 0, MODEKEYCHOICE_STARTNUMBERPREFIX },
|
{ '9' | KEYC_ESCAPE, 0, MODEKEYCHOICE_STARTNUMBERPREFIX, 1 },
|
||||||
{ '\003' /* C-c */, 0, MODEKEYCHOICE_CANCEL },
|
{ '\003' /* C-c */, 0, MODEKEYCHOICE_CANCEL, 1 },
|
||||||
{ '\016' /* C-n */, 0, MODEKEYCHOICE_DOWN },
|
{ '\016' /* C-n */, 0, MODEKEYCHOICE_DOWN, 1 },
|
||||||
{ '\020' /* C-p */, 0, MODEKEYCHOICE_UP },
|
{ '\020' /* C-p */, 0, MODEKEYCHOICE_UP, 1 },
|
||||||
{ '\026' /* C-v */, 0, MODEKEYCHOICE_PAGEDOWN },
|
{ '\026' /* C-v */, 0, MODEKEYCHOICE_PAGEDOWN, 1 },
|
||||||
{ '\033' /* Escape */, 0, MODEKEYCHOICE_CANCEL },
|
{ '\033' /* Escape */, 0, MODEKEYCHOICE_CANCEL, 1 },
|
||||||
{ '\n', 0, MODEKEYCHOICE_CHOOSE },
|
{ '\n', 0, MODEKEYCHOICE_CHOOSE, 1 },
|
||||||
{ '\r', 0, MODEKEYCHOICE_CHOOSE },
|
{ '\r', 0, MODEKEYCHOICE_CHOOSE, 1 },
|
||||||
{ 'q', 0, MODEKEYCHOICE_CANCEL },
|
{ 'q', 0, MODEKEYCHOICE_CANCEL, 1 },
|
||||||
{ 'v' | KEYC_ESCAPE, 0, MODEKEYCHOICE_PAGEUP },
|
{ 'v' | KEYC_ESCAPE, 0, MODEKEYCHOICE_PAGEUP, 1 },
|
||||||
{ KEYC_HOME, 0, MODEKEYCHOICE_STARTOFLIST },
|
{ KEYC_HOME, 0, MODEKEYCHOICE_STARTOFLIST, 1 },
|
||||||
{ '<' | KEYC_ESCAPE, 0, MODEKEYCHOICE_STARTOFLIST },
|
{ '<' | KEYC_ESCAPE, 0, MODEKEYCHOICE_STARTOFLIST, 1 },
|
||||||
{ 'R' | KEYC_ESCAPE, 0, MODEKEYCHOICE_TOPLINE },
|
{ 'R' | KEYC_ESCAPE, 0, MODEKEYCHOICE_TOPLINE, 1 },
|
||||||
{ '>' | KEYC_ESCAPE, 0, MODEKEYCHOICE_ENDOFLIST },
|
{ '>' | KEYC_ESCAPE, 0, MODEKEYCHOICE_ENDOFLIST, 1 },
|
||||||
{ KEYC_END, 0, MODEKEYCHOICE_ENDOFLIST },
|
{ KEYC_END, 0, MODEKEYCHOICE_ENDOFLIST, 1 },
|
||||||
{ KEYC_BSPACE, 0, MODEKEYCHOICE_BACKSPACE },
|
{ KEYC_BSPACE, 0, MODEKEYCHOICE_BACKSPACE, 1 },
|
||||||
{ KEYC_DOWN | KEYC_CTRL, 0, MODEKEYCHOICE_SCROLLDOWN },
|
{ KEYC_DOWN | KEYC_CTRL, 0, MODEKEYCHOICE_SCROLLDOWN, 1 },
|
||||||
{ KEYC_DOWN, 0, MODEKEYCHOICE_DOWN },
|
{ KEYC_DOWN, 0, MODEKEYCHOICE_DOWN, 1 },
|
||||||
{ KEYC_NPAGE, 0, MODEKEYCHOICE_PAGEDOWN },
|
{ KEYC_NPAGE, 0, MODEKEYCHOICE_PAGEDOWN, 1 },
|
||||||
{ KEYC_PPAGE, 0, MODEKEYCHOICE_PAGEUP },
|
{ KEYC_PPAGE, 0, MODEKEYCHOICE_PAGEUP, 1 },
|
||||||
{ KEYC_UP | KEYC_CTRL, 0, MODEKEYCHOICE_SCROLLUP },
|
{ KEYC_UP | KEYC_CTRL, 0, MODEKEYCHOICE_SCROLLUP, 1 },
|
||||||
{ KEYC_UP, 0, MODEKEYCHOICE_UP },
|
{ KEYC_UP, 0, MODEKEYCHOICE_UP, 1 },
|
||||||
{ ' ', 0, MODEKEYCHOICE_TREE_TOGGLE },
|
{ ' ', 0, MODEKEYCHOICE_TREE_TOGGLE, 1 },
|
||||||
{ KEYC_LEFT, 0, MODEKEYCHOICE_TREE_COLLAPSE },
|
{ KEYC_LEFT, 0, MODEKEYCHOICE_TREE_COLLAPSE, 1 },
|
||||||
{ KEYC_RIGHT, 0, MODEKEYCHOICE_TREE_EXPAND },
|
{ KEYC_RIGHT, 0, MODEKEYCHOICE_TREE_EXPAND, 1 },
|
||||||
{ KEYC_LEFT | KEYC_CTRL, 0, MODEKEYCHOICE_TREE_COLLAPSE_ALL },
|
{ KEYC_LEFT | KEYC_CTRL, 0, MODEKEYCHOICE_TREE_COLLAPSE_ALL, 1 },
|
||||||
{ KEYC_RIGHT | KEYC_CTRL, 0, MODEKEYCHOICE_TREE_EXPAND_ALL },
|
{ KEYC_RIGHT | KEYC_CTRL, 0, MODEKEYCHOICE_TREE_EXPAND_ALL, 1 },
|
||||||
{ KEYC_MOUSEDOWN1_PANE, 0, MODEKEYCHOICE_CHOOSE },
|
{ KEYC_MOUSEDOWN1_PANE, 0, MODEKEYCHOICE_CHOOSE, 1 },
|
||||||
{ KEYC_MOUSEDOWN3_PANE, 0, MODEKEYCHOICE_TREE_TOGGLE },
|
{ KEYC_MOUSEDOWN3_PANE, 0, MODEKEYCHOICE_TREE_TOGGLE, 1 },
|
||||||
{ KEYC_WHEELUP_PANE, 0, MODEKEYCHOICE_UP },
|
{ KEYC_WHEELUP_PANE, 0, MODEKEYCHOICE_UP, 5 },
|
||||||
{ KEYC_WHEELDOWN_PANE, 0, MODEKEYCHOICE_DOWN },
|
{ KEYC_WHEELDOWN_PANE, 0, MODEKEYCHOICE_DOWN, 5 },
|
||||||
|
|
||||||
{ 0, -1, 0 }
|
{ 0, -1, 0, 1 }
|
||||||
};
|
};
|
||||||
struct mode_key_tree mode_key_tree_emacs_choice;
|
struct mode_key_tree mode_key_tree_emacs_choice;
|
||||||
|
|
||||||
/* emacs copy mode keys. */
|
/* emacs copy mode keys. */
|
||||||
const struct mode_key_entry mode_key_emacs_copy[] = {
|
const struct mode_key_entry mode_key_emacs_copy[] = {
|
||||||
{ ' ', 0, MODEKEYCOPY_NEXTPAGE },
|
{ ' ', 0, MODEKEYCOPY_NEXTPAGE, 1 },
|
||||||
{ ',', 0, MODEKEYCOPY_JUMPREVERSE },
|
{ ',', 0, MODEKEYCOPY_JUMPREVERSE, 1 },
|
||||||
{ ';', 0, MODEKEYCOPY_JUMPAGAIN },
|
{ ';', 0, MODEKEYCOPY_JUMPAGAIN, 1 },
|
||||||
{ '1' | KEYC_ESCAPE, 0, MODEKEYCOPY_STARTNUMBERPREFIX },
|
{ '1' | KEYC_ESCAPE, 0, MODEKEYCOPY_STARTNUMBERPREFIX, 1 },
|
||||||
{ '2' | KEYC_ESCAPE, 0, MODEKEYCOPY_STARTNUMBERPREFIX },
|
{ '2' | KEYC_ESCAPE, 0, MODEKEYCOPY_STARTNUMBERPREFIX, 1 },
|
||||||
{ '3' | KEYC_ESCAPE, 0, MODEKEYCOPY_STARTNUMBERPREFIX },
|
{ '3' | KEYC_ESCAPE, 0, MODEKEYCOPY_STARTNUMBERPREFIX, 1 },
|
||||||
{ '4' | KEYC_ESCAPE, 0, MODEKEYCOPY_STARTNUMBERPREFIX },
|
{ '4' | KEYC_ESCAPE, 0, MODEKEYCOPY_STARTNUMBERPREFIX, 1 },
|
||||||
{ '5' | KEYC_ESCAPE, 0, MODEKEYCOPY_STARTNUMBERPREFIX },
|
{ '5' | KEYC_ESCAPE, 0, MODEKEYCOPY_STARTNUMBERPREFIX, 1 },
|
||||||
{ '6' | KEYC_ESCAPE, 0, MODEKEYCOPY_STARTNUMBERPREFIX },
|
{ '6' | KEYC_ESCAPE, 0, MODEKEYCOPY_STARTNUMBERPREFIX, 1 },
|
||||||
{ '7' | KEYC_ESCAPE, 0, MODEKEYCOPY_STARTNUMBERPREFIX },
|
{ '7' | KEYC_ESCAPE, 0, MODEKEYCOPY_STARTNUMBERPREFIX, 1 },
|
||||||
{ '8' | KEYC_ESCAPE, 0, MODEKEYCOPY_STARTNUMBERPREFIX },
|
{ '8' | KEYC_ESCAPE, 0, MODEKEYCOPY_STARTNUMBERPREFIX, 1 },
|
||||||
{ '9' | KEYC_ESCAPE, 0, MODEKEYCOPY_STARTNUMBERPREFIX },
|
{ '9' | KEYC_ESCAPE, 0, MODEKEYCOPY_STARTNUMBERPREFIX, 1 },
|
||||||
{ '<' | KEYC_ESCAPE, 0, MODEKEYCOPY_HISTORYTOP },
|
{ '<' | KEYC_ESCAPE, 0, MODEKEYCOPY_HISTORYTOP, 1 },
|
||||||
{ '>' | KEYC_ESCAPE, 0, MODEKEYCOPY_HISTORYBOTTOM },
|
{ '>' | KEYC_ESCAPE, 0, MODEKEYCOPY_HISTORYBOTTOM, 1 },
|
||||||
{ 'F', 0, MODEKEYCOPY_JUMPBACK },
|
{ 'F', 0, MODEKEYCOPY_JUMPBACK, 1 },
|
||||||
{ 'N', 0, MODEKEYCOPY_SEARCHREVERSE },
|
{ 'N', 0, MODEKEYCOPY_SEARCHREVERSE, 1 },
|
||||||
{ 'R' | KEYC_ESCAPE, 0, MODEKEYCOPY_TOPLINE },
|
{ 'R' | KEYC_ESCAPE, 0, MODEKEYCOPY_TOPLINE, 1 },
|
||||||
{ 'R', 0, MODEKEYCOPY_RECTANGLETOGGLE },
|
{ 'R', 0, MODEKEYCOPY_RECTANGLETOGGLE, 1 },
|
||||||
{ 'T', 0, MODEKEYCOPY_JUMPTOBACK },
|
{ 'T', 0, MODEKEYCOPY_JUMPTOBACK, 1 },
|
||||||
{ '\000' /* C-Space */, 0, MODEKEYCOPY_STARTSELECTION },
|
{ '\000' /* C-Space */, 0, MODEKEYCOPY_STARTSELECTION, 1 },
|
||||||
{ '\001' /* C-a */, 0, MODEKEYCOPY_STARTOFLINE },
|
{ '\001' /* C-a */, 0, MODEKEYCOPY_STARTOFLINE, 1 },
|
||||||
{ '\002' /* C-b */, 0, MODEKEYCOPY_LEFT },
|
{ '\002' /* C-b */, 0, MODEKEYCOPY_LEFT, 1 },
|
||||||
{ '\003' /* C-c */, 0, MODEKEYCOPY_CANCEL },
|
{ '\003' /* C-c */, 0, MODEKEYCOPY_CANCEL, 1 },
|
||||||
{ '\005' /* C-e */, 0, MODEKEYCOPY_ENDOFLINE },
|
{ '\005' /* C-e */, 0, MODEKEYCOPY_ENDOFLINE, 1 },
|
||||||
{ '\006' /* C-f */, 0, MODEKEYCOPY_RIGHT },
|
{ '\006' /* C-f */, 0, MODEKEYCOPY_RIGHT, 1 },
|
||||||
{ '\007' /* C-g */, 0, MODEKEYCOPY_CLEARSELECTION },
|
{ '\007' /* C-g */, 0, MODEKEYCOPY_CLEARSELECTION, 1 },
|
||||||
{ '\013' /* C-k */, 0, MODEKEYCOPY_COPYENDOFLINE },
|
{ '\013' /* C-k */, 0, MODEKEYCOPY_COPYENDOFLINE, 1 },
|
||||||
{ '\016' /* C-n */, 0, MODEKEYCOPY_DOWN },
|
{ '\016' /* C-n */, 0, MODEKEYCOPY_DOWN, 1 },
|
||||||
{ '\020' /* C-p */, 0, MODEKEYCOPY_UP },
|
{ '\020' /* C-p */, 0, MODEKEYCOPY_UP, 1 },
|
||||||
{ '\022' /* C-r */, 0, MODEKEYCOPY_SEARCHUP },
|
{ '\022' /* C-r */, 0, MODEKEYCOPY_SEARCHUP, 1 },
|
||||||
{ '\023' /* C-s */, 0, MODEKEYCOPY_SEARCHDOWN },
|
{ '\023' /* C-s */, 0, MODEKEYCOPY_SEARCHDOWN, 1 },
|
||||||
{ '\026' /* C-v */, 0, MODEKEYCOPY_NEXTPAGE },
|
{ '\026' /* C-v */, 0, MODEKEYCOPY_NEXTPAGE, 1 },
|
||||||
{ '\027' /* C-w */, 0, MODEKEYCOPY_COPYSELECTION },
|
{ '\027' /* C-w */, 0, MODEKEYCOPY_COPYSELECTION, 1 },
|
||||||
{ '\033' /* Escape */, 0, MODEKEYCOPY_CANCEL },
|
{ '\033' /* Escape */, 0, MODEKEYCOPY_CANCEL, 1 },
|
||||||
{ 'b' | KEYC_ESCAPE, 0, MODEKEYCOPY_PREVIOUSWORD },
|
{ 'b' | KEYC_ESCAPE, 0, MODEKEYCOPY_PREVIOUSWORD, 1 },
|
||||||
{ 'f', 0, MODEKEYCOPY_JUMP },
|
{ 'f', 0, MODEKEYCOPY_JUMP, 1 },
|
||||||
{ 'f' | KEYC_ESCAPE, 0, MODEKEYCOPY_NEXTWORDEND },
|
{ 'f' | KEYC_ESCAPE, 0, MODEKEYCOPY_NEXTWORDEND, 1 },
|
||||||
{ 'g', 0, MODEKEYCOPY_GOTOLINE },
|
{ 'g', 0, MODEKEYCOPY_GOTOLINE, 1 },
|
||||||
{ 'm' | KEYC_ESCAPE, 0, MODEKEYCOPY_BACKTOINDENTATION },
|
{ 'm' | KEYC_ESCAPE, 0, MODEKEYCOPY_BACKTOINDENTATION, 1 },
|
||||||
{ 'n', 0, MODEKEYCOPY_SEARCHAGAIN },
|
{ 'n', 0, MODEKEYCOPY_SEARCHAGAIN, 1 },
|
||||||
{ 'q', 0, MODEKEYCOPY_CANCEL },
|
{ 'q', 0, MODEKEYCOPY_CANCEL, 1 },
|
||||||
{ 'r' | KEYC_ESCAPE, 0, MODEKEYCOPY_MIDDLELINE },
|
{ 'r' | KEYC_ESCAPE, 0, MODEKEYCOPY_MIDDLELINE, 1 },
|
||||||
{ 't', 0, MODEKEYCOPY_JUMPTO },
|
{ 't', 0, MODEKEYCOPY_JUMPTO, 1 },
|
||||||
{ 'v' | KEYC_ESCAPE, 0, MODEKEYCOPY_PREVIOUSPAGE },
|
{ 'v' | KEYC_ESCAPE, 0, MODEKEYCOPY_PREVIOUSPAGE, 1 },
|
||||||
{ 'w' | KEYC_ESCAPE, 0, MODEKEYCOPY_COPYSELECTION },
|
{ 'w' | KEYC_ESCAPE, 0, MODEKEYCOPY_COPYSELECTION, 1 },
|
||||||
{ '{' | KEYC_ESCAPE, 0, MODEKEYCOPY_PREVIOUSPARAGRAPH },
|
{ '{' | KEYC_ESCAPE, 0, MODEKEYCOPY_PREVIOUSPARAGRAPH, 1 },
|
||||||
{ '}' | KEYC_ESCAPE, 0, MODEKEYCOPY_NEXTPARAGRAPH },
|
{ '}' | KEYC_ESCAPE, 0, MODEKEYCOPY_NEXTPARAGRAPH, 1 },
|
||||||
{ KEYC_DOWN | KEYC_CTRL, 0, MODEKEYCOPY_SCROLLDOWN },
|
{ KEYC_DOWN | KEYC_CTRL, 0, MODEKEYCOPY_SCROLLDOWN, 1 },
|
||||||
{ KEYC_DOWN | KEYC_ESCAPE, 0, MODEKEYCOPY_HALFPAGEDOWN },
|
{ KEYC_DOWN | KEYC_ESCAPE, 0, MODEKEYCOPY_HALFPAGEDOWN, 1 },
|
||||||
{ KEYC_DOWN, 0, MODEKEYCOPY_DOWN },
|
{ KEYC_DOWN, 0, MODEKEYCOPY_DOWN, 1 },
|
||||||
{ KEYC_LEFT, 0, MODEKEYCOPY_LEFT },
|
{ KEYC_LEFT, 0, MODEKEYCOPY_LEFT, 1 },
|
||||||
{ KEYC_NPAGE, 0, MODEKEYCOPY_NEXTPAGE },
|
{ KEYC_NPAGE, 0, MODEKEYCOPY_NEXTPAGE, 1 },
|
||||||
{ KEYC_PPAGE, 0, MODEKEYCOPY_PREVIOUSPAGE },
|
{ KEYC_PPAGE, 0, MODEKEYCOPY_PREVIOUSPAGE, 1 },
|
||||||
{ KEYC_RIGHT, 0, MODEKEYCOPY_RIGHT },
|
{ KEYC_RIGHT, 0, MODEKEYCOPY_RIGHT, 1 },
|
||||||
{ KEYC_UP | KEYC_CTRL, 0, MODEKEYCOPY_SCROLLUP },
|
{ KEYC_UP | KEYC_CTRL, 0, MODEKEYCOPY_SCROLLUP, 1 },
|
||||||
{ KEYC_UP | KEYC_ESCAPE, 0, MODEKEYCOPY_HALFPAGEUP },
|
{ KEYC_UP | KEYC_ESCAPE, 0, MODEKEYCOPY_HALFPAGEUP, 1 },
|
||||||
{ KEYC_UP, 0, MODEKEYCOPY_UP },
|
{ KEYC_UP, 0, MODEKEYCOPY_UP, 1 },
|
||||||
{ KEYC_WHEELUP_PANE, 0, MODEKEYCOPY_SCROLLUP },
|
{ KEYC_WHEELUP_PANE, 0, MODEKEYCOPY_SCROLLUP, 5 },
|
||||||
{ KEYC_WHEELDOWN_PANE, 0, MODEKEYCOPY_SCROLLDOWN },
|
{ KEYC_WHEELDOWN_PANE, 0, MODEKEYCOPY_SCROLLDOWN, 5 },
|
||||||
{ KEYC_MOUSEDRAG1_PANE, 0, MODEKEYCOPY_STARTSELECTION },
|
{ KEYC_MOUSEDRAG1_PANE, 0, MODEKEYCOPY_STARTSELECTION, 1 },
|
||||||
{ KEYC_MOUSEDRAGEND1_PANE, 0, MODEKEYCOPY_COPYSELECTION },
|
{ KEYC_MOUSEDRAGEND1_PANE, 0, MODEKEYCOPY_COPYSELECTION, 1 },
|
||||||
|
|
||||||
{ 0, -1, 0 }
|
{ 0, -1, 0, 1 }
|
||||||
};
|
};
|
||||||
struct mode_key_tree mode_key_tree_emacs_copy;
|
struct mode_key_tree mode_key_tree_emacs_copy;
|
||||||
|
|
||||||
@ -586,6 +587,7 @@ mode_key_init_trees(void)
|
|||||||
for (ment = mtab->table; ment->mode != -1; ment++) {
|
for (ment = mtab->table; ment->mode != -1; ment++) {
|
||||||
mbind = xmalloc(sizeof *mbind);
|
mbind = xmalloc(sizeof *mbind);
|
||||||
mbind->key = ment->key;
|
mbind->key = ment->key;
|
||||||
|
mbind->repeat = ment->repeat;
|
||||||
mbind->mode = ment->mode;
|
mbind->mode = ment->mode;
|
||||||
mbind->cmd = ment->cmd;
|
mbind->cmd = ment->cmd;
|
||||||
mbind->arg = NULL;
|
mbind->arg = NULL;
|
||||||
@ -602,7 +604,8 @@ mode_key_init(struct mode_key_data *mdata, struct mode_key_tree *mtree)
|
|||||||
}
|
}
|
||||||
|
|
||||||
enum mode_key_cmd
|
enum mode_key_cmd
|
||||||
mode_key_lookup(struct mode_key_data *mdata, key_code key, const char **arg)
|
mode_key_lookup(struct mode_key_data *mdata, key_code key, const char **arg,
|
||||||
|
u_int *repeat)
|
||||||
{
|
{
|
||||||
struct mode_key_binding *mbind, mtmp;
|
struct mode_key_binding *mbind, mtmp;
|
||||||
|
|
||||||
@ -613,6 +616,8 @@ mode_key_lookup(struct mode_key_data *mdata, key_code key, const char **arg)
|
|||||||
return (MODEKEY_NONE);
|
return (MODEKEY_NONE);
|
||||||
return (MODEKEY_OTHER);
|
return (MODEKEY_OTHER);
|
||||||
}
|
}
|
||||||
|
if (repeat != NULL)
|
||||||
|
*repeat = mbind->repeat;
|
||||||
|
|
||||||
switch (mbind->cmd) {
|
switch (mbind->cmd) {
|
||||||
case MODEKEYEDIT_SWITCHMODE:
|
case MODEKEYEDIT_SWITCHMODE:
|
||||||
|
2
status.c
2
status.c
@ -818,7 +818,7 @@ status_prompt_key(struct client *c, key_code key)
|
|||||||
size_t size, n, off, idx, bufsize;
|
size_t size, n, off, idx, bufsize;
|
||||||
|
|
||||||
size = strlen(c->prompt_buffer);
|
size = strlen(c->prompt_buffer);
|
||||||
switch (mode_key_lookup(&c->prompt_mdata, key, NULL)) {
|
switch (mode_key_lookup(&c->prompt_mdata, key, NULL, NULL)) {
|
||||||
case MODEKEYEDIT_CURSORLEFT:
|
case MODEKEYEDIT_CURSORLEFT:
|
||||||
if (c->prompt_index > 0) {
|
if (c->prompt_index > 0) {
|
||||||
c->prompt_index--;
|
c->prompt_index--;
|
||||||
|
9
tmux.1
9
tmux.1
@ -2133,6 +2133,7 @@ Commands related to key bindings are as follows:
|
|||||||
.Bl -tag -width Ds
|
.Bl -tag -width Ds
|
||||||
.It Xo Ic bind-key
|
.It Xo Ic bind-key
|
||||||
.Op Fl cnr
|
.Op Fl cnr
|
||||||
|
.Op Fl R Ar repeat-count
|
||||||
.Op Fl t Ar mode-table
|
.Op Fl t Ar mode-table
|
||||||
.Op Fl T Ar key-table
|
.Op Fl T Ar key-table
|
||||||
.Ar key Ar command Op Ar arguments
|
.Ar key Ar command Op Ar arguments
|
||||||
@ -2191,6 +2192,14 @@ is bound in
|
|||||||
the binding for command mode with
|
the binding for command mode with
|
||||||
.Fl c
|
.Fl c
|
||||||
or for normal mode without.
|
or for normal mode without.
|
||||||
|
For keys in the
|
||||||
|
.Em vi-copy
|
||||||
|
or
|
||||||
|
.Em emacs-copy
|
||||||
|
tables,
|
||||||
|
.Fl R
|
||||||
|
specifies how many times the command should be repeated.
|
||||||
|
.Pp
|
||||||
See the
|
See the
|
||||||
.Sx WINDOWS AND PANES
|
.Sx WINDOWS AND PANES
|
||||||
section and the
|
section and the
|
||||||
|
3
tmux.h
3
tmux.h
@ -566,6 +566,7 @@ struct mode_key_data {
|
|||||||
/* Binding between a key and a command. */
|
/* Binding between a key and a command. */
|
||||||
struct mode_key_binding {
|
struct mode_key_binding {
|
||||||
key_code key;
|
key_code key;
|
||||||
|
u_int repeat;
|
||||||
|
|
||||||
int mode;
|
int mode;
|
||||||
enum mode_key_cmd cmd;
|
enum mode_key_cmd cmd;
|
||||||
@ -1633,7 +1634,7 @@ const struct mode_key_table *mode_key_findtable(const char *);
|
|||||||
void mode_key_init_trees(void);
|
void mode_key_init_trees(void);
|
||||||
void mode_key_init(struct mode_key_data *, struct mode_key_tree *);
|
void mode_key_init(struct mode_key_data *, struct mode_key_tree *);
|
||||||
enum mode_key_cmd mode_key_lookup(struct mode_key_data *, key_code,
|
enum mode_key_cmd mode_key_lookup(struct mode_key_data *, key_code,
|
||||||
const char **);
|
const char **, u_int *);
|
||||||
|
|
||||||
/* notify.c */
|
/* notify.c */
|
||||||
void notify_enable(void);
|
void notify_enable(void);
|
||||||
|
@ -552,7 +552,7 @@ window_choose_key(struct window_pane *wp, __unused struct client *c,
|
|||||||
items = data->list_size;
|
items = data->list_size;
|
||||||
|
|
||||||
if (data->input_type == WINDOW_CHOOSE_GOTO_ITEM) {
|
if (data->input_type == WINDOW_CHOOSE_GOTO_ITEM) {
|
||||||
switch (mode_key_lookup(&data->mdata, key, NULL)) {
|
switch (mode_key_lookup(&data->mdata, key, NULL, NULL)) {
|
||||||
case MODEKEYCHOICE_CANCEL:
|
case MODEKEYCHOICE_CANCEL:
|
||||||
data->input_type = WINDOW_CHOOSE_NORMAL;
|
data->input_type = WINDOW_CHOOSE_NORMAL;
|
||||||
window_choose_redraw_screen(wp);
|
window_choose_redraw_screen(wp);
|
||||||
@ -582,7 +582,7 @@ window_choose_key(struct window_pane *wp, __unused struct client *c,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (mode_key_lookup(&data->mdata, key, NULL)) {
|
switch (mode_key_lookup(&data->mdata, key, NULL, NULL)) {
|
||||||
case MODEKEYCHOICE_CANCEL:
|
case MODEKEYCHOICE_CANCEL:
|
||||||
window_choose_fire_callback(wp, NULL);
|
window_choose_fire_callback(wp, NULL);
|
||||||
break;
|
break;
|
||||||
@ -837,7 +837,7 @@ window_choose_key_index(struct window_choose_mode_data *data, u_int idx)
|
|||||||
int mkey;
|
int mkey;
|
||||||
|
|
||||||
for (ptr = keys; *ptr != '\0'; ptr++) {
|
for (ptr = keys; *ptr != '\0'; ptr++) {
|
||||||
mkey = mode_key_lookup(&data->mdata, *ptr, NULL);
|
mkey = mode_key_lookup(&data->mdata, *ptr, NULL, NULL);
|
||||||
if (mkey != MODEKEY_NONE && mkey != MODEKEY_OTHER)
|
if (mkey != MODEKEY_NONE && mkey != MODEKEY_OTHER)
|
||||||
continue;
|
continue;
|
||||||
if (idx-- == 0)
|
if (idx-- == 0)
|
||||||
@ -857,7 +857,7 @@ window_choose_index_key(struct window_choose_mode_data *data, key_code key)
|
|||||||
u_int idx = 0;
|
u_int idx = 0;
|
||||||
|
|
||||||
for (ptr = keys; *ptr != '\0'; ptr++) {
|
for (ptr = keys; *ptr != '\0'; ptr++) {
|
||||||
mkey = mode_key_lookup(&data->mdata, *ptr, NULL);
|
mkey = mode_key_lookup(&data->mdata, *ptr, NULL, NULL);
|
||||||
if (mkey != MODEKEY_NONE && mkey != MODEKEY_OTHER)
|
if (mkey != MODEKEY_NONE && mkey != MODEKEY_OTHER)
|
||||||
continue;
|
continue;
|
||||||
if (key == (key_code)*ptr)
|
if (key == (key_code)*ptr)
|
||||||
|
@ -538,7 +538,9 @@ window_copy_key(struct window_pane *wp, struct client *c, struct session *sess,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
cmd = mode_key_lookup(&data->mdata, key, &arg);
|
cmd = mode_key_lookup(&data->mdata, key, &arg, &np);
|
||||||
|
if (data->numprefix > 0)
|
||||||
|
np = data->numprefix;
|
||||||
if (cmd != MODEKEYCOPY_PREVIOUSPAGE &&
|
if (cmd != MODEKEYCOPY_PREVIOUSPAGE &&
|
||||||
cmd != MODEKEYCOPY_NEXTPAGE &&
|
cmd != MODEKEYCOPY_NEXTPAGE &&
|
||||||
cmd != MODEKEYCOPY_SCROLLUP &&
|
cmd != MODEKEYCOPY_SCROLLUP &&
|
||||||
@ -900,11 +902,11 @@ window_copy_key_input(struct window_pane *wp, key_code key)
|
|||||||
struct screen *s = &data->screen;
|
struct screen *s = &data->screen;
|
||||||
const char *bufdata;
|
const char *bufdata;
|
||||||
size_t inputlen, n, bufsize;
|
size_t inputlen, n, bufsize;
|
||||||
int np;
|
u_int np;
|
||||||
struct paste_buffer *pb;
|
struct paste_buffer *pb;
|
||||||
u_char ch;
|
u_char ch;
|
||||||
|
|
||||||
switch (mode_key_lookup(&data->mdata, key, NULL)) {
|
switch (mode_key_lookup(&data->mdata, key, NULL, &np)) {
|
||||||
case MODEKEYEDIT_CANCEL:
|
case MODEKEYEDIT_CANCEL:
|
||||||
data->numprefix = -1;
|
data->numprefix = -1;
|
||||||
return (-1);
|
return (-1);
|
||||||
@ -932,10 +934,8 @@ window_copy_key_input(struct window_pane *wp, key_code key)
|
|||||||
data->inputstr[inputlen + n] = '\0';
|
data->inputstr[inputlen + n] = '\0';
|
||||||
break;
|
break;
|
||||||
case MODEKEYEDIT_ENTER:
|
case MODEKEYEDIT_ENTER:
|
||||||
|
if (data->numprefix > 0)
|
||||||
np = data->numprefix;
|
np = data->numprefix;
|
||||||
if (np <= 0)
|
|
||||||
np = 1;
|
|
||||||
|
|
||||||
switch (data->inputtype) {
|
switch (data->inputtype) {
|
||||||
case WINDOW_COPY_OFF:
|
case WINDOW_COPY_OFF:
|
||||||
case WINDOW_COPY_JUMPFORWARD:
|
case WINDOW_COPY_JUMPFORWARD:
|
||||||
|
Loading…
Reference in New Issue
Block a user