-
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
Warn when font isn't found and another is chosen #8207
Changes from all commits
2f37fbe
bee814f
58cee31
1b16866
cfc8201
975251e
5285f5d
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 |
---|---|---|
@@ -1 +1 @@ | ||
renamer | ||
renamer |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2828,4 +2828,4 @@ zy | |
AAAAABBBBBBCCC | ||
AAAAA | ||
BBBBBCCC | ||
abcd | ||
abcd |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1121,6 +1121,8 @@ namespace winrt::TerminalApp::implementation | |
// - hostingTab: The Tab that's hosting this TermControl instance | ||
void TerminalPage::_RegisterTerminalEvents(TermControl term, TerminalTab& hostingTab) | ||
{ | ||
term.RaiseNotice({ this, &TerminalPage::_ControlNoticeRaisedHandler }); | ||
|
||
// Add an event handler when the terminal's selection wants to be copied. | ||
// When the text buffer data is retrieved, we'll copy the data into the Clipboard | ||
term.CopyToClipboard({ this, &TerminalPage::_CopyToClipboardHandler }); | ||
|
@@ -1928,6 +1930,48 @@ namespace winrt::TerminalApp::implementation | |
} | ||
} | ||
|
||
void TerminalPage::_ControlNoticeRaisedHandler(const IInspectable /*sender*/, const Microsoft::Terminal::TerminalControl::NoticeEventArgs eventArgs) | ||
{ | ||
winrt::hstring message = eventArgs.Message(); | ||
|
||
winrt::hstring title; | ||
|
||
switch (eventArgs.Level()) | ||
{ | ||
case TerminalControl::NoticeLevel::Debug: | ||
title = RS_(L"NoticeDebug"); //\xebe8 | ||
break; | ||
case TerminalControl::NoticeLevel::Info: | ||
title = RS_(L"NoticeInfo"); // \xe946 | ||
break; | ||
case TerminalControl::NoticeLevel::Warning: | ||
title = RS_(L"NoticeWarning"); //\xe7ba | ||
break; | ||
case TerminalControl::NoticeLevel::Error: | ||
title = RS_(L"NoticeError"); //\xe783 | ||
break; | ||
} | ||
|
||
_ShowControlNoticeDialog(title, message); | ||
} | ||
|
||
void TerminalPage::_ShowControlNoticeDialog(const winrt::hstring& title, const winrt::hstring& message) | ||
{ | ||
if (auto presenter{ _dialogPresenter.get() }) | ||
{ | ||
// FindName needs to be called first to actually load the xaml object | ||
auto controlNoticeDialog = FindName(L"ControlNoticeDialog").try_as<WUX::Controls::ContentDialog>(); | ||
Comment on lines
+1962
to
+1963
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. Wait...Really? So you never actually use 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. Well.... the trickery is, as far as I know, that these things are lazy-instantiated. So I believe this is necessary to make XAML load the object before I can do the things below. So yeah, I don't use it. But I had to ask for it to make sure XAML did the needful first on the relevant other variables. |
||
|
||
ControlNoticeDialog().Title(winrt::box_value(title)); | ||
|
||
// Insert the message | ||
NoticeMessage().Text(message); | ||
|
||
// Show the dialog | ||
presenter.ShowDialog(controlNoticeDialog); | ||
} | ||
} | ||
|
||
// Method Description: | ||
// - Copy text from the focused terminal to the Windows Clipboard | ||
// Arguments: | ||
|
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.
What are all of these
//\xebe8
for?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 had this bright idea that I was going to use Segoe icons for a bug shaped icon for debug and an I in a circle info icon for informational. But it didn't work right because the text in the dialog won't font fallback. And in lieu of adding another text field with the font set just right to take only the Segoe icon.... I just left the codepoints here for if I cared enough in the future because it was mildly painful to look them up in the first place.
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.
Yea les keep em