History completion by both URL and title.

Resolves #1649.
This commit is contained in:
Ryan Roden-Corrent 2017-12-05 07:31:55 -05:00
parent 7ef64c0f87
commit 636f9edff6
2 changed files with 5 additions and 1 deletions

View File

@ -47,7 +47,7 @@ class HistoryCategory(QSqlQueryModel):
"FROM CompletionHistory", "FROM CompletionHistory",
# the incoming pattern will have literal % and _ escaped with '\' # the incoming pattern will have literal % and _ escaped with '\'
# we need to tell sql to treat '\' as an escape character # we need to tell sql to treat '\' as an escape character
"WHERE (url LIKE :pat escape '\\' or title LIKE :pat escape '\\')", "WHERE ((url || title) LIKE :pat escape '\\')",
self._atime_expr(), self._atime_expr(),
"ORDER BY last_atime DESC", "ORDER BY last_atime DESC",
]), forward_only=False) ]), forward_only=False)

View File

@ -78,6 +78,10 @@ def hist(init_sql, config_stub):
("can't", ("can't",
[("can't touch this", ''), ('a', '')], [("can't touch this", ''), ('a', '')],
[("can't touch this", '')]), [("can't touch this", '')]),
("ample itle",
[('example.com', 'title'), ('example.com', 'nope')],
[('example.com', 'title')]),
]) ])
def test_set_pattern(pattern, before, after, model_validator, hist): def test_set_pattern(pattern, before, after, model_validator, hist):
"""Validate the filtering and sorting results of set_pattern.""" """Validate the filtering and sorting results of set_pattern."""