-
Notifications
You must be signed in to change notification settings - Fork 86
Open
Description
in editorReadKey function, there is a while statement
while ((nread = read(STDIN_FILENO, &c, 1)) != 1) {
if (nread == -1 && errno != EAGAIN) die("read");
}and when I transform it into
while(true) {
nread = read(STDIN_FILENO, &c, 1);
if(nread != 1) {
if(nread == -1 && errno != EAGAIN) {
die("read");
} else {
break;
}
} else {
break;
}
}or
nread = read(STDIN_FILENO, &c, 1);
if(nread == -1 && errno != EAGAIN) {
die("read");
}but I found that the cursor move too slow when press the arrow key one by one, here is the example using my while statement, comparing the origin while statement
2021-12-06.13-51-47.mp4
what is the wrong with my code ??
Metadata
Metadata
Assignees
Labels
No labels