Merge pull request #1 from cronyakatsuki/ext-kp

extended numpad support.
This commit is contained in:
CronyAkatsuki 2022-07-21 15:23:16 +00:00 committed by GitHub
commit 0f9f6f0ea0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

10
dmenu.c
View File

@ -429,9 +429,11 @@ keypress(XKeyEvent *ev)
utf8, utf8, win, CurrentTime); utf8, utf8, win, CurrentTime);
return; return;
case XK_Left: case XK_Left:
case XK_KP_Left:
movewordedge(-1); movewordedge(-1);
goto draw; goto draw;
case XK_Right: case XK_Right:
case XK_KP_Right:
movewordedge(+1); movewordedge(+1);
goto draw; goto draw;
case XK_Return: case XK_Return:
@ -479,6 +481,7 @@ insert:
insert(NULL, nextrune(-1) - cursor); insert(NULL, nextrune(-1) - cursor);
break; break;
case XK_End: case XK_End:
case XK_KP_End:
if (text[cursor] != '\0') { if (text[cursor] != '\0') {
cursor = strlen(text); cursor = strlen(text);
break; break;
@ -498,6 +501,7 @@ insert:
cleanup(); cleanup();
exit(1); exit(1);
case XK_Home: case XK_Home:
case XK_KP_Home:
if (sel == matches) { if (sel == matches) {
cursor = 0; cursor = 0;
break; break;
@ -506,6 +510,7 @@ insert:
calcoffsets(); calcoffsets();
break; break;
case XK_Left: case XK_Left:
case XK_KP_Left:
if (cursor > 0 && (!sel || !sel->left || lines > 0)) { if (cursor > 0 && (!sel || !sel->left || lines > 0)) {
cursor = nextrune(-1); cursor = nextrune(-1);
break; break;
@ -514,18 +519,21 @@ insert:
return; return;
/* fallthrough */ /* fallthrough */
case XK_Up: case XK_Up:
case XK_KP_Up:
if (sel && sel->left && (sel = sel->left)->right == curr) { if (sel && sel->left && (sel = sel->left)->right == curr) {
curr = prev; curr = prev;
calcoffsets(); calcoffsets();
} }
break; break;
case XK_Next: case XK_Next:
case XK_KP_Next:
if (!next) if (!next)
return; return;
sel = curr = next; sel = curr = next;
calcoffsets(); calcoffsets();
break; break;
case XK_Prior: case XK_Prior:
case XK_KP_Prior:
if (!prev) if (!prev)
return; return;
sel = curr = prev; sel = curr = prev;
@ -542,6 +550,7 @@ insert:
sel->out = 1; sel->out = 1;
break; break;
case XK_Right: case XK_Right:
case XK_KP_Right:
if (text[cursor] != '\0') { if (text[cursor] != '\0') {
cursor = nextrune(+1); cursor = nextrune(+1);
break; break;
@ -550,6 +559,7 @@ insert:
return; return;
/* fallthrough */ /* fallthrough */
case XK_Down: case XK_Down:
case XK_KP_Down:
if (sel && sel->right && (sel = sel->right) == next) { if (sel && sel->right && (sel = sel->right) == next) {
curr = next; curr = next;
calcoffsets(); calcoffsets();