Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changing between "find" and "replace" in regex mode corrupts state of find widget #31982

Closed
thw0rted opened this issue Aug 3, 2017 · 2 comments
Assignees
Labels
editor-find Editor find operations

Comments

@thw0rted
Copy link

thw0rted commented Aug 3, 2017

  • VSCode Version: Code 1.14.2 (cb82feb, 2017-07-19T23:26:08.116Z)
  • OS Version: Linux x64 4.10.0-28-generic
  • Extensions:
Extension Author (truncated) Version
xml Dot 1.9.2
EditorConfig Edi 0.9.4
html-css-class-completion Zig 1.8.0
path-intellisense chr 1.4.2
vscode-svgviewer css 1.4.2
vscode-eslint dba 1.2.11
githistory don 0.2.2
tslint eg2 0.17.0
Angular2 joh 2.4.0
debugger-for-chrome msj 3.1.7
vetur oct 0.9.3
vscode-icons rob 7.12.0

Steps to Reproduce:

  1. CTRL+F to show find widget, set Regex mode
  2. Type a simple regular expression that matches some text in your document. Make some minor changes by typing part of the expression, deleting with backspace, maybe move around the text field with the arrow keys.
  3. CTRL+Z / CTRL+Y several times to undo/redo typing the expression. Redo until the expression is complete, and ensure that some text in your document matches and gets highlighted.
  4. Once your expression matches something on the page, press CTRL+H. The "Find" field should change from the expression you just typed to the literal value that was matched. (This is unexpected behavior, IMHO, but isn't the worst part.) Your focus should now be in the "Replace" box.
  5. Tab or click back to the "Find" field.
  6. CTRL+Z several times, then CTRL+Y several times, to move back and forth through your undo history. You should see several characters erased, then replaced with totally different characters as matched literal text is "un-done" and regular expression control characters are "re-done".

Expected behavior:

Ideally, CTRL+F / CTRL+H would only populate the "Find" box with the document selection when it's currently empty. If you're going to insist on doing this, the undo/redo history should have one entry added at the end that consists of totally erasing the current contents and replacing them with the matched text, as though you had copied the text, selected the contents of the "Find" box, then pasted.

@vscodebot vscodebot bot added editor editor-find Editor find operations labels Aug 3, 2017
@rebornix
Copy link
Member

rebornix commented Aug 3, 2017

If you don't like the auto population of selection, you can disable it by setting editor.find.seedSearchStringFromSelection to false.

The undo/redo history issue is tracked in #27035

@rebornix rebornix closed this as completed Aug 3, 2017
@thw0rted
Copy link
Author

thw0rted commented Aug 4, 2017

I don't want to turn seedSearchString off for most cases, I like that it populates the widget when it was not already open. The problem is that you can't use "find" to find something then switch to "replace", at least in regex mode, because of the behavior I described in bullet 4 of the OP. Should I file a separate suggestion to change the behavior to only "seed" when the widget is first opened?

@vscodebot vscodebot bot locked and limited conversation to collaborators Nov 17, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
editor-find Editor find operations
Projects
None yet
Development

No branches or pull requests

2 participants