diff options
Diffstat (limited to '')
| -rw-r--r-- | handlekeys.c | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/handlekeys.c b/handlekeys.c index f1fe56c..df18088 100644 --- a/handlekeys.c +++ b/handlekeys.c | |||
| @@ -177,7 +177,7 @@ static void handleSIGWINCH(int signalNumber) | |||
| 177 | } | 177 | } |
| 178 | 178 | ||
| 179 | void handle_keys(long extra, | 179 | void handle_keys(long extra, |
| 180 | int (*handle_sequence)(long extra, char *sequence), | 180 | int (*handle_sequence)(long extra, char *sequence, int isTranslated), |
| 181 | void (*handle_CSI)(long extra, char *command, int *params, int count)) | 181 | void (*handle_CSI)(long extra, char *command, int *params, int count)) |
| 182 | { | 182 | { |
| 183 | fd_set selectFds; | 183 | fd_set selectFds; |
| @@ -212,11 +212,6 @@ void handle_keys(long extra, | |||
| 212 | FD_SET(0, &selectFds); | 212 | FD_SET(0, &selectFds); |
| 213 | timeOut.tv_sec = 0; timeOut.tv_nsec = 100000000; // One tenth of a second. | 213 | timeOut.tv_sec = 0; timeOut.tv_nsec = 100000000; // One tenth of a second. |
| 214 | 214 | ||
| 215 | // TODO - A bit unstable at the moment, something makes it go into | ||
| 216 | // a horrid CPU eating edit line flicker mode sometimes. And / or vi mode | ||
| 217 | // can crash on exit (stack smash). | ||
| 218 | // This might be fixed now. | ||
| 219 | |||
| 220 | // We got a "terminal size changed" signal, ask the terminal | 215 | // We got a "terminal size changed" signal, ask the terminal |
| 221 | // how big it is now. | 216 | // how big it is now. |
| 222 | if (sigWinch) | 217 | if (sigWinch) |
| @@ -253,10 +248,6 @@ void handle_keys(long extra, | |||
| 253 | } | 248 | } |
| 254 | else if ((0 < p) && FD_ISSET(0, &selectFds)) | 249 | else if ((0 < p) && FD_ISSET(0, &selectFds)) |
| 255 | { | 250 | { |
| 256 | // I am assuming that we get the input atomically, each multibyte key | ||
| 257 | // fits neatly into one read. | ||
| 258 | // If that's not true (which is entirely likely), then we have to get | ||
| 259 | // complicated with circular buffers and stuff, or just one byte at a time. | ||
| 260 | j = read(0, &buffer[buffIndex], sizeof(buffer) - (buffIndex + 1)); | 251 | j = read(0, &buffer[buffIndex], sizeof(buffer) - (buffIndex + 1)); |
| 261 | if (j < 0) perror_exit("input error"); | 252 | if (j < 0) perror_exit("input error"); |
| 262 | else if (j == 0) // End of file. | 253 | else if (j == 0) // End of file. |
| @@ -412,10 +403,10 @@ void handle_keys(long extra, | |||
| 412 | char b[strlen(sequence) + strlen(buffer) + 1]; | 403 | char b[strlen(sequence) + strlen(buffer) + 1]; |
| 413 | 404 | ||
| 414 | sprintf(b, "%s%s", sequence, buffer); | 405 | sprintf(b, "%s%s", sequence, buffer); |
| 415 | if (handle_sequence(extra, b)) | 406 | if (handle_sequence(extra, b, (0 != sequence[0]))) |
| 416 | { | 407 | { |
| 417 | sequence[0] = 0; | ||
| 418 | buffer[0] = buffIndex = 0; | 408 | buffer[0] = buffIndex = 0; |
| 409 | sequence[0] = 0; | ||
| 419 | } | 410 | } |
| 420 | } | 411 | } |
| 421 | } | 412 | } |
