mirror of
https://github.com/microsoft/terminal.git
synced 2026-05-21 06:18:34 +00:00
add a flag for wrapping in quotes too
This commit is contained in:
@@ -911,7 +911,12 @@ namespace winrt::TerminalApp::implementation
|
||||
const auto selections{ termControl.SelectedText(true) };
|
||||
if (selections.Size() == 1) // TODO! should theoretically be able to work for multiple lines of selection
|
||||
{
|
||||
const auto finalString = queryUrl + Windows::Foundation::Uri::EscapeComponent(selections.GetAt(0));
|
||||
auto selectedText = selections.GetAt(0);
|
||||
if (realArgs.WrapWithQuotes())
|
||||
{
|
||||
selectedText = L"\"" + selectedText + L"\"";
|
||||
}
|
||||
const auto finalString = queryUrl + Windows::Foundation::Uri::EscapeComponent(selectedText);
|
||||
winrt::Microsoft::Terminal::Control::OpenHyperlinkEventArgs shortcut{ finalString };
|
||||
_OpenHyperlinkHandler(termControl, shortcut);
|
||||
args.Handled(true);
|
||||
|
||||
@@ -202,8 +202,9 @@ private:
|
||||
X(winrt::hstring, Name, "name", false, L"")
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
#define SEARCH_FOR_TEXT_ARGS(X) \
|
||||
X(winrt::hstring, QueryUrl, "queryUrl", false, L"")
|
||||
#define SEARCH_FOR_TEXT_ARGS(X) \
|
||||
X(winrt::hstring, QueryUrl, "queryUrl", false, L"") \
|
||||
X(bool, WrapWithQuotes, "wrapWithQuotes", false, true)
|
||||
//TODO! this should have some validation!
|
||||
// Maybe in post though. Maybe at runtime make sure QueryUrl starts with "http:"
|
||||
|
||||
|
||||
@@ -330,6 +330,7 @@ namespace Microsoft.Terminal.Settings.Model
|
||||
[default_interface] runtimeclass SearchForTextArgs : IActionArgs
|
||||
{
|
||||
String QueryUrl { get; };
|
||||
Boolean WrapWithQuotes { get; };
|
||||
};
|
||||
|
||||
[default_interface] runtimeclass GlobalSummonArgs : IActionArgs
|
||||
|
||||
Reference in New Issue
Block a user