Norm search

This commit is contained in:
RumovZ 2020-12-22 11:08:47 +01:00
parent 5b24d9e4a6
commit b712053c06

View File

@ -188,6 +188,7 @@ class DataModel(QAbstractTableModel):
ctx = SearchContext(search=txt, browser=self.browser)
gui_hooks.browser_will_search(ctx)
if ctx.card_ids is None:
ctx.search = self.browser.norm_search(ctx.search)
ctx.card_ids = self.col.find_cards(ctx.search, order=ctx.order)
gui_hooks.browser_did_search(ctx)
self.cards = ctx.card_ids
@ -818,6 +819,12 @@ class Browser(QMainWindow):
# no row change will fire
self._onRowChanged(None, None)
def norm_search(self, search: str) -> str:
normed = self.col.backend.norm_search(search)
self._lastSearchTxt = normed
self.form.searchEdit.lineEdit().setText(normed)
return normed
def updateTitle(self):
selected = len(self.form.tableView.selectionModel().selectedRows())
cur = len(self.model.cards)