diff options
author | Nicholas Marriott <nicm@cvs.openbsd.org> | 2012-03-04 07:38:12 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@cvs.openbsd.org> | 2012-03-04 07:38:12 +0000 |
commit | 5d0aa03a633e8df8df1d78b9213b066b6d400d4e (patch) | |
tree | c56e9ad23dd1fa09f266f8d28721188cf2f8e0e8 | |
parent | 2633ada3066a035cb2bc379a4dd0f77a9b240118 (diff) |
Add A and I keys for vi status line editing.
-rw-r--r-- | usr.bin/tmux/mode-key.c | 13 | ||||
-rw-r--r-- | usr.bin/tmux/status.c | 8 | ||||
-rw-r--r-- | usr.bin/tmux/tmux.h | 4 |
3 files changed, 20 insertions, 5 deletions
diff --git a/usr.bin/tmux/mode-key.c b/usr.bin/tmux/mode-key.c index e37970c77ff..8ac1ff98353 100644 --- a/usr.bin/tmux/mode-key.c +++ b/usr.bin/tmux/mode-key.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mode-key.c,v 1.44 2012/01/21 11:12:13 nicm Exp $ */ +/* $OpenBSD: mode-key.c,v 1.45 2012/03/04 07:38:11 nicm Exp $ */ /* * Copyright (c) 2008 Nicholas Marriott <nicm@users.sourceforge.net> @@ -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: diff --git a/usr.bin/tmux/status.c b/usr.bin/tmux/status.c index 2e70107e246..26af8075d63 100644 --- a/usr.bin/tmux/status.c +++ b/usr.bin/tmux/status.c @@ -1,4 +1,4 @@ -/* $OpenBSD: status.c,v 1.88 2012/03/03 08:55:56 nicm Exp $ */ +/* $OpenBSD: status.c,v 1.89 2012/03/04 07:38:11 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -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; diff --git a/usr.bin/tmux/tmux.h b/usr.bin/tmux/tmux.h index 6725618661f..099ac755b3d 100644 --- a/usr.bin/tmux/tmux.h +++ b/usr.bin/tmux/tmux.h @@ -1,4 +1,4 @@ -/* $OpenBSD: tmux.h,v 1.317 2012/03/03 09:43:23 nicm Exp $ */ +/* $OpenBSD: tmux.h,v 1.318 2012/03/04 07:38:11 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -457,6 +457,8 @@ enum mode_key_cmd { MODEKEYEDIT_STARTOFLINE, MODEKEYEDIT_SWITCHMODE, MODEKEYEDIT_SWITCHMODEAPPEND, + MODEKEYEDIT_SWITCHMODEAPPENDLINE, + MODEKEYEDIT_SWITCHMODEBEGINLINE, MODEKEYEDIT_TRANSPOSECHARS, /* Menu (choice) keys. */ |