Skip to content
This repository was archived by the owner on Sep 6, 2021. It is now read-only.

Populate the replace input with the currently selected text#1962

Closed
jbalsas wants to merge 1 commit intoadobe:masterfrom
jbalsas:jbalsas/replace-selected-text
Closed

Populate the replace input with the currently selected text#1962
jbalsas wants to merge 1 commit intoadobe:masterfrom
jbalsas:jbalsas/replace-selected-text

Conversation

@jbalsas
Copy link
Copy Markdown
Contributor

@jbalsas jbalsas commented Oct 26, 2012

Currently, the actions "Find", "Find in Files", "Quick Open" and "Go to Definition" populate their input text with the currently selected text which doesn't happen for the "Replace" action.

I don't know if this is intentional. If not, this fixes it and populates the initial replace input with the current selection.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is now used in QuickOpen and FindInFiles (sort of) other than here. Maybe it would be worth refactoring at some point...

@couzteau
Copy link
Copy Markdown
Member

Have been missing this functionality badly

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't do any escaping, so it could break the HTML if there are quotes/etc. in the string.

Why not do it the same way as _launchFind()? That should work just as well for the Replace dialog. And since _replace() only does anything when there is an Editor available, I think you could ditch getCurrentEditorSelectedText() and follow _launchFind()'s example there too -- i.e. simpler logic for getting the initial string.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh I see... didn't notice that...

I'm closing this pull request then and will submit a new one following your directions soon

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants