sublimehq / sublime_text

Issue tracker for Sublime Text
https://www.sublimetext.com
812 stars 39 forks source link

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

Open FichteFoll opened 8 years ago

FichteFoll commented 8 years ago

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 commented 8 years ago

Related (albeit the opposite), a request to have the history for the two panels independent: https://github.com/SublimeTextIssues/Core/issues/798

AndreyMZ commented 8 years ago

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 commented 8 years ago

@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 commented 8 years ago

Now:

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 commented 5 years ago

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 commented 5 years ago

... 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 commented 4 years ago

Same here. https://forum.sublimetext.com/t/usability-issue-find-ui-looses-previously-entered-value/51927 Version 3.2.1, Build 3207