[menu] Fix numeric keypad input. Closes issue #213.

This commit is contained in:
Kris Maglione 2010-07-31 16:20:51 -04:00
parent 05053cb995
commit 26bd6db557
3 changed files with 7 additions and 4 deletions

View File

@ -82,7 +82,10 @@ history_dump(const char *path, int max) {
Binit(&b, fd, OWRITE); Binit(&b, fd, OWRITE);
hist.next = nil; hist.next = nil;
for(h=first; h; h=h->next) for(h=first; h; h=h->next)
Bprint(&b, "%s\n", h->string); if(Bprint(&b, "%s\n", h->string) < 0) {
unlink(tmp);
exit(1);
}
Bterm(&b); Bterm(&b);
rename(tmp, path); rename(tmp, path);
exit(0); exit(0);

View File

@ -265,8 +265,9 @@ kdown_event(Window *w, void *aux, XKeyEvent *e) {
int num; int num;
KeySym ksym; KeySym ksym;
buf[0] = 0; buf[0] = '\0';
num = XLookupString(e, buf, sizeof buf, &ksym, 0); num = XLookupString(e, buf, sizeof buf, &ksym, 0);
buf[num] = '\0';
key = XKeysymToString(ksym); key = XKeysymToString(ksym);
if(IsKeypadKey(ksym)) if(IsKeypadKey(ksym))
if(ksym == XK_KP_Enter) if(ksym == XK_KP_Enter)

View File

@ -907,13 +907,12 @@ msg_nudge(View *v, IxpMsg *m) {
void void
msg_parsecolors(IxpMsg *m, CTuple *col) { msg_parsecolors(IxpMsg *m, CTuple *col) {
CTuple tpl; CTuple tpl;
static char Ebad[] = "bad color string";
char n; char n;
n = loadcolor(&tpl, m->pos, m->end); n = loadcolor(&tpl, m->pos, m->end);
m->pos += n; m->pos += n;
if(n == 0 || msg_getword(m, nil)) if(n == 0 || msg_getword(m, nil))
error(Ebad); error("bad color string");
*col = tpl; *col = tpl;
} }