=== modified file 'driver-csi.c' --- driver-csi.c 2008-10-07 23:44:33 +0000 +++ driver-csi.c 2008-10-07 23:36:27 +0000 @@ -122,7 +122,7 @@ #define CHARAT(i) (tk->buffer[tk->buffstart + (i)]) -static termkey_result getkey_csi(termkey_t *tk, size_t introlen, termkey_key *key, int force) +static termkey_result getkey_csi(termkey_t *tk, size_t introlen, termkey_key *key) { termkey_csi *csi = tk->driver_info; @@ -135,7 +135,7 @@ } if(csi_end >= tk->buffcount) { - if(!force) + if(tk->waittime) return TERMKEY_RES_AGAIN; (*tk->method.emit_codepoint)(tk, '[', key); @@ -223,12 +223,12 @@ return TERMKEY_RES_KEY; } -static termkey_result getkey_ss3(termkey_t *tk, size_t introlen, termkey_key *key, int force) +static termkey_result getkey_ss3(termkey_t *tk, size_t introlen, termkey_key *key) { termkey_csi *csi = tk->driver_info; if(tk->buffcount < introlen + 1) { - if(!force) + if(tk->waittime) return TERMKEY_RES_AGAIN; (*tk->method.emit_codepoint)(tk, 'O', key); @@ -271,7 +271,7 @@ return TERMKEY_RES_KEY; } -static termkey_result getkey(termkey_t *tk, termkey_key *key, int force) +static termkey_result getkey(termkey_t *tk, termkey_key *key) { if(tk->buffcount == 0) return tk->is_closed ? TERMKEY_RES_EOF : TERMKEY_RES_NONE; @@ -283,7 +283,7 @@ if(tk->buffcount == 1) { // This might be an press, or it may want to be part of a longer // sequence - if(!force) + if(tk->waittime) return TERMKEY_RES_AGAIN; (*tk->method.emit_codepoint)(tk, b0, key); @@ -294,10 +294,10 @@ unsigned char b1 = CHARAT(1); if(b1 == '[') - return getkey_csi(tk, 2, key, force); + return getkey_csi(tk, 2, key); if(b1 == 'O') - return getkey_ss3(tk, 2, key, force); + return getkey_ss3(tk, 2, key); if(b1 == 0x1b) { (*tk->method.emit_codepoint)(tk, b0, key); @@ -325,10 +325,10 @@ return metakey_result; } else if(b0 == 0x8f) { - return getkey_ss3(tk, 1, key, force); + return getkey_ss3(tk, 1, key); } else if(b0 == 0x9b) { - return getkey_csi(tk, 1, key, force); + return getkey_csi(tk, 1, key); } else return (*tk->method.getkey_simple)(tk, key); === modified file 'termkey-internal.h' --- termkey-internal.h 2008-10-07 23:44:33 +0000 +++ termkey-internal.h 2008-10-07 23:36:27 +0000 @@ -10,7 +10,7 @@ { void *(*new_driver)(termkey_t *tk); void (*free_driver)(void *); - termkey_result (*getkey)(termkey_t *tk, termkey_key *key, int force); + termkey_result (*getkey)(termkey_t *tk, termkey_key *key); }; struct keyinfo { === modified file 'termkey.c' --- termkey.c 2008-10-07 23:44:33 +0000 +++ termkey.c 2008-10-07 23:36:27 +0000 @@ -363,12 +363,19 @@ termkey_result termkey_getkey(termkey_t *tk, termkey_key *key) { - return (*tk->driver.getkey)(tk, key, 0); + return (*tk->driver.getkey)(tk, key); } termkey_result termkey_getkey_force(termkey_t *tk, termkey_key *key) { - return (*tk->driver.getkey)(tk, key, 1); + int old_waittime = tk->waittime; + tk->waittime = 0; + + termkey_result ret = termkey_getkey(tk, key); + + tk->waittime = old_waittime; + + return ret; } termkey_result termkey_waitkey(termkey_t *tk, termkey_key *key)