From 160db043cc285d9e32b17502ab0fbd897d7bf420 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Andr=C3=A9=20Tanner?= Date: Thu, 9 Jul 2015 15:37:02 +0200 Subject: ui: unify backspace handling --- config.def.h | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) (limited to 'config.def.h') diff --git a/config.def.h b/config.def.h index dff70d5..658a156 100644 --- a/config.def.h +++ b/config.def.h @@ -5,11 +5,6 @@ #define KEY(k) { .str = { '\0' }, .code = KEY_##k } #define CONTROL(k) NONE((k)&0x1F) #define META(k) { .str = { ESC, (k) }, .code = 0 } -#define BACKSPACE(func, name, arg) \ - { { KEY(BACKSPACE) }, (func), { .name = (arg) } }, \ - { { CONTROL('H') }, (func), { .name = (arg) } }, \ - { { NONE(127) }, (func), { .name = (arg) } }, \ - { { CONTROL('B') }, (func), { .name = (arg) } } /* a mode contains a set of key bindings which are currently valid. * @@ -98,7 +93,7 @@ static KeyBinding basic_movement[] = { }; static KeyBinding vis_movements[] = { - BACKSPACE( movement, i, MOVE_CHAR_PREV ), + { { KEY(BACKSPACE) }, movement, { .i = MOVE_CHAR_PREV } }, { { NONE('h') }, movement, { .i = MOVE_CHAR_PREV } }, { { NONE(' ') }, movement, { .i = MOVE_CHAR_NEXT } }, { { NONE('l') }, movement, { .i = MOVE_CHAR_NEXT } }, @@ -424,7 +419,7 @@ static KeyBinding vis_mode_normal[] = { }; static KeyBinding vis_mode_visual[] = { - BACKSPACE( operator, i, OP_DELETE ), + { { KEY(BACKSPACE) }, operator, { .i = OP_DELETE } }, { { KEY(DC) }, operator, { .i = OP_DELETE } }, { { NONE(ESC) }, switchmode, { .i = VIS_MODE_NORMAL } }, { { CONTROL('c') }, switchmode, { .i = VIS_MODE_NORMAL } }, @@ -483,7 +478,7 @@ static void vis_mode_visual_line_leave(Mode *new) { } static KeyBinding vis_mode_readline[] = { - BACKSPACE( call, f, editor_backspace_key ), + { { KEY(BACKSPACE) }, call, { .f = editor_backspace_key } }, { { NONE(ESC) }, switchmode, { .i = VIS_MODE_NORMAL } }, { { CONTROL('c') }, switchmode, { .i = VIS_MODE_NORMAL } }, { { CONTROL('D') }, delete , { .i = MOVE_CHAR_NEXT } }, @@ -493,7 +488,7 @@ static KeyBinding vis_mode_readline[] = { }; static KeyBinding vis_mode_prompt[] = { - BACKSPACE( prompt_backspace, s, NULL ), + { { KEY(BACKSPACE) }, prompt_backspace,{ .s = NULL } }, { { KEY(ENTER) }, prompt_enter, { NULL } }, { { CONTROL('J') }, prompt_enter, { NULL } }, { { KEY(UP) }, prompt_up, { NULL } }, -- cgit v1.2.3