From 8532dd692eb7d261cd73a1394333bb6950d0ee4a Mon Sep 17 00:00:00 2001 From: Mike Griese Date: Thu, 11 Nov 2021 11:38:50 -0600 Subject: [PATCH] fix conflicts with #11625 --- src/cascadia/TerminalControl/ControlInteractivity.cpp | 11 +++++++++++ src/cascadia/TerminalControl/ControlInteractivity.h | 1 + src/cascadia/TerminalControl/ControlInteractivity.idl | 2 ++ src/cascadia/TerminalControl/TermControl.cpp | 11 ++++++++++- src/cascadia/inc/ControlProperties.h | 1 + 5 files changed, 25 insertions(+), 1 deletion(-) diff --git a/src/cascadia/TerminalControl/ControlInteractivity.cpp b/src/cascadia/TerminalControl/ControlInteractivity.cpp index 737f839e6f2..d24d443d1f7 100644 --- a/src/cascadia/TerminalControl/ControlInteractivity.cpp +++ b/src/cascadia/TerminalControl/ControlInteractivity.cpp @@ -642,4 +642,15 @@ namespace winrt::Microsoft::Terminal::Control::implementation return _core->GetUiaData(); } + // Method Description: + // - Used by the TermControl to know if it should translate drag-dropped + // paths into WSL-friendly paths. + // Arguments: + // - + // 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"; + } } diff --git a/src/cascadia/TerminalControl/ControlInteractivity.h b/src/cascadia/TerminalControl/ControlInteractivity.h index cb63c65e01e..e212fb65045 100644 --- a/src/cascadia/TerminalControl/ControlInteractivity.h +++ b/src/cascadia/TerminalControl/ControlInteractivity.h @@ -83,6 +83,7 @@ namespace winrt::Microsoft::Terminal::Control::implementation const Windows::Foundation::IReference& formats); void RequestPasteTextFromClipboard(); void SetEndSelectionPoint(const til::point pixelPosition); + bool ManglePathsForWsl(); TYPED_EVENT(OpenHyperlink, IInspectable, Control::OpenHyperlinkEventArgs); TYPED_EVENT(PasteFromClipboard, IInspectable, Control::PasteFromClipboardEventArgs); diff --git a/src/cascadia/TerminalControl/ControlInteractivity.idl b/src/cascadia/TerminalControl/ControlInteractivity.idl index 3921c7c5f9c..aada01ee0ad 100644 --- a/src/cascadia/TerminalControl/ControlInteractivity.idl +++ b/src/cascadia/TerminalControl/ControlInteractivity.idl @@ -59,6 +59,8 @@ namespace Microsoft.Terminal.Control void UpdateScrollbar(Double newValue); + Boolean ManglePathsForWsl { get; }; + event Windows.Foundation.TypedEventHandler OpenHyperlink; event Windows.Foundation.TypedEventHandler ScrollPositionChanged; event Windows.Foundation.TypedEventHandler PasteFromClipboard; diff --git a/src/cascadia/TerminalControl/TermControl.cpp b/src/cascadia/TerminalControl/TermControl.cpp index cc884483b76..7ba03928fb9 100644 --- a/src/cascadia/TerminalControl/TermControl.cpp +++ b/src/cascadia/TerminalControl/TermControl.cpp @@ -2298,7 +2298,16 @@ namespace winrt::Microsoft::Terminal::Control::implementation std::wstring fullPath{ item.Path() }; // Fix path for WSL - if (_settings.ProfileSource() == L"Windows.Terminal.Wsl") + // In the fullness of time, we should likely plumb this up + // to the TerminalApp layer, and have it make the decision + // if this control should have it's 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 + if (_interactivity.ManglePathsForWsl()) { std::replace(fullPath.begin(), fullPath.end(), L'\\', L'/'); diff --git a/src/cascadia/inc/ControlProperties.h b/src/cascadia/inc/ControlProperties.h index b3ddbc240e0..7f1cbe832f6 100644 --- a/src/cascadia/inc/ControlProperties.h +++ b/src/cascadia/inc/ControlProperties.h @@ -48,6 +48,7 @@ // All of these settings are defined in IControlSettings. #define CONTROL_SETTINGS(X) \ X(winrt::hstring, ProfileName) \ + X(winrt::hstring, ProfileSource) \ X(bool, UseAcrylic, false) \ X(winrt::hstring, Padding, DEFAULT_PADDING) \ X(winrt::hstring, FontFace, L"Consolas") \