-
Notifications
You must be signed in to change notification settings - Fork 8.4k
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
Add support for the DECSWT (Set Window Title) escape sequence #16804
Changes from all commits
b29c092
d1114b1
8d9350a
e8b2cdd
a2ad40b
8fe43a7
b5390c1
ddc71b9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -46,9 +46,7 @@ namespace Microsoft::Console::VirtualTerminal | |
|
||
virtual bool ActionIgnore() = 0; | ||
|
||
virtual bool ActionOscDispatch(const wchar_t wch, | ||
const size_t parameter, | ||
const std::wstring_view string) = 0; | ||
virtual bool ActionOscDispatch(const size_t parameter, const std::wstring_view string) = 0; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I dropped the |
||
|
||
virtual bool ActionSs3Dispatch(const wchar_t wch, const VTParameters parameters) = 0; | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -766,14 +766,11 @@ bool OutputStateMachineEngine::ActionIgnore() noexcept | |
// - Triggers the OscDispatch action to indicate that the listener should handle a control sequence. | ||
// These sequences perform various API-type commands that can include many parameters. | ||
// Arguments: | ||
// - wch - Character to dispatch. This will be a BEL or ST char. | ||
// - parameter - identifier of the OSC action to perform | ||
// - string - OSC string we've collected. NOT null terminated. | ||
// Return Value: | ||
// - true if we handled the dispatch. | ||
bool OutputStateMachineEngine::ActionOscDispatch(const wchar_t /*wch*/, | ||
const size_t parameter, | ||
const std::wstring_view string) | ||
bool OutputStateMachineEngine::ActionOscDispatch(const size_t parameter, const std::wstring_view string) | ||
{ | ||
auto success = false; | ||
|
||
|
@@ -782,10 +779,9 @@ bool OutputStateMachineEngine::ActionOscDispatch(const wchar_t /*wch*/, | |
case OscActionCodes::SetIconAndWindowTitle: | ||
case OscActionCodes::SetWindowIcon: | ||
case OscActionCodes::SetWindowTitle: | ||
case OscActionCodes::DECSWT_SetWindowTitle: | ||
{ | ||
std::wstring title; | ||
success = _GetOscTitle(string, title); | ||
success = success && _dispatch->SetWindowTitle(title); | ||
success = _dispatch->SetWindowTitle(string); | ||
Comment on lines
-786
to
+784
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. All that |
||
break; | ||
} | ||
case OscActionCodes::SetColor: | ||
|
@@ -932,21 +928,6 @@ bool OutputStateMachineEngine::ActionSs3Dispatch(const wchar_t /*wch*/, const VT | |
return false; | ||
} | ||
|
||
// Routine Description: | ||
// - Null terminates, then returns, the string that we've collected as part of the OSC string. | ||
// Arguments: | ||
// - string - Osc String input | ||
// - title - Where to place the Osc String to use as a title. | ||
// Return Value: | ||
// - True if there was a title to output. (a title with length=0 is still valid) | ||
bool OutputStateMachineEngine::_GetOscTitle(const std::wstring_view string, | ||
std::wstring& title) const | ||
{ | ||
title = string; | ||
|
||
return !string.empty(); | ||
} | ||
|
||
// Routine Description: | ||
// - OSC 4 ; c ; spec ST | ||
// c: the index of the ansi color table | ||
|
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.
I'm not sure why the title parameter originally expected to be null-terminated, but that's no longer the case. The
CONSOLE_INFORMATION::SetTitle
method immediately constructs astd::wstring
with that parameter, and in theTerminal::SetWindowTitle
implementation, it's assigned to astd::optional<std::wstring>
usingemplace
. Neither of those should need a null-terminatedstring_view
as far as I understand.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.
Ah, probably vestiges of the pre-wstring times :)