-
Notifications
You must be signed in to change notification settings - Fork 616
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
flush buffered keystrokes after external viewer #665
Conversation
Looks like this will fix #232 |
I misread, but hope to have found a fix for #232 because of this ticket. |
src/display.c
Outdated
@@ -64,6 +64,9 @@ open_external_viewer(const char *argv[], const char *dir, bool silent, bool conf | |||
fprintf(stderr, "%s", notice); | |||
fprintf(stderr, "Press Enter to continue"); | |||
getc(opt_tty); | |||
opt_tty = freopen(NULL, "r", opt_tty); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I read freopen(3)
correctly, the mode should be "w+"
to match how it is initially opened in pager mode:
Line 557 in 1f757f6
out_tty = no_display ? fopen("/dev/null", "w+") : opt_tty; |
Looks good to me, but I am not sure if this means that the terminal also needs to be reopened somehow. From my understanding of how |
Also somewhat related to the suspending cleanups in #657 |
c5f9b14
to
cb17007
Compare
Seeking to I missed #657 and haven't tested the interactions. |
Yes, that looks safer. |
by
reopening the TTYseeking toSEEK_END
. Otherwise keystrokes pressed prior to Enter hang around and can get read later.To reproduce:
:bind generic o !ls
q
unflushed