Completion pattern update

This commit is contained in:
Florian Bruhin 2014-03-08 00:40:33 +01:00
parent ecf405c7af
commit df26d4ad91
2 changed files with 48 additions and 41 deletions

View File

@ -17,6 +17,8 @@
"""A CompletionModel filled with settings and their descriptions.""" """A CompletionModel filled with settings and their descriptions."""
import logging
from collections import OrderedDict from collections import OrderedDict
from qutebrowser.models.completion import CompletionModel from qutebrowser.models.completion import CompletionModel
@ -37,4 +39,5 @@ class SettingCompletionModel(CompletionModel):
for name in secdata.values.keys(): for name in secdata.values.keys():
newdata.append((name, secdata.descriptions[name])) newdata.append((name, secdata.descriptions[name]))
data[secname] = newdata data[secname] = newdata
logging.debug("Setting data: {}".format(data))
self.init_data(data) self.init_data(data)

View File

@ -22,6 +22,7 @@ subclasses to provide completions.
""" """
import logging
import html import html
from PyQt5.QtWidgets import (QStyle, QStyleOptionViewItem, QTreeView, from PyQt5.QtWidgets import (QStyle, QStyleOptionViewItem, QTreeView,
@ -200,8 +201,11 @@ class CompletionView(QTreeView):
self.setmodel('command') self.setmodel('command')
self._completing = True self._completing = True
if text: if text.endswith(' '):
text = ''
elif text:
text = text.split()[-1] text = text.split()[-1]
logging.debug("pattern: {}".format(text))
self.model.pattern = text self.model.pattern = text
self.model.sourceModel().mark_all_items(text) self.model.sourceModel().mark_all_items(text)
if self._enabled: if self._enabled: