mirror of
https://github.com/microsoft/terminal.git
synced 2025-12-10 00:48:23 -06:00
TerminalControl: Support MinGW path translation style (C:\ -> C:/) (#18759)
## Summary of the Pull Request Support drag-n-drop path translation in the style used by MinGW programs. In particular for usage with shells like `ash` from busybox (https://frippery.org/busybox/). ## Detailed Description of the Pull Request / Additional comments Provides a new option "mingw" for "pathTranslationStyle". Shown as "MinGW" with translation documented as `(C:\ -> C:/)` in the UI. As per the other modes, this translates `\` to `/` but stops there. There is no prefix/drive translation. ## Validation Steps Performed Run using `busybox ash` shell. Dragged directories and files from both local disks and network shares onto terminal. All were appropriately single quoted and had their backslashes replaced with forward slashes. They were directly usable by the `ash` shell. Language files containing the other options have been updated to include the new one. ## PR Checklist - [ ] Closes #xxx - [ ] Tests added/passed - [x] Documentation updated - [Docs PR #849](https://github.com/MicrosoftDocs/terminal/pull/849) - [ ] Schema updated (if necessary) Co-authored-by: Adam Butcher <adam@jessamine.uk> (cherry picked from commit 6682bed311a75be4d1d8e117bf2f514eb763a547) Service-Card-Id: PVTI_lADOAF3p4s4AxadtzgeAsM0 Service-Version: 1.23
This commit is contained in:
parent
29dc1fdd9c
commit
8701c4ffa0
@ -3114,12 +3114,13 @@
|
||||
},
|
||||
"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\".",
|
||||
"description": "Controls how file paths are transformed when they are dragged and dropped on the terminal. Possible values are \"none\", \"wsl\", \"cygwin\", \"msys2\" and \"mingw\".",
|
||||
"enum": [
|
||||
"none",
|
||||
"wsl",
|
||||
"cygwin",
|
||||
"msys2"
|
||||
"msys2",
|
||||
"mingw"
|
||||
],
|
||||
"type": "string"
|
||||
}
|
||||
|
||||
@ -26,7 +26,8 @@ namespace Microsoft.Terminal.Control
|
||||
None = 0,
|
||||
WSL,
|
||||
Cygwin,
|
||||
MSYS2
|
||||
MSYS2,
|
||||
MinGW,
|
||||
};
|
||||
|
||||
// Class Description:
|
||||
|
||||
@ -97,6 +97,7 @@ namespace winrt::Microsoft::Terminal::Control::implementation
|
||||
/* WSL */ L"/mnt/",
|
||||
/* Cygwin */ L"/cygdrive/",
|
||||
/* MSYS2 */ L"/",
|
||||
/* MinGW */ {},
|
||||
};
|
||||
static constexpr wil::zwstring_view sSingleQuoteEscape = L"'\\''";
|
||||
static constexpr auto cchSingleQuoteEscape = sSingleQuoteEscape.size();
|
||||
@ -119,6 +120,11 @@ namespace winrt::Microsoft::Terminal::Control::implementation
|
||||
pos += cchSingleQuoteEscape;
|
||||
}
|
||||
|
||||
if (translationStyle == PathTranslationStyle::MinGW)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (fullPath.size() >= 2 && fullPath.at(1) == L':')
|
||||
{
|
||||
// C:/foo/bar -> Cc/foo/bar
|
||||
|
||||
@ -2312,6 +2312,10 @@
|
||||
<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_PathTranslationStyleMinGW.Content" xml:space="preserve">
|
||||
<value>MinGW (C:\ -> C:/)</value>
|
||||
<comment>{Locked="MinGW","C:\","C:/"} An option to choose from for the "path translation" setting.</comment>
|
||||
</data>
|
||||
<data name="Profile_Delete_Orphaned.Header" xml:space="preserve">
|
||||
<value>Profil wird nicht mehr erkannt</value>
|
||||
</data>
|
||||
|
||||
@ -2316,6 +2316,10 @@
|
||||
<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_PathTranslationStyleMinGW.Content" xml:space="preserve">
|
||||
<value>MinGW (C:\ -> C:/)</value>
|
||||
<comment>{Locked="MinGW","C:\","C:/"} An option to choose from for the "path translation" setting.</comment>
|
||||
</data>
|
||||
<data name="Profile_Delete_Orphaned.Header" xml:space="preserve">
|
||||
<value>Profile no longer detected</value>
|
||||
</data>
|
||||
|
||||
@ -2312,6 +2312,10 @@
|
||||
<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_PathTranslationStyleMinGW.Content" xml:space="preserve">
|
||||
<value>MinGW (C:\ -> C:/)</value>
|
||||
<comment>{Locked="MinGW","C:\","C:/"} An option to choose from for the "path translation" setting.</comment>
|
||||
</data>
|
||||
<data name="Profile_Delete_Orphaned.Header" xml:space="preserve">
|
||||
<value>El perfil ya no se ha detectado</value>
|
||||
</data>
|
||||
|
||||
@ -2312,6 +2312,10 @@
|
||||
<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_PathTranslationStyleMinGW.Content" xml:space="preserve">
|
||||
<value>MinGW (C:\ -> C:/)</value>
|
||||
<comment>{Locked="MinGW","C:\","C:/"} An option to choose from for the "path translation" setting.</comment>
|
||||
</data>
|
||||
<data name="Profile_Delete_Orphaned.Header" xml:space="preserve">
|
||||
<value>Le profil n’est plus détecté</value>
|
||||
</data>
|
||||
|
||||
@ -2312,6 +2312,10 @@
|
||||
<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_PathTranslationStyleMinGW.Content" xml:space="preserve">
|
||||
<value>MinGW (C:\ -> C:/)</value>
|
||||
<comment>{Locked="MinGW","C:\","C:/"} An option to choose from for the "path translation" setting.</comment>
|
||||
</data>
|
||||
<data name="Profile_Delete_Orphaned.Header" xml:space="preserve">
|
||||
<value>Profilo non più rilevato</value>
|
||||
</data>
|
||||
|
||||
@ -2312,6 +2312,10 @@
|
||||
<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_PathTranslationStyleMinGW.Content" xml:space="preserve">
|
||||
<value>MinGW (C:\ -> C:/)</value>
|
||||
<comment>{Locked="MinGW","C:\","C:/"} An option to choose from for the "path translation" setting.</comment>
|
||||
</data>
|
||||
<data name="Profile_Delete_Orphaned.Header" xml:space="preserve">
|
||||
<value>プロファイルは検出されなくなりました</value>
|
||||
</data>
|
||||
|
||||
@ -2312,6 +2312,10 @@
|
||||
<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_PathTranslationStyleMinGW.Content" xml:space="preserve">
|
||||
<value>MinGW (C:\ -> C:/)</value>
|
||||
<comment>{Locked="MinGW","C:\","C:/"} An option to choose from for the "path translation" setting.</comment>
|
||||
</data>
|
||||
<data name="Profile_Delete_Orphaned.Header" xml:space="preserve">
|
||||
<value>Perfil não detectado</value>
|
||||
</data>
|
||||
|
||||
@ -2316,6 +2316,10 @@
|
||||
<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_PathTranslationStyleMinGW.Content" xml:space="preserve">
|
||||
<value>MinGW (C:\ -> C:/)</value>
|
||||
<comment>{Locked="MinGW","C:\","C:/"} An option to choose from for the "path translation" setting.</comment>
|
||||
</data>
|
||||
<data name="Profile_Delete_Orphaned.Header" xml:space="preserve">
|
||||
<value>Ρřσƒīŀē ⁿο łøňġèя ðёτęςτęď !!! !!! !</value>
|
||||
</data>
|
||||
|
||||
@ -2316,6 +2316,10 @@
|
||||
<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_PathTranslationStyleMinGW.Content" xml:space="preserve">
|
||||
<value>MinGW (C:\ -> C:/)</value>
|
||||
<comment>{Locked="MinGW","C:\","C:/"} An option to choose from for the "path translation" setting.</comment>
|
||||
</data>
|
||||
<data name="Profile_Delete_Orphaned.Header" xml:space="preserve">
|
||||
<value>Ρřσƒīŀē ⁿο łøňġèя ðёτęςτęď !!! !!! !</value>
|
||||
</data>
|
||||
|
||||
@ -2316,6 +2316,10 @@
|
||||
<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_PathTranslationStyleMinGW.Content" xml:space="preserve">
|
||||
<value>MinGW (C:\ -> C:/)</value>
|
||||
<comment>{Locked="MinGW","C:\","C:/"} An option to choose from for the "path translation" setting.</comment>
|
||||
</data>
|
||||
<data name="Profile_Delete_Orphaned.Header" xml:space="preserve">
|
||||
<value>Ρřσƒīŀē ⁿο łøňġèя ðёτęςτęď !!! !!! !</value>
|
||||
</data>
|
||||
|
||||
@ -2312,6 +2312,10 @@
|
||||
<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_PathTranslationStyleMinGW.Content" xml:space="preserve">
|
||||
<value>MinGW (C:\ -> C:/)</value>
|
||||
<comment>{Locked="MinGW","C:\","C:/"} An option to choose from for the "path translation" setting.</comment>
|
||||
</data>
|
||||
<data name="Profile_Delete_Orphaned.Header" xml:space="preserve">
|
||||
<value>Профиль больше не обнаруживается</value>
|
||||
</data>
|
||||
|
||||
@ -2312,6 +2312,10 @@
|
||||
<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_PathTranslationStyleMinGW.Content" xml:space="preserve">
|
||||
<value>MinGW (C:\ -> C:/)</value>
|
||||
<comment>{Locked="MinGW","C:\","C:/"} An option to choose from for the "path translation" setting.</comment>
|
||||
</data>
|
||||
<data name="Profile_Delete_Orphaned.Header" xml:space="preserve">
|
||||
<value>不再检测到配置文件</value>
|
||||
</data>
|
||||
|
||||
@ -2312,6 +2312,10 @@
|
||||
<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_PathTranslationStyleMinGW.Content" xml:space="preserve">
|
||||
<value>MinGW (C:\ -> C:/)</value>
|
||||
<comment>{Locked="MinGW","C:\","C:/"} An option to choose from for the "path translation" setting.</comment>
|
||||
</data>
|
||||
<data name="Profile_Delete_Orphaned.Header" xml:space="preserve">
|
||||
<value>已不再偵測到設定檔</value>
|
||||
</data>
|
||||
|
||||
@ -794,10 +794,11 @@ JSON_ENUM_MAPPER(::winrt::Microsoft::Terminal::Control::DefaultInputScope)
|
||||
|
||||
JSON_ENUM_MAPPER(::winrt::Microsoft::Terminal::Control::PathTranslationStyle)
|
||||
{
|
||||
static constexpr std::array<pair_type, 4> mappings = {
|
||||
static constexpr std::array<pair_type, 5> mappings = {
|
||||
pair_type{ "none", ValueType::None },
|
||||
pair_type{ "wsl", ValueType::WSL },
|
||||
pair_type{ "cygwin", ValueType::Cygwin },
|
||||
pair_type{ "msys2", ValueType::MSYS2 },
|
||||
pair_type{ "mingw", ValueType::MinGW },
|
||||
};
|
||||
};
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user