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

Fix OSC8 termination over the PTY after SGR 0 #7608

Merged
merged 1 commit into from
Sep 11, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 14 additions & 4 deletions src/renderer/vt/paint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -198,9 +198,14 @@ using namespace Microsoft::Console::Types;
// If both the FG and BG should be the defaults, emit a SGR reset.
if (fg.IsDefault() && bg.IsDefault() && !(lastFg.IsDefault() && lastBg.IsDefault()))
{
// SGR Reset will clear all attributes.
// SGR Reset will clear all attributes (except hyperlink ID) - which means
// we cannot reset _lastTextAttributes by simply doing
// _lastTextAttributes = {};
// because we want to retain the last hyperlink ID
RETURN_IF_FAILED(_SetGraphicsDefault());
_lastTextAttributes = {};
_lastTextAttributes.SetDefaultBackground();
_lastTextAttributes.SetDefaultForeground();
_lastTextAttributes.SetDefaultMetaAttrs();
lastFg = {};
lastBg = {};
}
Expand Down Expand Up @@ -269,9 +274,14 @@ using namespace Microsoft::Console::Types;
// We can't reset FG and BG to default individually.
if ((fg.IsDefault() && !lastFg.IsDefault()) || (bg.IsDefault() && !lastBg.IsDefault()))
{
// SGR Reset will clear all attributes.
// SGR Reset will clear all attributes (except hyperlink ID) - which means
// we cannot reset _lastTextAttributes by simply doing
// _lastTextAttributes = {};
// because we want to retain the last hyperlink ID
RETURN_IF_FAILED(_SetGraphicsDefault());
_lastTextAttributes = {};
_lastTextAttributes.SetDefaultBackground();
_lastTextAttributes.SetDefaultForeground();
_lastTextAttributes.SetDefaultMetaAttrs();
lastFg = {};
lastBg = {};
}
Expand Down