Add a new (advanced) profile setting, pathTranslationStyle (#18195)

`pathTranslationStyle` has four options:

- `none`: Do no translation
- `wsl`: Translate `C:\` to `/mnt/c` and `\\wsl$\Foo\bar` to `/bar`
- `cygwin`: Translate `C:\` to `/cygdrive/c`
- `msys2`: Translate `C:\` to `/c`

It is intended as a broadly-supported replacement for us checking the
source every time the user drops a path.

We no longer need to push the source name all the way down to the
control.

I am hesitant to commit to using other folks' product names in our
settings model,
however, these are almost certainly more recognizable than whatever
other weird
names we could come up with.

The Git Bash fragment extension profile could conceivably use
`pathTranslationStyle`
`msys2` to make sure drag/dropped paths look right.
This commit is contained in:
Dustin L. Howett 2024-11-15 17:55:34 -06:00 committed by GitHub
parent 90866c7c93
commit 068906714f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
22 changed files with 150 additions and 68 deletions

View File

@ -341,6 +341,7 @@ CXVIRTUALSCREEN
CXVSCROLL CXVSCROLL
CYFRAME CYFRAME
CYFULLSCREEN CYFULLSCREEN
cygdrive
CYHSCROLL CYHSCROLL
CYMIN CYMIN
CYPADDEDBORDER CYPADDEDBORDER

View File

@ -3095,6 +3095,17 @@
"default": false, "default": false,
"description": "When set to true, the window will have an acrylic material background. When set to false, the window will have a plain, untextured background.", "description": "When set to true, the window will have an acrylic material background. When set to false, the window will have a plain, untextured background.",
"type": "boolean" "type": "boolean"
},
"pathTranslationStyle": {
"default": "none",
"description": "Controls how file paths are transformed when they are dragged and dropped on the terminal. Possible values are \"none\", \"wsl\", \"cygwin\" and \"msys2\".",
"enum": [
"none",
"wsl",
"cygwin",
"msys2"
],
"type": "string"
} }
} }
}, },

View File

@ -725,16 +725,4 @@ namespace winrt::Microsoft::Terminal::Control::implementation
{ {
return _core->GetRenderData(); return _core->GetRenderData();
} }
// Method Description:
// - Used by the TermControl to know if it should translate drag-dropped
// paths into WSL-friendly paths.
// Arguments:
// - <none>
// Return Value:
// - true if the connection we were created with was a WSL profile.
bool ControlInteractivity::ManglePathsForWsl()
{
return _core->Settings().ProfileSource() == L"Windows.Terminal.Wsl";
}
} }

View File

@ -86,7 +86,6 @@ namespace winrt::Microsoft::Terminal::Control::implementation
const Windows::Foundation::IReference<CopyFormat>& formats); const Windows::Foundation::IReference<CopyFormat>& formats);
void RequestPasteTextFromClipboard(); void RequestPasteTextFromClipboard();
void SetEndSelectionPoint(const Core::Point pixelPosition); void SetEndSelectionPoint(const Core::Point pixelPosition);
bool ManglePathsForWsl();
uint64_t Id(); uint64_t Id();
void AttachToNewControl(const Microsoft::Terminal::Control::IKeyBindings& keyBindings); void AttachToNewControl(const Microsoft::Terminal::Control::IKeyBindings& keyBindings);

View File

@ -66,8 +66,6 @@ namespace Microsoft.Terminal.Control
void UpdateScrollbar(Single newValue); void UpdateScrollbar(Single newValue);
Boolean ManglePathsForWsl { get; };
event Windows.Foundation.TypedEventHandler<Object, OpenHyperlinkEventArgs> OpenHyperlink; event Windows.Foundation.TypedEventHandler<Object, OpenHyperlinkEventArgs> OpenHyperlink;
event Windows.Foundation.TypedEventHandler<Object, ScrollPositionChangedArgs> ScrollPositionChanged; event Windows.Foundation.TypedEventHandler<Object, ScrollPositionChangedArgs> ScrollPositionChanged;
event Windows.Foundation.TypedEventHandler<Object, PasteFromClipboardEventArgs> PasteFromClipboard; event Windows.Foundation.TypedEventHandler<Object, PasteFromClipboardEventArgs> PasteFromClipboard;

View File

@ -21,6 +21,14 @@ namespace Microsoft.Terminal.Control
Aliased Aliased
}; };
enum PathTranslationStyle
{
None = 0,
WSL,
Cygwin,
MSYS2
};
// Class Description: // Class Description:
// TerminalSettings encapsulates all settings that control the // TerminalSettings encapsulates all settings that control the
// TermControl's behavior. In these settings there is both the entirety // TermControl's behavior. In these settings there is both the entirety
@ -30,7 +38,6 @@ namespace Microsoft.Terminal.Control
Microsoft.Terminal.Control.IControlAppearance Microsoft.Terminal.Control.IControlAppearance
{ {
String ProfileName; String ProfileName;
String ProfileSource;
Boolean EnableUnfocusedAcrylic { get; }; Boolean EnableUnfocusedAcrylic { get; };
Guid SessionId { get; }; Guid SessionId { get; };
@ -69,6 +76,8 @@ namespace Microsoft.Terminal.Control
Boolean RightClickContextMenu { get; }; Boolean RightClickContextMenu { get; };
Boolean RepositionCursorWithMouse { get; }; Boolean RepositionCursorWithMouse { get; };
PathTranslationStyle PathTranslationStyle { get; };
// NOTE! When adding something here, make sure to update ControlProperties.h too! // NOTE! When adding something here, make sure to update ControlProperties.h too!
}; };
} }

View File

@ -58,6 +58,54 @@ static Microsoft::Console::TSF::Handle& GetTSFHandle()
namespace winrt::Microsoft::Terminal::Control::implementation namespace winrt::Microsoft::Terminal::Control::implementation
{ {
static void _translatePathInPlace(std::wstring& fullPath, PathTranslationStyle translationStyle)
{
static constexpr wil::zwstring_view s_pathPrefixes[] = {
{},
/* WSL */ L"/mnt/",
/* Cygwin */ L"/cygdrive/",
/* MSYS2 */ L"/",
};
if (translationStyle == PathTranslationStyle::None)
{
return;
}
// All of the other path translation modes current result in /-delimited paths
std::replace(fullPath.begin(), fullPath.end(), L'\\', L'/');
if (fullPath.size() >= 2 && fullPath.at(1) == L':')
{
// C:/foo/bar -> Cc/foo/bar
fullPath.at(1) = til::tolower_ascii(fullPath.at(0));
// Cc/foo/bar -> [PREFIX]c/foo/bar
fullPath.replace(0, 1, s_pathPrefixes[static_cast<int>(translationStyle)]);
}
else if (translationStyle == PathTranslationStyle::WSL)
{
// Stripping the UNC name and distribution prefix only applies to WSL.
static constexpr std::wstring_view wslPathPrefixes[] = { L"//wsl.localhost/", L"//wsl$/" };
for (auto prefix : wslPathPrefixes)
{
if (til::starts_with(fullPath, prefix))
{
if (const auto idx = fullPath.find(L'/', prefix.size()); idx != std::wstring::npos)
{
// //wsl.localhost/Ubuntu-18.04/foo/bar -> /foo/bar
fullPath.erase(0, idx);
}
else
{
// //wsl.localhost/Ubuntu-18.04 -> /
fullPath = L"/";
}
break;
}
}
}
}
TsfDataProvider::TsfDataProvider(TermControl* termControl) noexcept : TsfDataProvider::TsfDataProvider(TermControl* termControl) noexcept :
_termControl{ termControl } _termControl{ termControl }
{ {
@ -3215,54 +3263,12 @@ namespace winrt::Microsoft::Terminal::Control::implementation
allPathsString += L" "; allPathsString += L" ";
} }
// Fix path for WSL const auto translationStyle{ _core.Settings().PathTranslationStyle() };
// In the fullness of time, we should likely plumb this up _translatePathInPlace(fullPath, translationStyle);
// to the TerminalApp layer, and have it make the decision
// if this control should have its path mangled (and do the
// mangling), rather than exposing the source concept to the
// Control layer.
//
// However, it's likely that the control layer may need to
// know about the source anyways in the future, to support
// GH#3158
const auto isWSL = _interactivity.ManglePathsForWsl();
if (isWSL) // All translated paths get quotes, and all strings spaces get quotes; all translated paths get single quotes
{ const auto quotesNeeded = translationStyle != PathTranslationStyle::None || fullPath.find(L' ') != std::wstring::npos;
std::replace(fullPath.begin(), fullPath.end(), L'\\', L'/'); const auto quotesChar = translationStyle != PathTranslationStyle::None ? L'\'' : L'"';
if (fullPath.size() >= 2 && fullPath.at(1) == L':')
{
// C:/foo/bar -> Cc/foo/bar
fullPath.at(1) = til::tolower_ascii(fullPath.at(0));
// Cc/foo/bar -> /mnt/c/foo/bar
fullPath.replace(0, 1, L"/mnt/");
}
else
{
static constexpr std::wstring_view wslPathPrefixes[] = { L"//wsl.localhost/", L"//wsl$/" };
for (auto prefix : wslPathPrefixes)
{
if (til::starts_with(fullPath, prefix))
{
if (const auto idx = fullPath.find(L'/', prefix.size()); idx != std::wstring::npos)
{
// //wsl.localhost/Ubuntu-18.04/foo/bar -> /foo/bar
fullPath.erase(0, idx);
}
else
{
// //wsl.localhost/Ubuntu-18.04 -> /
fullPath = L"/";
}
break;
}
}
}
}
const auto quotesNeeded = isWSL || fullPath.find(L' ') != std::wstring::npos;
const auto quotesChar = isWSL ? L'\'' : L'"';
// Append fullPath and also wrap it in quotes if needed // Append fullPath and also wrap it in quotes if needed
if (quotesNeeded) if (quotesNeeded)

View File

@ -39,6 +39,7 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
INITIALIZE_BINDABLE_ENUM_SETTING(AntiAliasingMode, TextAntialiasingMode, winrt::Microsoft::Terminal::Control::TextAntialiasingMode, L"Profile_AntialiasingMode", L"Content"); INITIALIZE_BINDABLE_ENUM_SETTING(AntiAliasingMode, TextAntialiasingMode, winrt::Microsoft::Terminal::Control::TextAntialiasingMode, L"Profile_AntialiasingMode", L"Content");
INITIALIZE_BINDABLE_ENUM_SETTING_REVERSE_ORDER(CloseOnExitMode, CloseOnExitMode, winrt::Microsoft::Terminal::Settings::Model::CloseOnExitMode, L"Profile_CloseOnExit", L"Content"); INITIALIZE_BINDABLE_ENUM_SETTING_REVERSE_ORDER(CloseOnExitMode, CloseOnExitMode, winrt::Microsoft::Terminal::Settings::Model::CloseOnExitMode, L"Profile_CloseOnExit", L"Content");
INITIALIZE_BINDABLE_ENUM_SETTING(ScrollState, ScrollbarState, winrt::Microsoft::Terminal::Control::ScrollbarState, L"Profile_ScrollbarVisibility", L"Content"); INITIALIZE_BINDABLE_ENUM_SETTING(ScrollState, ScrollbarState, winrt::Microsoft::Terminal::Control::ScrollbarState, L"Profile_ScrollbarVisibility", L"Content");
INITIALIZE_BINDABLE_ENUM_SETTING(PathTranslationStyle, PathTranslationStyle, winrt::Microsoft::Terminal::Control::PathTranslationStyle, L"Profile_PathTranslationStyle", L"Content");
// Add a property changed handler to our own property changed event. // Add a property changed handler to our own property changed event.
// This propagates changes from the settings model to anybody listening to our // This propagates changes from the settings model to anybody listening to our
@ -76,6 +77,10 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
{ {
_NotifyChanges(L"HideIcon"); _NotifyChanges(L"HideIcon");
} }
else if (viewModelProperty == L"PathTranslationStyle")
{
_NotifyChanges(L"CurrentPathTranslationStyle");
}
}); });
// Do the same for the starting directory // Do the same for the starting directory

View File

@ -126,12 +126,14 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
OBSERVABLE_PROJECTED_SETTING(_profile, AllowVtChecksumReport); OBSERVABLE_PROJECTED_SETTING(_profile, AllowVtChecksumReport);
OBSERVABLE_PROJECTED_SETTING(_profile, AnswerbackMessage); OBSERVABLE_PROJECTED_SETTING(_profile, AnswerbackMessage);
OBSERVABLE_PROJECTED_SETTING(_profile, RainbowSuggestions); OBSERVABLE_PROJECTED_SETTING(_profile, RainbowSuggestions);
OBSERVABLE_PROJECTED_SETTING(_profile, PathTranslationStyle);
WINRT_PROPERTY(bool, IsBaseLayer, false); WINRT_PROPERTY(bool, IsBaseLayer, false);
WINRT_PROPERTY(bool, FocusDeleteButton, false); WINRT_PROPERTY(bool, FocusDeleteButton, false);
GETSET_BINDABLE_ENUM_SETTING(AntiAliasingMode, Microsoft::Terminal::Control::TextAntialiasingMode, AntialiasingMode); GETSET_BINDABLE_ENUM_SETTING(AntiAliasingMode, Microsoft::Terminal::Control::TextAntialiasingMode, AntialiasingMode);
GETSET_BINDABLE_ENUM_SETTING(CloseOnExitMode, Microsoft::Terminal::Settings::Model::CloseOnExitMode, CloseOnExit); GETSET_BINDABLE_ENUM_SETTING(CloseOnExitMode, Microsoft::Terminal::Settings::Model::CloseOnExitMode, CloseOnExit);
GETSET_BINDABLE_ENUM_SETTING(ScrollState, Microsoft::Terminal::Control::ScrollbarState, ScrollState); GETSET_BINDABLE_ENUM_SETTING(ScrollState, Microsoft::Terminal::Control::ScrollbarState, ScrollState);
GETSET_BINDABLE_ENUM_SETTING(PathTranslationStyle, Microsoft::Terminal::Control::PathTranslationStyle, PathTranslationStyle);
private: private:
Model::Profile _profile; Model::Profile _profile;

View File

@ -58,6 +58,9 @@ namespace Microsoft.Terminal.Settings.Editor
IInspectable CurrentScrollState; IInspectable CurrentScrollState;
Windows.Foundation.Collections.IObservableVector<Microsoft.Terminal.Settings.Editor.EnumEntry> ScrollStateList { get; }; Windows.Foundation.Collections.IObservableVector<Microsoft.Terminal.Settings.Editor.EnumEntry> ScrollStateList { get; };
IInspectable CurrentPathTranslationStyle;
Windows.Foundation.Collections.IObservableVector<Microsoft.Terminal.Settings.Editor.EnumEntry> PathTranslationStyleList { get; };
Boolean CanDeleteProfile { get; }; Boolean CanDeleteProfile { get; };
Boolean FocusDeleteButton; Boolean FocusDeleteButton;
Boolean IsBaseLayer; Boolean IsBaseLayer;
@ -117,5 +120,6 @@ namespace Microsoft.Terminal.Settings.Editor
OBSERVABLE_PROJECTED_PROFILE_SETTING(Boolean, AllowVtChecksumReport); OBSERVABLE_PROJECTED_PROFILE_SETTING(Boolean, AllowVtChecksumReport);
OBSERVABLE_PROJECTED_PROFILE_SETTING(String, AnswerbackMessage); OBSERVABLE_PROJECTED_PROFILE_SETTING(String, AnswerbackMessage);
OBSERVABLE_PROJECTED_PROFILE_SETTING(Boolean, RainbowSuggestions); OBSERVABLE_PROJECTED_PROFILE_SETTING(Boolean, RainbowSuggestions);
OBSERVABLE_PROJECTED_PROFILE_SETTING(Microsoft.Terminal.Control.PathTranslationStyle, PathTranslationStyle);
} }
} }

View File

@ -164,6 +164,19 @@
<ToggleSwitch IsOn="{x:Bind Profile.RainbowSuggestions, Mode=TwoWay}" <ToggleSwitch IsOn="{x:Bind Profile.RainbowSuggestions, Mode=TwoWay}"
Style="{StaticResource ToggleSwitchInExpanderStyle}" /> Style="{StaticResource ToggleSwitchInExpanderStyle}" />
</local:SettingContainer> </local:SettingContainer>
<!-- Path Translation -->
<local:SettingContainer x:Uid="Profile_PathTranslationStyle"
ClearSettingValue="{x:Bind Profile.ClearPathTranslationStyle}"
HasSettingValue="{x:Bind Profile.HasPathTranslationStyle, Mode=OneWay}"
SettingOverrideSource="{x:Bind Profile.PathTranslationStyleOverrideSource, Mode=OneWay}">
<ComboBox AutomationProperties.AccessibilityView="Content"
ItemTemplate="{StaticResource EnumComboBoxTemplate}"
ItemsSource="{x:Bind Profile.PathTranslationStyleList, Mode=OneWay}"
SelectedItem="{x:Bind Profile.CurrentPathTranslationStyle, Mode=TwoWay}"
Style="{StaticResource ComboBoxSettingStyle}" />
</local:SettingContainer>
</StackPanel> </StackPanel>
</Grid> </Grid>
</Page> </Page>

View File

@ -1961,6 +1961,34 @@
<value>Display a shield in the title bar when Windows Terminal is running as Administrator</value> <value>Display a shield in the title bar when Windows Terminal is running as Administrator</value>
<comment>Header for a control to toggle displaying a shield in the title bar of the app. "Admin" refers to elevated sessions like "run as Admin"</comment> <comment>Header for a control to toggle displaying a shield in the title bar of the app. "Admin" refers to elevated sessions like "run as Admin"</comment>
</data> </data>
<data name="Profile_PathTranslationStyle.[using:Windows.UI.Xaml.Automation]AutomationProperties.Name" xml:space="preserve">
<value>Path translation</value>
<comment>Name for a control to select how file and directory paths are translated.</comment>
</data>
<data name="Profile_PathTranslationStyle.Header" xml:space="preserve">
<value>Path translation</value>
<comment>Name for a control to select how file and directory paths are translated.</comment>
</data>
<data name="Profile_PathTranslationStyle.HelpText" xml:space="preserve">
<value>Controls how file and directory paths are translated during drag-and-drop operations.</value>
<comment>A description for what the "path translation" setting does. Presented near "Profile_PathTranslationStyle.Header".</comment>
</data>
<data name="Profile_PathTranslationStyleNone.Content" xml:space="preserve">
<value>None</value>
<comment>An option to choose from for the "path translation" setting.</comment>
</data>
<data name="Profile_PathTranslationStyleWsl.Content" xml:space="preserve">
<value>WSL (C:\ -> /mnt/c)</value>
<comment>{Locked="WSL","C:\","/mnt/c"} An option to choose from for the "path translation" setting.</comment>
</data>
<data name="Profile_PathTranslationStyleCygwin.Content" xml:space="preserve">
<value>Cygwin (C:\ -> /cygdrive/c)</value>
<comment>{Locked="Cygwin","C:\","/cygdrive/c"} An option to choose from for the "path translation" setting.</comment>
</data>
<data name="Profile_PathTranslationStyleMsys2.Content" xml:space="preserve">
<value>MSYS2 (C:\ -> /c)</value>
<comment>{Locked="MSYS2","C:\","/c"} An option to choose from for the "path translation" setting.</comment>
</data>
<data name="Profile_Delete_Orphaned.Header" xml:space="preserve"> <data name="Profile_Delete_Orphaned.Header" xml:space="preserve">
<value>Profile no longer detected</value> <value>Profile no longer detected</value>
</data> </data>

View File

@ -51,6 +51,7 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
DEFINE_ENUM_MAP(Microsoft::Terminal::Core::CursorStyle, CursorStyle); DEFINE_ENUM_MAP(Microsoft::Terminal::Core::CursorStyle, CursorStyle);
DEFINE_ENUM_MAP(Microsoft::Terminal::Settings::Model::IntenseStyle, IntenseTextStyle); DEFINE_ENUM_MAP(Microsoft::Terminal::Settings::Model::IntenseStyle, IntenseTextStyle);
DEFINE_ENUM_MAP(Microsoft::Terminal::Core::AdjustTextMode, AdjustIndistinguishableColors); DEFINE_ENUM_MAP(Microsoft::Terminal::Core::AdjustTextMode, AdjustIndistinguishableColors);
DEFINE_ENUM_MAP(Microsoft::Terminal::Control::PathTranslationStyle, PathTranslationStyle);
// FontWeight is special because the JsonUtils::ConversionTrait for it // FontWeight is special because the JsonUtils::ConversionTrait for it
// creates a FontWeight object, but we need to use the uint16_t value. // creates a FontWeight object, but we need to use the uint16_t value.

View File

@ -48,6 +48,7 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
static winrt::Windows::Foundation::Collections::IMap<winrt::hstring, uint16_t> FontWeight(); static winrt::Windows::Foundation::Collections::IMap<winrt::hstring, uint16_t> FontWeight();
static winrt::Windows::Foundation::Collections::IMap<winrt::hstring, winrt::Microsoft::Terminal::Settings::Model::IntenseStyle> IntenseTextStyle(); static winrt::Windows::Foundation::Collections::IMap<winrt::hstring, winrt::Microsoft::Terminal::Settings::Model::IntenseStyle> IntenseTextStyle();
static winrt::Windows::Foundation::Collections::IMap<winrt::hstring, winrt::Microsoft::Terminal::Core::AdjustTextMode> AdjustIndistinguishableColors(); static winrt::Windows::Foundation::Collections::IMap<winrt::hstring, winrt::Microsoft::Terminal::Core::AdjustTextMode> AdjustIndistinguishableColors();
static winrt::Windows::Foundation::Collections::IMap<winrt::hstring, winrt::Microsoft::Terminal::Control::PathTranslationStyle> PathTranslationStyle();
}; };
} }

View File

@ -30,5 +30,6 @@ namespace Microsoft.Terminal.Settings.Model
static Windows.Foundation.Collections.IMap<String, Microsoft.Terminal.Core.AdjustTextMode> AdjustIndistinguishableColors { get; }; static Windows.Foundation.Collections.IMap<String, Microsoft.Terminal.Core.AdjustTextMode> AdjustIndistinguishableColors { get; };
static Windows.Foundation.Collections.IMap<String, UInt16> FontWeight { get; }; static Windows.Foundation.Collections.IMap<String, UInt16> FontWeight { get; };
static Windows.Foundation.Collections.IMap<String, Microsoft.Terminal.Settings.Model.IntenseStyle> IntenseTextStyle { get; }; static Windows.Foundation.Collections.IMap<String, Microsoft.Terminal.Settings.Model.IntenseStyle> IntenseTextStyle { get; };
static Windows.Foundation.Collections.IMap<String, Microsoft.Terminal.Control.PathTranslationStyle> PathTranslationStyle { get; };
} }
} }

View File

@ -102,7 +102,8 @@ Author(s):
X(bool, RainbowSuggestions, "experimental.rainbowSuggestions", false) \ X(bool, RainbowSuggestions, "experimental.rainbowSuggestions", false) \
X(bool, ForceVTInput, "compatibility.input.forceVT", false) \ X(bool, ForceVTInput, "compatibility.input.forceVT", false) \
X(bool, AllowVtChecksumReport, "compatibility.allowDECRQCRA", false) \ X(bool, AllowVtChecksumReport, "compatibility.allowDECRQCRA", false) \
X(bool, AllowKeypadMode, "compatibility.allowDECNKM", false) X(bool, AllowKeypadMode, "compatibility.allowDECNKM", false) \
X(Microsoft::Terminal::Control::PathTranslationStyle, PathTranslationStyle, "pathTranslationStyle", Microsoft::Terminal::Control::PathTranslationStyle::None)
// Intentionally omitted Profile settings: // Intentionally omitted Profile settings:
// * Name // * Name

View File

@ -94,5 +94,7 @@ namespace Microsoft.Terminal.Settings.Model
INHERITABLE_PROFILE_SETTING(Boolean, ForceVTInput); INHERITABLE_PROFILE_SETTING(Boolean, ForceVTInput);
INHERITABLE_PROFILE_SETTING(Boolean, AllowVtChecksumReport); INHERITABLE_PROFILE_SETTING(Boolean, AllowVtChecksumReport);
INHERITABLE_PROFILE_SETTING(Boolean, AllowKeypadMode); INHERITABLE_PROFILE_SETTING(Boolean, AllowKeypadMode);
INHERITABLE_PROFILE_SETTING(Microsoft.Terminal.Control.PathTranslationStyle, PathTranslationStyle);
} }
} }

View File

@ -288,7 +288,6 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
// Fill in the remaining properties from the profile // Fill in the remaining properties from the profile
_ProfileName = profile.Name(); _ProfileName = profile.Name();
_ProfileSource = profile.Source();
const auto fontInfo = profile.FontInfo(); const auto fontInfo = profile.FontInfo();
_FontFace = fontInfo.FontFace(); _FontFace = fontInfo.FontFace();
@ -349,6 +348,7 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
_RainbowSuggestions = profile.RainbowSuggestions(); _RainbowSuggestions = profile.RainbowSuggestions();
_ForceVTInput = profile.ForceVTInput(); _ForceVTInput = profile.ForceVTInput();
_AllowVtChecksumReport = profile.AllowVtChecksumReport(); _AllowVtChecksumReport = profile.AllowVtChecksumReport();
_PathTranslationStyle = profile.PathTranslationStyle();
} }
// Method Description: // Method Description:

View File

@ -119,7 +119,6 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
// ------------------------ End of Core Settings ----------------------- // ------------------------ End of Core Settings -----------------------
INHERITABLE_SETTING(Model::TerminalSettings, hstring, ProfileName); INHERITABLE_SETTING(Model::TerminalSettings, hstring, ProfileName);
INHERITABLE_SETTING(Model::TerminalSettings, hstring, ProfileSource);
INHERITABLE_SETTING(Model::TerminalSettings, guid, SessionId); INHERITABLE_SETTING(Model::TerminalSettings, guid, SessionId);
INHERITABLE_SETTING(Model::TerminalSettings, bool, EnableUnfocusedAcrylic, false); INHERITABLE_SETTING(Model::TerminalSettings, bool, EnableUnfocusedAcrylic, false);
@ -178,6 +177,8 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
INHERITABLE_SETTING(Model::TerminalSettings, bool, ReloadEnvironmentVariables, true); INHERITABLE_SETTING(Model::TerminalSettings, bool, ReloadEnvironmentVariables, true);
INHERITABLE_SETTING(Model::TerminalSettings, Microsoft::Terminal::Control::PathTranslationStyle, PathTranslationStyle, Microsoft::Terminal::Control::PathTranslationStyle::None);
private: private:
std::optional<std::array<Microsoft::Terminal::Core::Color, COLOR_TABLE_SIZE>> _ColorTable; std::optional<std::array<Microsoft::Terminal::Core::Color, COLOR_TABLE_SIZE>> _ColorTable;
std::span<Microsoft::Terminal::Core::Color> _getColorTableImpl(); std::span<Microsoft::Terminal::Core::Color> _getColorTableImpl();

View File

@ -790,3 +790,13 @@ JSON_ENUM_MAPPER(::winrt::Microsoft::Terminal::Control::DefaultInputScope)
pair_type{ "alphanumericHalfWidth", ValueType::AlphanumericHalfWidth }, pair_type{ "alphanumericHalfWidth", ValueType::AlphanumericHalfWidth },
}; };
}; };
JSON_ENUM_MAPPER(::winrt::Microsoft::Terminal::Control::PathTranslationStyle)
{
static constexpr std::array<pair_type, 4> mappings = {
pair_type{ "none", ValueType::None },
pair_type{ "wsl", ValueType::WSL },
pair_type{ "cygwin", ValueType::Cygwin },
pair_type{ "msys2", ValueType::MSYS2 },
};
};

View File

@ -66,6 +66,7 @@ static winrt::com_ptr<implementation::Profile> makeProfile(const std::wstring& d
WSLDistro->StartingDirectory(winrt::hstring{ DEFAULT_STARTING_DIRECTORY }); WSLDistro->StartingDirectory(winrt::hstring{ DEFAULT_STARTING_DIRECTORY });
} }
WSLDistro->Icon(L"ms-appx:///ProfileIcons/{9acb9455-ca41-5af7-950f-6bca1bc9722f}.png"); WSLDistro->Icon(L"ms-appx:///ProfileIcons/{9acb9455-ca41-5af7-950f-6bca1bc9722f}.png");
WSLDistro->PathTranslationStyle(winrt::Microsoft::Terminal::Control::PathTranslationStyle::WSL);
return WSLDistro; return WSLDistro;
} }

View File

@ -58,7 +58,6 @@
// All of these settings are defined in IControlSettings. // All of these settings are defined in IControlSettings.
#define CONTROL_SETTINGS(X) \ #define CONTROL_SETTINGS(X) \
X(winrt::hstring, ProfileName) \ X(winrt::hstring, ProfileName) \
X(winrt::hstring, ProfileSource) \
X(winrt::guid, SessionId) \ X(winrt::guid, SessionId) \
X(bool, EnableUnfocusedAcrylic, false) \ X(bool, EnableUnfocusedAcrylic, false) \
X(winrt::hstring, Padding, DEFAULT_PADDING) \ X(winrt::hstring, Padding, DEFAULT_PADDING) \
@ -84,4 +83,5 @@
X(bool, UseBackgroundImageForWindow, false) \ X(bool, UseBackgroundImageForWindow, false) \
X(bool, ShowMarks, false) \ X(bool, ShowMarks, false) \
X(winrt::Microsoft::Terminal::Control::CopyFormat, CopyFormatting, 0) \ X(winrt::Microsoft::Terminal::Control::CopyFormat, CopyFormatting, 0) \
X(bool, RightClickContextMenu, false) X(bool, RightClickContextMenu, false) \
X(winrt::Microsoft::Terminal::Control::PathTranslationStyle, PathTranslationStyle, winrt::Microsoft::Terminal::Control::PathTranslationStyle::None)