[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);
hist.next = nil;
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);
rename(tmp, path);
exit(0);

View File

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

View File

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