Search now scrolls into view

This commit is contained in:
itdominator 2021-12-10 21:05:38 -06:00
parent f67f42b14b
commit b651cde967
2 changed files with 11 additions and 5 deletions

View File

@ -10,7 +10,7 @@ from gi.repository import Gtk, Gdk
# Application imports
valid_fname_pat = re.compile(r"[a-z0-9A-Z-_\[\]\(\)\| ]")
valid_keyvalue_pat = re.compile(r"[a-z0-9A-Z-_\[\]\(\)\| ]")
class KeyboardSignalsMixin:
@ -44,10 +44,11 @@ class KeyboardSignalsMixin:
self.trash_files()
if re.fullmatch(valid_fname_pat, keyname):
if not self.ctrlDown and not self.shiftDown and not self.altDown:
focused_obj = self.window.get_focus()
if not self.is_searching and isinstance(focused_obj, Gtk.IconView):
if re.fullmatch(valid_keyvalue_pat, keyname):
if not self.is_searching and not self.ctrlDown \
and not self.shiftDown and not self.altDown:
focused_obj = self.window.get_focus()
if isinstance(focused_obj, Gtk.IconView):
self.is_searching = True
wid, tid, self.search_view, self.search_iconview, store = self.get_current_state()
self.popup_search_files(wid, keyname)

View File

@ -69,6 +69,11 @@ class WidgetFileActionMixin:
path = Gtk.TreePath().new_from_indices([i])
self.search_iconview.select_path(path)
items = self.search_iconview.get_selected_items()
if len(items) == 1:
self.search_iconview.scroll_to_path(items[0], True, 0.5, 0.5)
def open_files(self):
wid, tid, view, iconview, store = self.get_current_state()
uris = self.format_to_uris(store, wid, tid, self.selected_files, True)