Use SQL completer for quickmarks/bookmarks.
This commit is contained in:
parent
839d49a8ac
commit
52d7d1df0c
@ -22,7 +22,7 @@
|
||||
from qutebrowser.config import config, configdata
|
||||
from qutebrowser.utils import objreg, log, qtutils
|
||||
from qutebrowser.commands import cmdutils
|
||||
from qutebrowser.completion.models import base
|
||||
from qutebrowser.completion.models import base, sqlmodel
|
||||
|
||||
|
||||
def command():
|
||||
@ -64,20 +64,16 @@ def helptopic():
|
||||
def quickmark():
|
||||
"""A CompletionModel filled with all quickmarks."""
|
||||
model = base.CompletionModel()
|
||||
cat = model.new_category("Quickmarks")
|
||||
quickmarks = objreg.get('quickmark-manager').marks.items()
|
||||
for qm_name, qm_url in quickmarks:
|
||||
model.new_item(cat, qm_name, qm_url)
|
||||
model = sqlmodel.SqlCompletionModel(column_widths=(30, 70, 0))
|
||||
model.new_category('Quickmarks')
|
||||
return model
|
||||
|
||||
|
||||
def bookmark():
|
||||
"""A CompletionModel filled with all bookmarks."""
|
||||
model = base.CompletionModel()
|
||||
cat = model.new_category("Bookmarks")
|
||||
bookmarks = objreg.get('bookmark-manager').marks.items()
|
||||
for bm_url, bm_title in bookmarks:
|
||||
model.new_item(cat, bm_url, bm_title)
|
||||
model = sqlmodel.SqlCompletionModel(column_widths=(30, 70, 0))
|
||||
model.new_category('Bookmarks')
|
||||
return model
|
||||
|
||||
|
||||
|
@ -228,7 +228,6 @@ def test_help_completion(qtmodeltester, monkeypatch, stubs, key_config_stub):
|
||||
})
|
||||
|
||||
|
||||
@pytest.mark.skip
|
||||
def test_quickmark_completion(qtmodeltester, quickmarks):
|
||||
"""Test the results of quickmark completion."""
|
||||
model = miscmodels.quickmark()
|
||||
@ -237,14 +236,13 @@ def test_quickmark_completion(qtmodeltester, quickmarks):
|
||||
|
||||
_check_completions(model, {
|
||||
"Quickmarks": [
|
||||
('aw', 'https://wiki.archlinux.org', ''),
|
||||
('ddg', 'https://duckduckgo.com', ''),
|
||||
('wiki', 'https://wikipedia.org', ''),
|
||||
('aw', 'https://wiki.archlinux.org', None),
|
||||
('ddg', 'https://duckduckgo.com', None),
|
||||
('wiki', 'https://wikipedia.org', None),
|
||||
]
|
||||
})
|
||||
|
||||
|
||||
@pytest.mark.skip
|
||||
def test_bookmark_completion(qtmodeltester, bookmarks):
|
||||
"""Test the results of bookmark completion."""
|
||||
model = miscmodels.bookmark()
|
||||
@ -253,9 +251,9 @@ def test_bookmark_completion(qtmodeltester, bookmarks):
|
||||
|
||||
_check_completions(model, {
|
||||
"Bookmarks": [
|
||||
('https://github.com', 'GitHub', ''),
|
||||
('https://python.org', 'Welcome to Python.org', ''),
|
||||
('http://qutebrowser.org', 'qutebrowser | qutebrowser', ''),
|
||||
('https://github.com', 'GitHub', None),
|
||||
('https://python.org', 'Welcome to Python.org', None),
|
||||
('http://qutebrowser.org', 'qutebrowser | qutebrowser', None),
|
||||
]
|
||||
})
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user