-
-
Notifications
You must be signed in to change notification settings - Fork 144
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
missing echo after ctrl-v paste of command #72
Comments
I think it is because the As a workaround, I added another class LinuxKeyboard : public InputDevice {
~LinuxKeyboard() {
// ...
close(pipe_fd[0]);
close(pipe_fd[1]);
}
void Read() {
// open a pipe
if(pipe(pipe_fd) < 0) ;
// ...
}
std::pair<KeyType,char> Get() {
// ...
default: // ascii
{
const char c = static_cast<char>(ch);
// there might be many to Get()
write(pipe_fd[1], "x", 1); // to trigger `select() on pipe_fd[0]
return std::make_pair(KeyType::ascii,c);
}
}
int KbHit() { // change to non-static
// ...
FD_SET(pipe_fd[0], &rdfs);
select(pipe_fd[0]+1, &rdfs, NULL, NULL, &tv);
return FD_ISSET(STDIN_FILENO, &rdfs) || FD_ISSET(pipe_fd[0], &rdfs);
}
int pipe_fd[2]
// ... other data member I thought this might help. As an another workaround, how about change the interface from |
maybe a dumb question: why do we even need to wait for keyboard hit? |
As described in #70 , it is somewhat weird when paste something to runtime
cli
usingctrl-v
, the whole content would not echo until a next keyboard is triggered.The text was updated successfully, but these errors were encountered: