Format URLs for display when we show the tooltip (#15095)

This will reduce the incidence of confusables, RTL, and non-printables
messing with the display of the URL.
This commit is contained in:
Dustin L. Howett
2023-04-03 16:22:25 -05:00
committed by GitHub
parent 0656afcf13
commit 06174a9cb3
2 changed files with 14 additions and 1 deletions

View File

@@ -257,6 +257,7 @@ condrv
conechokey
conemu
configurability
confusables
conhost
conime
conimeinfo

View File

@@ -3016,7 +3016,19 @@ namespace winrt::Microsoft::Terminal::Control::implementation
auto lastHoveredCell = _core.HoveredCell();
if (lastHoveredCell)
{
const auto uriText = _core.HoveredUriText();
winrt::hstring uriText = _core.HoveredUriText();
try
{
// DisplayUri will filter out non-printable characters and confusables.
Windows::Foundation::Uri parsedUri{ uriText };
uriText = parsedUri.DisplayUri();
}
catch (...)
{
LOG_CAUGHT_EXCEPTION();
uriText = {};
}
if (!uriText.empty())
{
const auto panel = SwapChainPanel();