mirror of
https://github.com/microsoft/terminal.git
synced 2026-04-05 21:59:47 +00:00
Add setting for customizable delimiter for file drag-and-drop (#19799)
## Summary of the Pull Request This PR introduces a new profile setting, `dragDropDelimiter`, which allows users to configure the string separator used when dragging and dropping multiple files into the terminal. The default behavior remains a single space (`" "`) for backward compatibility. ## References and Relevant Issues * Closes #19565 ## Detailed Description of the Pull Request / Additional comments **Implementation Details:** * **Settings:** Added `DragDropDelimiter` to `MTSMSettings.h` and `Profile.idl`. * **Control:** Wired the setting through `ControlProperties.h` so the terminal logic can see it. * **Logic:** Updated `TermControl::OnDrop` to use the new delimiter when joining paths. * **UI:** Added the text box in the Advanced Settings page and updated the ViewModel. ## Validation Steps Performed * **Manual Verification:** * Verified default behavior (space separator) works as before. * Configured `dragDropDelimiter` to `", "`, `";"`, and custom strings in `settings.json` and from settings UI. * Confirmed dropped files are joined correctly. * **Build:** Validated that the solution builds cleanly. ## Notes for Reviewers 1. **Delimiter Length:** Currently, there is no limit on the maximum length of the delimiter string. Let me know if this should be changed. 3. **Localization:** I changed only `Resources/en-US` file. 4. **ViewModel:** In `ProfileViewModel.cpp`, I added the `else if` block for the new setting, but left it empty because no other UI logic currently depends on it. ## PR Checklist - [x] Closes #19565 - [ ] Documentation updated - [x] Schema updated (if necessary)
This commit is contained in:
@@ -3174,6 +3174,11 @@
|
|||||||
"mingw"
|
"mingw"
|
||||||
],
|
],
|
||||||
"type": "string"
|
"type": "string"
|
||||||
|
},
|
||||||
|
"dragDropDelimiter": {
|
||||||
|
"default": " ",
|
||||||
|
"description": "The delimiter used when dropping multiple files onto the terminal.",
|
||||||
|
"type": "string"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -76,6 +76,7 @@ namespace Microsoft.Terminal.Control
|
|||||||
Boolean RepositionCursorWithMouse { get; };
|
Boolean RepositionCursorWithMouse { get; };
|
||||||
|
|
||||||
PathTranslationStyle PathTranslationStyle { get; };
|
PathTranslationStyle PathTranslationStyle { get; };
|
||||||
|
String DragDropDelimiter { 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!
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -3060,7 +3060,7 @@ namespace winrt::Microsoft::Terminal::Control::implementation
|
|||||||
// the full path of the file to our terminal connection. Like conhost, if
|
// the full path of the file to our terminal connection. Like conhost, if
|
||||||
// the path contains a space, we'll wrap the path in quotes.
|
// the path contains a space, we'll wrap the path in quotes.
|
||||||
// - Unlike conhost, if multiple files are dropped onto the terminal, we'll
|
// - Unlike conhost, if multiple files are dropped onto the terminal, we'll
|
||||||
// write all the paths to the terminal, separated by spaces.
|
// write all the paths to the terminal, separated by the configured delimiter.
|
||||||
// Arguments:
|
// Arguments:
|
||||||
// - e: The DragEventArgs from the Drop event
|
// - e: The DragEventArgs from the Drop event
|
||||||
// Return Value:
|
// Return Value:
|
||||||
@@ -3181,12 +3181,13 @@ namespace winrt::Microsoft::Terminal::Control::implementation
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::wstring allPathsString;
|
std::wstring allPathsString;
|
||||||
|
const auto delimiter{ _core.Settings().DragDropDelimiter() };
|
||||||
for (auto& fullPath : fullPaths)
|
for (auto& fullPath : fullPaths)
|
||||||
{
|
{
|
||||||
// Join the paths with spaces
|
// Join the paths with the delimiter
|
||||||
if (!allPathsString.empty())
|
if (!allPathsString.empty())
|
||||||
{
|
{
|
||||||
allPathsString += L" ";
|
allPathsString += delimiter;
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto translationStyle{ _core.Settings().PathTranslationStyle() };
|
const auto translationStyle{ _core.Settings().PathTranslationStyle() };
|
||||||
|
|||||||
@@ -353,6 +353,7 @@ namespace winrt::Microsoft::Terminal::Settings
|
|||||||
_AllowVtChecksumReport = profile.AllowVtChecksumReport();
|
_AllowVtChecksumReport = profile.AllowVtChecksumReport();
|
||||||
_AllowVtClipboardWrite = profile.AllowVtClipboardWrite();
|
_AllowVtClipboardWrite = profile.AllowVtClipboardWrite();
|
||||||
_PathTranslationStyle = profile.PathTranslationStyle();
|
_PathTranslationStyle = profile.PathTranslationStyle();
|
||||||
|
_DragDropDelimiter = profile.DragDropDelimiter();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Method Description:
|
// Method Description:
|
||||||
|
|||||||
@@ -145,6 +145,7 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
|
|||||||
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);
|
OBSERVABLE_PROJECTED_SETTING(_profile, PathTranslationStyle);
|
||||||
|
OBSERVABLE_PROJECTED_SETTING(_profile, DragDropDelimiter);
|
||||||
|
|
||||||
WINRT_PROPERTY(bool, IsBaseLayer, false);
|
WINRT_PROPERTY(bool, IsBaseLayer, false);
|
||||||
WINRT_PROPERTY(bool, FocusDeleteButton, false);
|
WINRT_PROPERTY(bool, FocusDeleteButton, false);
|
||||||
|
|||||||
@@ -139,6 +139,7 @@ namespace Microsoft.Terminal.Settings.Editor
|
|||||||
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);
|
OBSERVABLE_PROJECTED_PROFILE_SETTING(Microsoft.Terminal.Control.PathTranslationStyle, PathTranslationStyle);
|
||||||
|
OBSERVABLE_PROJECTED_PROFILE_SETTING(String, DragDropDelimiter);
|
||||||
OBSERVABLE_PROJECTED_PROFILE_SETTING(Boolean, AllowVtClipboardWrite);
|
OBSERVABLE_PROJECTED_PROFILE_SETTING(Boolean, AllowVtClipboardWrite);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -272,6 +272,16 @@
|
|||||||
Style="{StaticResource ComboBoxSettingStyle}" />
|
Style="{StaticResource ComboBoxSettingStyle}" />
|
||||||
</local:SettingContainer>
|
</local:SettingContainer>
|
||||||
|
|
||||||
|
<!-- Drag Drop Delimiter -->
|
||||||
|
<local:SettingContainer x:Name="DragDropDelimiter"
|
||||||
|
x:Uid="Profile_DragDropDelimiter"
|
||||||
|
ClearSettingValue="{x:Bind Profile.ClearDragDropDelimiter}"
|
||||||
|
HasSettingValue="{x:Bind Profile.HasDragDropDelimiter, Mode=OneWay}"
|
||||||
|
SettingOverrideSource="{x:Bind Profile.DragDropDelimiterOverrideSource, Mode=OneWay}">
|
||||||
|
<TextBox Style="{StaticResource TextBoxSettingStyle}"
|
||||||
|
Text="{x:Bind Profile.DragDropDelimiter, Mode=TwoWay}" />
|
||||||
|
</local:SettingContainer>
|
||||||
|
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Page>
|
</Page>
|
||||||
|
|||||||
@@ -2748,4 +2748,12 @@
|
|||||||
<value>Type to filter icons</value>
|
<value>Type to filter icons</value>
|
||||||
<comment>Placeholder text for a text box to filter and select an icon.</comment>
|
<comment>Placeholder text for a text box to filter and select an icon.</comment>
|
||||||
</data>
|
</data>
|
||||||
</root>
|
<data name="Profile_DragDropDelimiter.Header" xml:space="preserve">
|
||||||
|
<value>Drag and drop delimiter</value>
|
||||||
|
<comment>Header for a control to set the delimiter used when dragging multiple files into the terminal.</comment>
|
||||||
|
</data>
|
||||||
|
<data name="Profile_DragDropDelimiter.HelpText" xml:space="preserve">
|
||||||
|
<value>This text will be inserted between the paths of multiple files dropped into the terminal.</value>
|
||||||
|
<comment>A description for what the "drag drop delimiter" setting does.</comment>
|
||||||
|
</data>
|
||||||
|
</root>
|
||||||
|
|||||||
@@ -108,6 +108,7 @@ Author(s):
|
|||||||
X(bool, AllowVtChecksumReport, "compatibility.allowDECRQCRA", false) \
|
X(bool, AllowVtChecksumReport, "compatibility.allowDECRQCRA", false) \
|
||||||
X(bool, AllowVtClipboardWrite, "compatibility.allowOSC52", true) \
|
X(bool, AllowVtClipboardWrite, "compatibility.allowOSC52", true) \
|
||||||
X(bool, AllowKeypadMode, "compatibility.allowDECNKM", false) \
|
X(bool, AllowKeypadMode, "compatibility.allowDECNKM", false) \
|
||||||
|
X(hstring, DragDropDelimiter, "dragDropDelimiter", L" ") \
|
||||||
X(Microsoft::Terminal::Control::PathTranslationStyle, PathTranslationStyle, "pathTranslationStyle", Microsoft::Terminal::Control::PathTranslationStyle::None)
|
X(Microsoft::Terminal::Control::PathTranslationStyle, PathTranslationStyle, "pathTranslationStyle", Microsoft::Terminal::Control::PathTranslationStyle::None)
|
||||||
|
|
||||||
// Intentionally omitted Profile settings:
|
// Intentionally omitted Profile settings:
|
||||||
|
|||||||
@@ -94,5 +94,6 @@ namespace Microsoft.Terminal.Settings.Model
|
|||||||
INHERITABLE_PROFILE_SETTING(Boolean, AllowVtClipboardWrite);
|
INHERITABLE_PROFILE_SETTING(Boolean, AllowVtClipboardWrite);
|
||||||
|
|
||||||
INHERITABLE_PROFILE_SETTING(Microsoft.Terminal.Control.PathTranslationStyle, PathTranslationStyle);
|
INHERITABLE_PROFILE_SETTING(Microsoft.Terminal.Control.PathTranslationStyle, PathTranslationStyle);
|
||||||
|
INHERITABLE_PROFILE_SETTING(String, DragDropDelimiter);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -87,4 +87,5 @@
|
|||||||
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)
|
X(winrt::Microsoft::Terminal::Control::PathTranslationStyle, PathTranslationStyle, winrt::Microsoft::Terminal::Control::PathTranslationStyle::None) \
|
||||||
|
X(winrt::hstring, DragDropDelimiter, L" ")
|
||||||
|
|||||||
Reference in New Issue
Block a user