-
-
Notifications
You must be signed in to change notification settings - Fork 420
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
exit on first keystroke should print the keystroke on the terminal #25
Comments
That seems an ideal feature... |
I've never thought of this, and thanks to hstr, the only program that I know that can do this, it needs that, so user can edit command in shell prompt and execute command by the shell. After found out how hstr does it, I wrote the following piece of code: ungetch(keypress);
char *buf = malloc(1);
char *p = buf;
while ((*p++ = wgetch(stdscr)) != ERR) {
buf = realloc(buf, sizeof(buf) + 1);
}
*(p - 1) = 0;
p = buf;
while (*p) {
ioctl(0, TIOCSTI, p++);
}
free(buf); Put them before Lines 477 to 479 in 93fd357
The code can be reduced down to one line if we only consider human typing or single character, the code above will make sure whatever in standard input will be carried over via
While trying to read about the magic of Nonetheless, do we actually need this feature for not being able to press an extra key that is destined to be forgotten? Frankly, I would vote against this feature, it's cool, but not worth all the extra codes in my opinion. |
We can do that just before exiting after the terminal has been cleared. It's really easy. |
Pass an argument (character) to finish. See the screensaver switch case inside the on character press selection section. |
@abishekvashok then you should be the one to do it. This issue got me a thought, if we would be doing this, why not go all the way, that is mouse as well. The But again, against it, because more codes, that's why I am not opening a feature request, @abishekvashok or anyone think it's good, it's your issue to open. |
Pull request #67 implements this functionality. |
This feature does not seem to work when building with cmake at head. Anyone else have this problem? |
The -s: option activates the "Screensaver" mode, with exits on first keystroke.
This is nice but the keystroke is not recorded on the terminal. So if for example user wants to type "git" the first character
g
should be recorded and when learning the screen from matrix, g should be present on the terminal along with whatever other characters the user has typed.The text was updated successfully, but these errors were encountered: