From 23b81fac4671d65b58d989c76780d8aaa31690d4 Mon Sep 17 00:00:00 2001 From: Ilia Maslakov Date: Mon, 28 Sep 2009 15:39:11 +0000 Subject: [PATCH] fix: default_input_keymap, remove incorrect entry fix: parsing keymap string with "backslash" Signed-off-by: Ilia Maslakov --- src/keybind.c | 41 +++++++++++++++++++++++++++++++++++++++++ src/keybind.h | 1 + src/tty/key.c | 20 +++++++++++--------- src/widget.c | 43 ------------------------------------------- 4 files changed, 53 insertions(+), 52 deletions(-) diff --git a/src/keybind.c b/src/keybind.c index 799e25c4f..f362f586f 100644 --- a/src/keybind.c +++ b/src/keybind.c @@ -642,6 +642,47 @@ const global_key_map_t default_main_x_map[] = { {0, 0} }; +const global_key_map_t default_input_keymap[] = { + /* Motion */ + { XCTRL('a'), CK_InputBol }, + { KEY_HOME, CK_InputBol }, + { KEY_A1, CK_InputBol }, + { ALT ('<'), CK_InputBol }, + { XCTRL('e'), CK_InputEol }, + { KEY_END, CK_InputEol }, + { KEY_C1, CK_InputEol }, + { ALT ('>'), CK_InputEol }, + { KEY_LEFT, CK_InputMoveLeft }, + { KEY_LEFT | KEY_M_CTRL, CK_InputWordLeft }, + { KEY_RIGHT, CK_InputMoveRight }, + { KEY_RIGHT | KEY_M_CTRL, CK_InputWordRight }, + + { XCTRL('b'), CK_InputBackwardChar }, + { ALT('b'), CK_InputBackwardWord }, + { XCTRL('f'), CK_InputForwardChar }, + { ALT('f'), CK_InputForwardWord }, + + /* Editing */ + { KEY_BACKSPACE, CK_InputBackwardDelete }, + { KEY_DC, CK_InputDeleteChar }, + { ALT('d'), CK_InputKillWord }, + { ALT(KEY_BACKSPACE), CK_InputBackwardKillWord }, + + /* Region manipulation */ + { XCTRL('w'), CK_InputKillRegion }, + { ALT('w'), CK_InputKillSave }, + { XCTRL('y'), CK_InputYank }, + { XCTRL('k'), CK_InputKillLine }, + + /* History */ + { ALT('p'), CK_InputHistoryPrev }, + { ALT('n'), CK_InputHistoryNext }, + { ALT('h'), CK_InputHistoryShow }, + + /* Completion */ + { ALT('\t'), CK_InputComplete }, + { 0, 0 } +}; int lookup_action (char *keyname) diff --git a/src/keybind.h b/src/keybind.h index 6960f5113..5bb65d4c4 100644 --- a/src/keybind.h +++ b/src/keybind.h @@ -47,3 +47,4 @@ extern const global_key_map_t default_input_keymap[]; extern const global_key_map_t default_main_map[]; extern const global_key_map_t default_main_x_map[]; +const global_key_map_t default_input_keymap[]; diff --git a/src/tty/key.c b/src/tty/key.c index c2ba6f582..74dccf9c4 100644 --- a/src/tty/key.c +++ b/src/tty/key.c @@ -130,7 +130,8 @@ key_code_name_t key_name_conv_tab[] = { {ALT ('\t'), "complete", N_("Completion/M-tab")}, {KEY_KP_ADD, "kpplus", N_("+ on keypad")}, {KEY_KP_SUBTRACT, "kpminus", N_("- on keypad")}, - {KEY_KP_MULTIPLY, "kpasterix", N_("* on keypad")}, + {(int) '/', "kpslash", N_("Slash on keypad")}, + {KEY_KP_MULTIPLY, "kpasterisk", N_("* on keypad")}, /* From here on, these won't be shown in Learn keys (no space) */ {KEY_LEFT, "kpleft", N_("Left arrow keypad")}, @@ -144,18 +145,19 @@ key_code_name_t key_name_conv_tab[] = { {KEY_IC, "kpinsert", N_("Insert on keypad")}, {KEY_DC, "kpdelete", N_("Delete on keypad")}, {(int) '\n', "kpenter", N_("Enter on keypad")}, - {(int) '\n', "enter", N_("Enter on keypad")}, - {(int) '\t', "tab", N_("Tab on keypad")}, - {(int) ' ', "space", N_("Space on keypad")}, - {(int) '/', "kpslash", N_("Slash on keypad")}, - {(int) '#', "kpnumlock", N_("NumLock on keypad")}, /* Alternative label */ {KEY_BACKSPACE, "backspace", N_("Backspace key")}, {KEY_IC, "insert", N_("Insert key")}, - {KEY_KP_ADD, "plus", N_("+ on keypad")}, - {KEY_KP_SUBTRACT, "minus", N_("- on keypad")}, - {KEY_KP_MULTIPLY, "asterix", N_("* on keypad")}, + {(int) '+', "plus", N_("Plus")}, + {(int) '-', "minus", N_("Minus")}, + {(int) '*', "asterisk", N_("Asterisk")}, + {(int) '\n', "enter", N_("Enter")}, + {(int) '\t', "tab", N_("Tab key")}, + {(int) ' ', "space", N_("Space key")}, + {(int) '/', "slash", N_("Slash key")}, + {(int) '\\', "backslash", N_("Backslash key")}, + {(int) '#', "number", N_("Number sign #")}, /* meta keys */ {KEY_M_CTRL, "control", N_("Ctrl")}, diff --git a/src/widget.c b/src/widget.c index c577dc80d..96beaff88 100644 --- a/src/widget.c +++ b/src/widget.c @@ -61,49 +61,6 @@ const global_key_map_t *input_map; -const global_key_map_t default_input_keymap[] = { - /* Motion */ - { XCTRL('a'), CK_InputBol }, - { KEY_HOME, CK_InputBol }, - { KEY_A1, CK_InputBol }, - { ALT ('<'), CK_InputBol }, - { XCTRL('e'), CK_InputEol }, - { KEY_END, CK_InputEol }, - { KEY_C1, CK_InputEol }, - { ALT ('>'), CK_InputEol }, - { KEY_LEFT, CK_InputMoveLeft }, - { KEY_LEFT | KEY_M_CTRL, CK_InputWordLeft }, - { KEY_RIGHT, CK_InputMoveRight }, - { KEY_RIGHT | KEY_M_CTRL, CK_InputWordRight }, - - { XCTRL('b'), CK_InputBackwardChar }, - { ALT('b'), CK_InputBackwardWord }, - { XCTRL('f'), CK_InputForwardChar }, - { ALT('f'), CK_InputForwardWord }, - - /* Editing */ - { KEY_BACKSPACE, CK_InputBackwardDelete }, - { KEY_DC, CK_InputDeleteChar }, - { ALT('d'), CK_InputKillWord }, - { ALT(KEY_BACKSPACE), CK_InputBackwardKillWord }, - - /* Region manipulation */ - { 0, CK_InputSetMark }, - { XCTRL('w'), CK_InputKillRegion }, - { ALT('w'), CK_InputKillSave }, - { XCTRL('y'), CK_InputYank }, - { XCTRL('k'), CK_InputKillLine }, - - /* History */ - { ALT('p'), CK_InputHistoryPrev }, - { ALT('n'), CK_InputHistoryNext }, - { ALT('h'), CK_InputHistoryShow }, - - /* Completion */ - { ALT('\t'), CK_InputComplete }, - { 0, 0 } -}; - static void widget_selectcolor (Widget *w, gboolean focused, gboolean hotkey) {