mirror of
https://github.com/sheumann/hush.git
synced 2024-12-22 14:30:31 +00:00
vi: explain why reading 4 chars is unsafe
This commit is contained in:
parent
3ab3d8a5cf
commit
e3742f4217
@ -2243,9 +2243,11 @@ static char readit(void) // read (maybe cursor) key from stdin
|
|||||||
|
|
||||||
n = chars_to_parse;
|
n = chars_to_parse;
|
||||||
if (n == 0) {
|
if (n == 0) {
|
||||||
// If no data, block waiting for input
|
// If no data, block waiting for input.
|
||||||
// (can't read more than minimal ESC sequence -
|
// Can't read more than minimal ESC sequence size -
|
||||||
// see "n = 0" below).
|
// 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!
|
||||||
n = safe_read(0, readbuffer, 3);
|
n = safe_read(0, readbuffer, 3);
|
||||||
if (n <= 0) {
|
if (n <= 0) {
|
||||||
error:
|
error:
|
||||||
|
Loading…
Reference in New Issue
Block a user