Repository: spyder-ide/spyder

Issue:
Find pane issues and details
Some issues and details that needed to be worked out in the Find pane

- [ ] The hamburger menu is not the same as in 4.x (some actions are not being listed)
- [ ] The label of the directory was changed (from `Search in:` to `Location`).
- [ ] A label that says `Search` was added to the combobox used to type search terms but the button already says `Search` on the right (so it is kind of redundant).
- [ ] In the Editor having a word selected and hitting `Cmd + Shift + F`/`Ctrl + Shift  + F` doesn’t automatically start a search.



Discussion:
@goanpeca could you look into the listed elements? Thanks!

Resolving patch:
diff --git a/spyder/config/main.py b/spyder/config/main.py
--- a/spyder/config/main.py
+++ b/spyder/config/main.py
@@ -495,6 +495,8 @@
               'explorer/paste file': 'Ctrl+V',
               'explorer/copy absolute path': 'Ctrl+Alt+C',
               'explorer/copy relative path': 'Ctrl+Alt+Shift+C',
+              # ---- In plugins/findinfiles/plugin ----
+              'find_in_files/find in files': 'Ctrl+Alt+F',
               }),
             ('appearance', APPEARANCE),
             ('lsp-server',
diff --git a/spyder/plugins/findinfiles/plugin.py b/spyder/plugins/findinfiles/plugin.py
--- a/spyder/plugins/findinfiles/plugin.py
+++ b/spyder/plugins/findinfiles/plugin.py
@@ -9,6 +9,7 @@
 
 # Third party imports
 from qtpy.QtCore import Qt
+from qtpy.QtWidgets import QApplication
 
 # Local imports
 from spyder.api.menus import ApplicationMenus
@@ -26,7 +27,7 @@
 # --- Constants
 # ----------------------------------------------------------------------------
 class FindInFilesActions:
-    FindInFiles = 'find_in_files_action'
+    FindInFiles = 'find in files'
 
 
 # --- Plugin
@@ -72,13 +73,19 @@ def register(self):
             working_directory.sig_current_directory_changed.connect(
                 self.refresh_search_directory)
 
-        findinfiles_action = self.get_action(FindInFilesWidgetActions.Find)
+        findinfiles_action = self.create_action(
+            FindInFilesActions.FindInFiles,
+            text=_("Find in files"),
+            tip=_("Search text in multiple files"),
+            triggered=self.find,
+            register_shortcut=True,
+            context=Qt.WindowShortcut
+        )
         menu = self.get_application_menu(ApplicationMenus.Search)
         self.add_item_to_application_menu(
             findinfiles_action,
             menu=menu,
         )
-        findinfiles_action.triggered.connect(lambda: self.switch_to_plugin())
 
         search_toolbar = self.get_application_toolbar(
             ApplicationToolBars.Search)
@@ -144,9 +151,27 @@ def unset_project_path(self):
     def find(self):
         """
         Search text in multiple files.
+
+        Notes
+        -----
+        Find in files using the currently selected text of the focused widget.
         """
+        focus_widget = QApplication.focusWidget()
+        text = ''
+        try:
+            if focus_widget.has_selected_text():
+                text = focus_widget.get_selected_text()
+        except AttributeError:
+            # This is not a text widget deriving from TextEditBaseWidget
+            pass
+
         self.switch_to_plugin()
-        self.get_widget().find()
+        widget = self.get_widget()
+
+        if text:
+            widget.set_search_text(text)
+
+        widget.find()
 
 
 def test():
diff --git a/spyder/plugins/findinfiles/widgets.py b/spyder/plugins/findinfiles/widgets.py
--- a/spyder/plugins/findinfiles/widgets.py
+++ b/spyder/plugins/findinfiles/widgets.py
@@ -878,8 +878,7 @@ def __init__(self, name=None, plugin=None, parent=None,
             search_text,
             _("Search pattern"),
         )
-        self.search_label = QLabel(_('Search:'))
-        self.search_in_label = QLabel(_('Location:'))
+        self.search_in_label = QLabel(_('Search in:'))
         self.exclude_label = QLabel(_('Exclude:'))
         self.path_selection_combo = SearchInComboBox(path_history, self)
         self.exclude_pattern_edit = PatternComboBox(
@@ -894,15 +893,7 @@ def __init__(self, name=None, plugin=None, parent=None,
         )
 
         # Setup
-        self.search_label.setBuddy(self.search_text_edit)
         self.exclude_label.setBuddy(self.exclude_pattern_edit)
-
-        fm = self.search_label.fontMetrics()
-        base_size = int(fm.width(_('Location:')) * 1.2)
-        self.search_label.setMinimumWidth(base_size)
-        self.search_in_label.setMinimumWidth(base_size)
-        self.exclude_label.setMinimumWidth(base_size)
-
         exclude_idx = self.get_option('exclude_index')
         if (exclude_idx is not None and exclude_idx >= 0
                 and exclude_idx < self.exclude_pattern_edit.count()):
@@ -997,9 +988,9 @@ def setup(self, options=DEFAULT_OPTIONS):
 
         # Toolbar
         toolbar = self.get_main_toolbar()
-        for item in [self.search_label, self.search_text_edit,
-                     self.search_regexp_action, self.case_action,
-                     self.more_options_action, self.find_action]:
+        for item in [self.search_text_edit, self.search_regexp_action,
+                     self.case_action, self.more_options_action,
+                     self.find_action]:
             self.add_item_to_toolbar(
                 item,
                 toolbar=toolbar,


Test patch:
diff --git a/spyder/app/tests/test_mainwindow.py b/spyder/app/tests/test_mainwindow.py
--- a/spyder/app/tests/test_mainwindow.py
+++ b/spyder/app/tests/test_mainwindow.py
@@ -2452,7 +2452,7 @@ def test_preferences_change_font_regression(main_window, qtbot):
 
 @pytest.mark.slow
 @pytest.mark.skipif(
-    sys.platform == 'darwin',
+    not sys.platform.startswith('linux'),
     reason="Changes of Shitf+Return shortcut cause an ambiguos shortcut")
 def test_preferences_empty_shortcut_regression(main_window, qtbot):
     """