From 3ca012c4eaed2fee86c3be5bd609250e0946980c Mon Sep 17 00:00:00 2001 From: "Michael D. Lowis" Date: Mon, 28 Nov 2016 13:41:15 -0500 Subject: [PATCH] Cleaned up keybindings a bit. Grouped into categories --- xedit.c | 39 +++++++++++++++++++++++++++------------ 1 file changed, 27 insertions(+), 12 deletions(-) diff --git a/xedit.c b/xedit.c index 38458a7..f6a81fb 100644 --- a/xedit.c +++ b/xedit.c @@ -100,25 +100,40 @@ void (*MouseActs[MOUSE_BTN_COUNT])(enum RegionId id, size_t count, size_t row, s [MOUSE_BTN_WHEELDOWN] = mouse_wheeldn, }; -static KeyBinding Insert[] = { +static KeyBinding Bindings[] = { + /* Function Keys */ + //{ KEY_CTRL_F1, welcome }, + + /* Standard Unix Shortcuts */ + //{ KEY_CTRL_U, del_to_bol }, + //{ KEY_CTRL_W, del_to_bow }, + //{ KEY_CTRL_H, del_prev_char}, + { KEY_CTRL_A, cursor_bol }, + { KEY_CTRL_E, cursor_eol }, + + /* Standard Text Editing Shortcuts */ + { KEY_CTRL_S, save }, + { KEY_CTRL_Z, undo }, + { KEY_CTRL_Y, redo }, + { KEY_CTRL_X, cut }, + { KEY_CTRL_C, copy }, + { KEY_CTRL_V, paste }, + + /* Common Special Keys */ { KEY_DELETE, delete }, - { KEY_UP, cursor_up }, - { KEY_DOWN, cursor_dn }, - { KEY_LEFT, cursor_left }, - { KEY_RIGHT, cursor_right }, { KEY_HOME, cursor_bol }, { KEY_END, cursor_eol }, { KEY_PGUP, page_up }, { KEY_PGDN, page_dn }, + { KEY_UP, cursor_up }, + { KEY_DOWN, cursor_dn }, + { KEY_LEFT, cursor_left }, + { KEY_RIGHT, cursor_right }, + + /* Implementation Specific */ { KEY_ESCAPE, select_prev }, { KEY_CTRL_T, change_focus }, { KEY_CTRL_Q, quit }, - { KEY_CTRL_S, save }, - { KEY_CTRL_Z, undo }, - { KEY_CTRL_Y, redo }, - { KEY_CTRL_X, cut }, - { KEY_CTRL_C, copy }, - { KEY_CTRL_V, paste }, { KEY_CTRL_F, search }, { KEY_CTRL_E, execute }, { 0, NULL } @@ -195,7 +210,7 @@ static void key_handler(Rune key) { if (key == '\r') key = '\n'; if (key == '\n' && currview()->buffer.crlf) key = RUNE_CRLF; /* handle the key */ - KeyBinding* bindings = Insert; + KeyBinding* bindings = Bindings; while (bindings->key) { if (key == bindings->key) { bindings->action(); -- 2.54.0