mirror of
https://github.com/tmate-io/tmate.git
synced 2024-12-22 23:00:51 +01:00
Sync OpenBSD patchset 1039:
Add A and I keys for vi status line editing.
This commit is contained in:
parent
e7c7024907
commit
32a6092f71
11
mode-key.c
11
mode-key.c
@ -35,8 +35,9 @@
|
||||
*
|
||||
* vi command mode is handled by having a mode flag in the struct which allows
|
||||
* two sets of bindings to be swapped between. A couple of editing commands
|
||||
* (MODEKEYEDIT_SWITCHMODE and MODEKEYEDIT_SWITCHMODEAPPEND) are special-cased
|
||||
* to do this.
|
||||
* (MODEKEYEDIT_SWITCHMODE, MODEKEYEDIT_SWITCHMODEAPPEND,
|
||||
* MODEKEYEDIT_SWITCHMODEAPPENDLINE, and MODEKEYEDIT_SWITCHMODEBEGINLINE)
|
||||
* are special-cased to do this.
|
||||
*/
|
||||
|
||||
/* Edit keys command strings. */
|
||||
@ -64,6 +65,8 @@ const struct mode_key_cmdstr mode_key_cmdstr_edit[] = {
|
||||
{ MODEKEYEDIT_STARTOFLINE, "start-of-line" },
|
||||
{ MODEKEYEDIT_SWITCHMODE, "switch-mode" },
|
||||
{ MODEKEYEDIT_SWITCHMODEAPPEND, "switch-mode-append" },
|
||||
{ MODEKEYEDIT_SWITCHMODEAPPENDLINE, "switch-mode-append-line" },
|
||||
{ MODEKEYEDIT_SWITCHMODEBEGINLINE, "switch-mode-begin-line" },
|
||||
{ MODEKEYEDIT_TRANSPOSECHARS, "transpose-chars" },
|
||||
|
||||
{ 0, NULL }
|
||||
@ -151,9 +154,11 @@ const struct mode_key_entry mode_key_vi_edit[] = {
|
||||
|
||||
{ '$', 1, MODEKEYEDIT_ENDOFLINE },
|
||||
{ '0', 1, MODEKEYEDIT_STARTOFLINE },
|
||||
{ 'A', 1, MODEKEYEDIT_SWITCHMODEAPPENDLINE },
|
||||
{ 'B', 1, MODEKEYEDIT_PREVIOUSSPACE },
|
||||
{ 'D', 1, MODEKEYEDIT_DELETETOENDOFLINE },
|
||||
{ 'E', 1, MODEKEYEDIT_NEXTSPACEEND },
|
||||
{ 'I', 1, MODEKEYEDIT_SWITCHMODEBEGINLINE },
|
||||
{ 'W', 1, MODEKEYEDIT_NEXTSPACE },
|
||||
{ 'X', 1, MODEKEYEDIT_BACKSPACE },
|
||||
{ '\003' /* C-c */, 1, MODEKEYEDIT_CANCEL },
|
||||
@ -496,6 +501,8 @@ mode_key_lookup(struct mode_key_data *mdata, int key)
|
||||
switch (mbind->cmd) {
|
||||
case MODEKEYEDIT_SWITCHMODE:
|
||||
case MODEKEYEDIT_SWITCHMODEAPPEND:
|
||||
case MODEKEYEDIT_SWITCHMODEAPPENDLINE:
|
||||
case MODEKEYEDIT_SWITCHMODEBEGINLINE:
|
||||
mdata->mode = 1 - mdata->mode;
|
||||
/* FALLTHROUGH */
|
||||
default:
|
||||
|
6
status.c
6
status.c
@ -1038,12 +1038,18 @@ status_prompt_key(struct client *c, int key)
|
||||
c->flags |= CLIENT_STATUS;
|
||||
}
|
||||
break;
|
||||
case MODEKEYEDIT_SWITCHMODEBEGINLINE:
|
||||
c->flags |= CLIENT_STATUS;
|
||||
/* FALLTHROUGH */
|
||||
case MODEKEYEDIT_STARTOFLINE:
|
||||
if (c->prompt_index != 0) {
|
||||
c->prompt_index = 0;
|
||||
c->flags |= CLIENT_STATUS;
|
||||
}
|
||||
break;
|
||||
case MODEKEYEDIT_SWITCHMODEAPPENDLINE:
|
||||
c->flags |= CLIENT_STATUS;
|
||||
/* FALLTHROUGH */
|
||||
case MODEKEYEDIT_ENDOFLINE:
|
||||
if (c->prompt_index != size) {
|
||||
c->prompt_index = size;
|
||||
|
Loading…
Reference in New Issue
Block a user