diff --git a/include/Mw/LowLevel.h b/include/Mw/LowLevel.h index c0a1617..056c216 100644 --- a/include/Mw/LowLevel.h +++ b/include/Mw/LowLevel.h @@ -37,8 +37,9 @@ typedef void* MwLLPixmap; #define MwLLDispatch(x, y, z) \ if(x->handler != NULL && x->handler->y != NULL) x->handler->y(x, z) +#define MwLLKeyMask (1 << 31) enum MwLLKeyEnum { - MwLLKeyBackSpace = (1 << 31) | 1, + MwLLKeyBackSpace = MwLLKeyMask | 1, MwLLKeyLeft, MwLLKeyRight, MwLLKeyUp, diff --git a/src/widget/entry.c b/src/widget/entry.c index 79ebfaf..20162cc 100644 --- a/src/widget/entry.c +++ b/src/widget/entry.c @@ -100,7 +100,7 @@ static void key(MwWidget handle, int code) { } else if(code == MwLLKeyRight) { if(t->cursor == MwUTF8Length(str)) return; t->cursor++; - } else { + } else if(!(code & MwLLKeyMask)) { int incr = 0; out = malloc(strlen(str) + 5 + 1); incr += MwUTF8Copy(str, 0, out, 0, t->cursor);