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

vt: make sure to Flush the entire parsed sequence #4870

Merged
merged 2 commits into from
Mar 11, 2020

Conversation

DHowett-MSFT
Copy link
Contributor

When we had to flush unknown sequences to the terminal, we were only
taking the most recent run with us; therefore, if we received \e[?12
and 34h in separate packets we would only send out 34h.

This change fixes that issue by ensuring that we cache partial bits of
sequences we haven't yet completed, just in case we need to flush them.

Fixes #3080.
Fixes #3081.

PR Checklist

Validation Steps Performed

Ran new tests!

When we had to flush unknown sequences to the terminal, we were only
taking the _most recent run_ with us; therefore, if we received `\e[?12`
and `34h` in separate packets we would _only_ send out `34h`.

This change fixes that issue by ensuring that we cache partial bits of
sequences we haven't yet completed, just in case we need to flush them.

Fixes #3080.
Fixes #3081.
@oising
Copy link
Collaborator

oising commented Mar 10, 2020

You should test that this correctly flushes/ignores SIXEL data too...

@DHowett-MSFT
Copy link
Contributor Author

Chatted offline; since SIXEL data isn't encoded in an escape but rather as a separate "mode" the terminal needs to be put into, this doesn't change how it's handled/passed through/ignored.

@zadjii-msft zadjii-msft added Area-VT Virtual Terminal sequence support Needs-Second It's a PR that needs another sign-off Product-Meta The product is the management of the products. labels Mar 11, 2020
@ghost ghost requested review from miniksa, carlos-zamora and leonMSFT March 11, 2020 13:20
Comment on lines 1235 to 1241
bool succeeded = true;
if (succeeded && _cachedSequence.has_value())
{
succeeded = _engine->ActionPassThroughString(*_cachedSequence);
_cachedSequence.reset();
}
return succeeded && _engine->ActionPassThroughString(_run);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're being tricky here and it's taking more than instantaneous to figure out what you're doing. Can you please add more comments to explain your trickery?

(Also that first succeeded test is weird given it's always true...)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the first succeeded test is in case anybody ever adds another thing that might fail in this flow ;P but yeah, fair. I'll comment it

Copy link
Member

@miniksa miniksa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I approve, but please clarify your mild trickery with a comment before merging.

@DHowett-MSFT DHowett-MSFT changed the title vt: make sure to Flush the entire parsed sequence when unrecognized vt: make sure to Flush the entire parsed sequence Mar 11, 2020
@DHowett-MSFT DHowett-MSFT merged commit 64ac0d2 into master Mar 11, 2020
@DHowett-MSFT DHowett-MSFT deleted the dev/duhowett/please_flush_only_paper_products branch March 11, 2020 23:44
abhijeetviswam pushed a commit to abhijeetviswam/terminal that referenced this pull request Mar 12, 2020
When we had to flush unknown sequences to the terminal, we were only
taking the _most recent run_ with us; therefore, if we received `\e[?12`
and `34h` in separate packets we would _only_ send out `34h`.

This change fixes that issue by ensuring that we cache partial bits of
sequences we haven't yet completed, just in case we need to flush them.

Fixes microsoft#3080.
Fixes microsoft#3081.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-VT Virtual Terminal sequence support Needs-Second It's a PR that needs another sign-off Product-Meta The product is the management of the products.
Projects
None yet
6 participants