cleaned up

This commit is contained in:
Connor Lane Smith 2010-06-20 01:19:17 +01:00
parent 4983707c70
commit 97797d90a6

11
dmenu.c
View File

@ -354,45 +354,36 @@ kpress(XKeyEvent * e) {
return; return;
/* first check if a control mask is omitted */ /* first check if a control mask is omitted */
if(e->state & ControlMask) { if(e->state & ControlMask) {
switch (ksym) { switch(tolower(ksym)) {
default: /* ignore other control sequences */ default: /* ignore other control sequences */
return; return;
case XK_a: case XK_a:
case XK_A:
ksym = XK_Home; ksym = XK_Home;
break; break;
case XK_c: case XK_c:
case XK_C:
ksym = XK_Escape; ksym = XK_Escape;
break; break;
case XK_e: case XK_e:
case XK_E:
ksym = XK_End; ksym = XK_End;
break; break;
case XK_h: case XK_h:
case XK_H:
ksym = XK_BackSpace; ksym = XK_BackSpace;
break; break;
case XK_i: case XK_i:
case XK_I:
ksym = XK_Tab; ksym = XK_Tab;
break; break;
case XK_j: case XK_j:
case XK_J:
ksym = XK_Return; ksym = XK_Return;
break; break;
case XK_k: case XK_k:
case XK_K:
text[cursor] = '\0'; text[cursor] = '\0';
break; break;
case XK_u: case XK_u:
case XK_U:
memmove(text, text + cursor, sizeof text - cursor + 1); memmove(text, text + cursor, sizeof text - cursor + 1);
cursor = 0; cursor = 0;
match(text); match(text);
break; break;
case XK_w: case XK_w:
case XK_W:
if(cursor > 0) { if(cursor > 0) {
i = cursor; i = cursor;
while(i-- > 0 && text[i] == ' '); while(i-- > 0 && text[i] == ' ');