Use CommandDispatcher directly for / searches

This commit is contained in:
Jay Kamat 2018-04-19 21:16:33 -04:00
parent cbb246fd0b
commit 1d2dd5bf55
No known key found for this signature in database
GPG Key ID: 5D2E399600F4F7B5

View File

@ -19,6 +19,8 @@
"""The commandline in the statusbar.""" """The commandline in the statusbar."""
import functools
from PyQt5.QtCore import pyqtSignal, pyqtSlot, Qt, QSize from PyQt5.QtCore import pyqtSignal, pyqtSlot, Qt, QSize
from PyQt5.QtWidgets import QSizePolicy from PyQt5.QtWidgets import QSizePolicy
@ -69,10 +71,12 @@ class Command(misc.MinimalLineEditMixin, misc.CommandLineEdit):
self.textChanged.connect(self.updateGeometry) self.textChanged.connect(self.updateGeometry)
self.textChanged.connect(self._incremental_search) self.textChanged.connect(self._incremental_search)
search_fn = cmdutils.cmd_dict['search'].run dispatcher = objreg.get('command-dispatcher',
scope='window', window=self._win_id)
search_fn = dispatcher.search
self.search_prefixes = { self.search_prefixes = {
'/': lambda search: search_fn(self._win_id, ["--", search]), '/': search_fn,
'?': lambda search: search_fn(self._win_id, ["-r", "--", search]), '?': functools.partial(search_fn, reverse=True)
} }
def prefix(self): def prefix(self):