diff options
author | Rob Landley <rob@landley.net> | 2008-10-19 04:21:21 +0000 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2008-10-19 04:21:21 +0000 |
commit | 4bdeaaf556043964d7d772b492882a6835eb4622 (patch) | |
tree | ff9e61b187bb68c38141c213f9fa550a31525f03 | |
parent | e3742f4217e46f42c4f0506c23b04b84fc31e7ad (diff) | |
download | busybox-4bdeaaf556043964d7d772b492882a6835eb4622.tar.gz |
Comment and whitespace tweaks.
-rw-r--r-- | editors/vi.c | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/editors/vi.c b/editors/vi.c index 8944f770a..50dda7f3a 100644 --- a/editors/vi.c +++ b/editors/vi.c @@ -2243,11 +2243,9 @@ static char readit(void) // read (maybe cursor) key from stdin n = chars_to_parse; if (n == 0) { - // If no data, block waiting for input. - // Can't read more than minimal ESC sequence size - - // see "n = 0" below. Example of mishandled - // sequence if we read 4 chars here: "ESC O A ESC O A". - // We'll read "ESC O A ESC" and lose second ESC! + // If no data, block waiting for input. (If we read more than the + // minimal ESC sequence size, the "n=0" below would instead have to + // figure out how much to keep, resulting in larger code.) n = safe_read(0, readbuffer, 3); if (n <= 0) { error: @@ -2272,7 +2270,8 @@ static char readit(void) // read (maybe cursor) key from stdin pfd.fd = STDIN_FILENO; pfd.events = POLLIN; - for (eindex = esccmds; eindex < esccmds + ARRAY_SIZE(esccmds); eindex++) { + for (eindex = esccmds; eindex < esccmds + ARRAY_SIZE(esccmds); eindex++) + { // n - position in sequence we did not read yet int i = 0; // position in sequence to compare @@ -2286,10 +2285,7 @@ static char readit(void) // read (maybe cursor) key from stdin // Timeout is needed to reconnect escape sequences // split up by transmission over a serial console. - // Even though inter-char delay on 1200 baud is <10ms, - // process scheduling can enlarge it arbitrarily, - // on both send and receive sides. - // Erring on the safe side - 5 timer ticks on 100 HZ. + if (safe_poll(&pfd, 1, 50)) { if (safe_read(0, readbuffer + n, 1) <= 0) goto error; |