From 4734e1c8bc74ba451d7da2e2452f0c4b3b45f986 Mon Sep 17 00:00:00 2001 From: Rob Lourens Date: Fri, 1 Jun 2018 19:20:37 -0700 Subject: [PATCH] Fix #50893 - escape regex chars when copy search string from editor --- src/vs/workbench/parts/search/browser/searchView.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/vs/workbench/parts/search/browser/searchView.ts b/src/vs/workbench/parts/search/browser/searchView.ts index 98768f619cdbe..49f0b837750c8 100644 --- a/src/vs/workbench/parts/search/browser/searchView.ts +++ b/src/vs/workbench/parts/search/browser/searchView.ts @@ -732,8 +732,12 @@ export class SearchView extends Viewlet implements IViewlet, IPanel { let updatedText = false; const seedSearchStringFromSelection = this.configurationService.getValue('editor').find.seedSearchStringFromSelection; if (seedSearchStringFromSelection) { - const selectedText = this.getSearchTextFromEditor(); + let selectedText = this.getSearchTextFromEditor(); if (selectedText) { + if (this.searchWidget.searchInput.getRegex()) { + selectedText = strings.escapeRegExpCharacters(selectedText); + } + this.searchWidget.searchInput.setValue(selectedText); updatedText = true; }