diff options
author | Nicholas Marriott <nicm@cvs.openbsd.org> | 2009-07-21 17:57:30 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@cvs.openbsd.org> | 2009-07-21 17:57:30 +0000 |
commit | e7796ea112614fab8a2d1f5ceee96df733f498cc (patch) | |
tree | 1f73d20ddb3d8313d62af366398cf245b5c28090 /usr.bin/tmux/mode-key.c | |
parent | 73cb0c874fa1a730790bc919cef8d73e5d749f74 (diff) |
Tidy up keys: use an enum for the key codes, and remove the macros which just
wrap flag sets/clears/tests.
Diffstat (limited to 'usr.bin/tmux/mode-key.c')
-rw-r--r-- | usr.bin/tmux/mode-key.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/usr.bin/tmux/mode-key.c b/usr.bin/tmux/mode-key.c index 79c3a473c50..2c274d71e39 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.2 2009/07/12 16:15:34 nicm Exp $ */ +/* $OpenBSD: mode-key.c,v 1.3 2009/07/21 17:57:29 nicm Exp $ */ /* * Copyright (c) 2008 Nicholas Marriott <nicm@users.sourceforge.net> @@ -54,8 +54,8 @@ mode_key_lookup(struct mode_key_data *mdata, int key) enum mode_key_cmd mode_key_lookup_vi(struct mode_key_data *mdata, int key) { - if (KEYC_ISESC(key)) { - key = KEYC_REMOVEESC(key); + if (key & KEYC_ESCAPE) { + key &= ~KEYC_ESCAPE; if (mdata->flags & MODEKEY_CANEDIT) mdata->flags ^= MODEKEY_EDITMODE; } @@ -161,12 +161,12 @@ mode_key_lookup_emacs(struct mode_key_data *mdata, int key) return (MODEKEYCMD_CHOOSE); case '\001': return (MODEKEYCMD_STARTOFLINE); - case KEYC_ADDESC('m'): + case 'm' | KEYC_ESCAPE: return (MODEKEYCMD_BACKTOINDENTATION); case '\007': return (MODEKEYCMD_CLEARSELECTION); case '\027': - case KEYC_ADDESC('w'): + case 'w' | KEYC_ESCAPE: return (MODEKEYCMD_COPYSELECTION); case '\016': case KEYC_DOWN: @@ -183,14 +183,14 @@ mode_key_lookup_emacs(struct mode_key_data *mdata, int key) case '\026': case KEYC_NPAGE: return (MODEKEYCMD_NEXTPAGE); - case KEYC_ADDESC('f'): + case 'f' | KEYC_ESCAPE: return (MODEKEYCMD_NEXTWORD); case '\031': return (MODEKEYCMD_PASTE); - case KEYC_ADDESC('v'): + case 'v' | KEYC_ESCAPE: case KEYC_PPAGE: return (MODEKEYCMD_PREVIOUSPAGE); - case KEYC_ADDESC('b'): + case 'b' | KEYC_ESCAPE: return (MODEKEYCMD_PREVIOUSWORD); case '\006': case KEYC_RIGHT: |