Skip to content

Find Next Selection, regex enabled: preserve escaping #38232

@OnlineCop

Description

@OnlineCop
  • VSCode Version: Code 1.18.0 (dcee220, 2017-11-08T12:44:48.751Z)
  • OS Version: Linux x64 4.4.0-98-generic
  • Extensions:
Extension Author (truncated) Version
sort-lines Tyr 1.3.0
code-gnu-global aus 0.2.2
CppSnippets har 0.0.13
cmake-tools-helper mad 0.1.1
cpptools ms- 0.14.2
cmake-tools vec 0.10.3
clang-format xav 1.6.1

I'm editing C++, C#, Javascript, Java, although this appears reproducible regardless of language.

I have ctrl+f bound to actions.find. Regex is enabled, and if I select text containing any regex meta-characters, those are properly escaped in the Find window: { "key": "ctrl+f", "command": "actions.find" } becomes \{ "key": "ctrl\+f", "command": "actions\.find" \}

I have ctrl+f3 bound to editor.action.nextSelectionMatchFindAction. Regex is (still) enabled, and if I select text containing regex meta-characters, those are NOT properly escaped in the Find window: { "key": "ctrl+f", "command": "actions.find" } remains { "key": "ctrl+f", "command": "actions.find" } which is then an invalid regex pattern.


Steps to Reproduce:

  1. Select text that contains regex meta-characters: .*+{}[]
  2. Press ctrl+f or go to Edit->Find to open the Find window. If Use Regular Expression (Alt+R) is not already selected, press alt+r and (with the text still selected), press ctrl+f again so text in the Find window updates.
  3. Text in the Find window should be escaped.

This is correct behavior.

  1. Select text that contains regex meta-characters: .*+{}[]
  2. Press ctrl+f3 to open the Find window with that text selected.
  3. Toggle Use Regular Expression (Alt+R), then press ctrl+f3 again so text in the Find window updates.
  4. Text in the Find window is not escaped.

I would expect the text to be escaped, like it is with actions.find.

Reproduces without extensions: Yes

Metadata

Metadata

Assignees

Labels

bugIssue identified by VS Code Team member as probable bugeditor-findEditor find operationsverifiedVerification succeeded

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions