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-w32-4bdeaaf556043964d7d772b492882a6835eb4622.tar.gz busybox-w32-4bdeaaf556043964d7d772b492882a6835eb4622.tar.bz2 busybox-w32-4bdeaaf556043964d7d772b492882a6835eb4622.zip |
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 | |||
2243 | 2243 | ||
2244 | n = chars_to_parse; | 2244 | n = chars_to_parse; |
2245 | if (n == 0) { | 2245 | if (n == 0) { |
2246 | // If no data, block waiting for input. | 2246 | // If no data, block waiting for input. (If we read more than the |
2247 | // Can't read more than minimal ESC sequence size - | 2247 | // minimal ESC sequence size, the "n=0" below would instead have to |
2248 | // see "n = 0" below. Example of mishandled | 2248 | // figure out how much to keep, resulting in larger code.) |
2249 | // sequence if we read 4 chars here: "ESC O A ESC O A". | ||
2250 | // We'll read "ESC O A ESC" and lose second ESC! | ||
2251 | n = safe_read(0, readbuffer, 3); | 2249 | n = safe_read(0, readbuffer, 3); |
2252 | if (n <= 0) { | 2250 | if (n <= 0) { |
2253 | error: | 2251 | error: |
@@ -2272,7 +2270,8 @@ static char readit(void) // read (maybe cursor) key from stdin | |||
2272 | 2270 | ||
2273 | pfd.fd = STDIN_FILENO; | 2271 | pfd.fd = STDIN_FILENO; |
2274 | pfd.events = POLLIN; | 2272 | pfd.events = POLLIN; |
2275 | for (eindex = esccmds; eindex < esccmds + ARRAY_SIZE(esccmds); eindex++) { | 2273 | for (eindex = esccmds; eindex < esccmds + ARRAY_SIZE(esccmds); eindex++) |
2274 | { | ||
2276 | // n - position in sequence we did not read yet | 2275 | // n - position in sequence we did not read yet |
2277 | int i = 0; // position in sequence to compare | 2276 | int i = 0; // position in sequence to compare |
2278 | 2277 | ||
@@ -2286,10 +2285,7 @@ static char readit(void) // read (maybe cursor) key from stdin | |||
2286 | 2285 | ||
2287 | // Timeout is needed to reconnect escape sequences | 2286 | // Timeout is needed to reconnect escape sequences |
2288 | // split up by transmission over a serial console. | 2287 | // split up by transmission over a serial console. |
2289 | // Even though inter-char delay on 1200 baud is <10ms, | 2288 | |
2290 | // process scheduling can enlarge it arbitrarily, | ||
2291 | // on both send and receive sides. | ||
2292 | // Erring on the safe side - 5 timer ticks on 100 HZ. | ||
2293 | if (safe_poll(&pfd, 1, 50)) { | 2289 | if (safe_poll(&pfd, 1, 50)) { |
2294 | if (safe_read(0, readbuffer + n, 1) <= 0) | 2290 | if (safe_read(0, readbuffer + n, 1) <= 0) |
2295 | goto error; | 2291 | goto error; |