Skip to content
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

Force all input through buffer unless flushing buffer. #2754

Merged
merged 2 commits into from
Sep 9, 2020

Conversation

Dunbaratu
Copy link
Member

Fixes #2753 (I hope - I can't test it because I couldn't cause the bug in the first place - I need @JonnyOThan to test it for me.)

Now the only input that is allowed to immediately get
sent to the interpreter is that which came FROM the
buffer flusher routine ProcessUnconsmedInput(). It
uses flags that allow its input to come through
directly, but everything else that types input is
now required to queue it (so it will pass through
ProcessUnconsumedInput() a moment later). Hypothetically
this should fix the ability for input to skip the buffer
and jump in line.

The one exception is the immediate characters related
to terminal closing or program interruption like CTRL-C.
They are allowed to jump in out of order and happen immediately.
And in the case of CTRL-C, it also flushes whatever was in the
buffer so if you typed anything ahead it will no longer
get executed after a CTRL-C like it used to.

Fixes KSP-KOS#2753 (I hope - I can't test it.)

Now the only input that is allowed to immediately get
sent to the interpreter is that which came FROM the
buffer flusher routine ProcessUnconsmedInput().  It
uses flags that allow its input to come through
directly, but *everything else* that types input is
now requried to queue it (so it will pass through
ProcessUnconsumedInput() a moment later).  Hypothetically
this should fix the ability for input to skip the buffer
and jump in line.

The one exception is the immediate characters related
to terminal closing or program interruption like CTRL-C.
They are allowed to jump in out of order.  And in the
case of CTRL-C, it also flushes whatever was in the
buffer so if you typed anything ahead it will no longer
get executed after a CTRL-C like it used to.
@Dunbaratu Dunbaratu added the bug Weird outcome is probably not what the mod programmer expected. label Sep 6, 2020
@Dunbaratu
Copy link
Member Author

I just discovered a bug this PR has - the telnet terminal is frozen when the in-game GUI terminal is not open. (If it's not open, the buffer flush never happens and the keypresses that are getting queued up never get used until you open the terminal and then it all comes flooding in.)

@Dunbaratu
Copy link
Member Author

I think the recent change fixes the problem I found - and it looks good now.

@Dunbaratu Dunbaratu merged commit 536c160 into KSP-KOS:develop Sep 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Weird outcome is probably not what the mod programmer expected.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Pasting a long chunk text fast through a telnet client can get commands out of order.
1 participant