From 974a8595ed3c09ccef62df7e3748baddb9038d8e Mon Sep 17 00:00:00 2001 From: Guillermo Ramos Date: Sun, 18 Sep 2011 17:08:35 +0200 Subject: Fixed backspace bug --- evspy-core.h | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) (limited to 'evspy-core.h') diff --git a/evspy-core.h b/evspy-core.h index 0613b9f..97e9660 100644 --- a/evspy-core.h +++ b/evspy-core.h @@ -18,6 +18,11 @@ #include "maps/maps.h" +// Event values +#define EVS_VAL_FREE 0 +#define EVS_VAL_PRESS 1 +#define EVS_VAL_HOLD 2 + #define MIN(x, y) (x) < (y) ? (x) : (y) /* @@ -65,6 +70,18 @@ evs_decp(rdp); \ }) +/* + * Try to delete the last char inserted. If it is a special key ("[KEY]"), + * insert "[<<]" instead + */ +#define evs_backspace() \ +({ \ + if (*(wrp-1) != ']') \ + evs_delete(); \ + else \ + special_char(KEY_BACKSPACE, EVS_VAL_PRESS); \ +}) + /* * Is the c event code associated to any of the FX buttons? */ @@ -91,8 +108,3 @@ } \ __c; \ }) - -// Event values -#define EVS_VAL_FREE 0 -#define EVS_VAL_PRESS 1 -#define EVS_VAL_HOLD 2 -- cgit v1.2.3