diff options
author | Connor Lane Smith | 2010-06-20 15:04:15 +0100 |
---|---|---|
committer | Connor Lane Smith | 2010-06-20 15:04:15 +0100 |
commit | 9a33a72c6afd9042c8395f4318bf5d21e235694d (patch) | |
tree | 4542dfa5c7bff1c81d728afa334eef0a78e2fca7 /dmenu.c | |
parent | 97797d90a6396c2fc0109a7bd47bb260d1143c8a (diff) |
updated manpage, changed keybinds
M- binds tend to be wm level, and there were up to 3 binds for the same action
M-{hjkl} also no longer made sense in vlist mode
Diffstat (limited to 'dmenu.c')
-rw-r--r-- | dmenu.c | 84 |
1 files changed, 39 insertions, 45 deletions
@@ -355,17 +355,23 @@ kpress(XKeyEvent * e) { /* first check if a control mask is omitted */ if(e->state & ControlMask) { switch(tolower(ksym)) { - default: /* ignore other control sequences */ + default: return; case XK_a: ksym = XK_Home; break; + case XK_b: + ksym = XK_Left; + break; case XK_c: ksym = XK_Escape; break; case XK_e: ksym = XK_End; break; + case XK_f: + ksym = XK_Right; + break; case XK_h: ksym = XK_BackSpace; break; @@ -378,6 +384,12 @@ kpress(XKeyEvent * e) { case XK_k: text[cursor] = '\0'; break; + case XK_n: + ksym = XK_Down; + break; + case XK_p: + ksym = XK_Up; + break; case XK_u: memmove(text, text + cursor, sizeof text - cursor + 1); cursor = 0; @@ -393,31 +405,7 @@ kpress(XKeyEvent * e) { match(text); } break; - } - } - if(CLEANMASK(e->state) & Mod1Mask) { - switch(ksym) { - default: - return; - case XK_h: - ksym = XK_Left; - break; - case XK_l: - ksym = XK_Right; - break; - case XK_j: - ksym = XK_Next; - break; - case XK_k: - ksym = XK_Prior; - break; - case XK_g: - ksym = XK_Home; - break; - case XK_G: - ksym = XK_End; - break; - case XK_p: + case XK_y: { FILE *fp; char *s; @@ -453,6 +441,8 @@ kpress(XKeyEvent * e) { match(text); break; case XK_Delete: + if(cursor == len) + return; for(i = 1; cursor + i < len && !IS_UTF8_1ST_CHAR(text[cursor + i]); i++); memmove(text + cursor, text + cursor + i, sizeof text - cursor); match(text); @@ -482,18 +472,20 @@ kpress(XKeyEvent * e) { calcoffsets(); break; case XK_Left: - case XK_Up: - if(sel && sel->left){ - sel = sel->left; - if(sel->right == curr) { - curr = prev; - calcoffsets(); - } - } - else if(cursor > 0) + if(cursor > 0 && (!sel || !sel->left)) { while(cursor-- > 0 && !IS_UTF8_1ST_CHAR(text[cursor])); - else + break; + } + if(lines > 0) return; + case XK_Up: + if(!sel || !sel->left) + return; + sel = sel->left; + if(sel->right == curr) { + curr = prev; + calcoffsets(); + } break; case XK_Next: if(!next) @@ -516,18 +508,20 @@ kpress(XKeyEvent * e) { running = False; return; case XK_Right: - case XK_Down: - if(cursor < len) + if(cursor < len) { while(cursor++ < len && !IS_UTF8_1ST_CHAR(text[cursor])); - else if(sel && sel->right) { - sel = sel->right; - if(sel == next) { - curr = next; - calcoffsets(); - } + break; } - else + if(lines > 0) + return; + case XK_Down: + if(!sel || !sel->right) return; + sel = sel->right; + if(sel == next) { + curr = next; + calcoffsets(); + } break; case XK_Tab: if(!sel) |