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

Opening the Find and Replace panel while the Find panel is already active should take over the find pattern #1480

Open
FichteFoll opened this issue Nov 2, 2016 · 7 comments

Comments

@FichteFoll
Copy link
Collaborator

FichteFoll commented Nov 2, 2016

Summary

It happens quite frequently that I open the find panel, I modify the find pattern and later realize that I need to do a replace action. So I open the replace panel but the find pattern I already entered is lost, which is quite annoying. Instead, the pattern should be taken over if the find panel was open already.

Steps to reproduce

  1. Select some text
  2. Open find panel
  3. Enter a pattern
  4. Open replace panel

Desired behavior

The "Find What:" field takes over the pattern from the previously opened find panel.

Actual behavior

The "Find What:" field gets filled with the current selection in the view.

@keith-hall
Copy link
Collaborator

Related (albeit the opposite), a request to have the history for the two panels independent: #798

@AndreyMZ
Copy link

AndreyMZ commented Nov 7, 2016

I think #798 is not opposite.
This issue is about "Find" (Ctrl+F) and "Replace" (Ctrl+H) panels.
#798 is about "Find" (Ctrl+F) and "Find in Files" (Ctrl+Shift+F) panels.

@keith-hall
Copy link
Collaborator

@AndreyMZ I feel that it is still potentially relevant, in the sense that, there is some crossover when moving from the "Find" or "Replace" panel to the "Find in Files" panel. For example, if you had independent settings, would you expect, when switching to the "Find in Files" panel from "Find" or "Replace", that the settings would be copied across with the search pattern/text or not?

@AndreyMZ
Copy link

AndreyMZ commented Nov 7, 2016

Now:

  • When we switch any way between "Find", "Replace" and "Find in Files" and no text is selected in the file editor, everything possible is copied across.
  • When we switch any way between "Find", "Replace" and "Find in Files" and some text is selected in the file editor, everything possible is copied across, but the find pattern is overridden by the text selected.

On #798 I expect that when we switch from "Find" or "Replace" to "Find in Files" (or back from "Find in Files" to "Find" or "Replace"), nothing is copied across. I do not care if the find pattern is overridden by the text selected or not.

On this issue I believe @FichteFoll expects that when we switch from "Find" to "Replace" (or back from "Replace" to "Find") and some text is selected in the file editor, everything possible is copied across and the find pattern is NOT overridden by the text selected.

@deathaxe
Copy link
Collaborator

The culprit is ST performing a search run with the entered "find" pattern, when switching panels (Find <-> Replace <-> Find in Files). What we see in the new panel is the result of that search.

@wbond Hence I would mark that an issue rather an enhancement.

Steps to reproduce

  1. Open a file, which contains random words and "loadus", but not "loaduser".
  2. Open the search via ctrl+f
  3. Enter "loaduser" into the search intput.
  4. Press ctrl+shift+f
  5. ST runs the local search, finds "loadus", and adds it to the global search input field.

Here is a forum post about it:
https://forum.sublimetext.com/t/local-search-query-doesnt-carry-over-to-global-search/16128

@deathaxe
Copy link
Collaborator

... but instead using the current selection in the document when opening the new panel.

This comment from from the forum narrows down the reason for the described behavior more clearly. While picking up the current selection when pressing ctrl+f, ctrl+h or ctrl+shift+h is a helpful feature, it should propably be disabled if a search panel is already open and is focused.

If the caret is within one of the input fields of a find/replace panel, there is nothing new to pick up when switching to another panel. This is the one and only situation the content of the search field should remain unchanged.

@annazolkieve
Copy link

@deathaxe deathaxe mentioned this issue Apr 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants