Fix completion stuff

This commit is contained in:
Florian Bruhin 2017-06-13 15:21:40 +02:00
parent 8c1b5f0581
commit c8c9536beb
6 changed files with 10 additions and 10 deletions

View File

@ -704,7 +704,7 @@ class AbstractTab(QWidget):
def _handle_auto_insert_mode(self, ok): def _handle_auto_insert_mode(self, ok):
"""Handle auto-insert-mode after loading finished.""" """Handle auto-insert-mode after loading finished."""
if not config.val.input.auto_insert_mode or not ok: if not config.val.input.insert_mode.auto_focused or not ok:
return return
cur_mode = self._mode_manager.mode cur_mode = self._mode_manager.mode

View File

@ -157,7 +157,7 @@ class MouseEventFilter(QObject):
'click', only_if_normal=True) 'click', only_if_normal=True)
else: else:
log.mouse.debug("Clicked non-editable element!") log.mouse.debug("Clicked non-editable element!")
if config.val.input.auto_leave_insert_mode: if config.val.input.insert_mode.auto_leave:
modeman.leave(self._tab.win_id, usertypes.KeyMode.insert, modeman.leave(self._tab.win_id, usertypes.KeyMode.insert,
'click', maybe=True) 'click', maybe=True)
@ -179,7 +179,7 @@ class MouseEventFilter(QObject):
'click-delayed', only_if_normal=True) 'click-delayed', only_if_normal=True)
else: else:
log.mouse.debug("Clicked non-editable element (delayed)!") log.mouse.debug("Clicked non-editable element (delayed)!")
if config.val.input.auto_leave_insert_mode: if config.val.input.insert_mode.auto_leave:
modeman.leave(self._tab.win_id, usertypes.KeyMode.insert, modeman.leave(self._tab.win_id, usertypes.KeyMode.insert,
'click-delayed', maybe=True) 'click-delayed', maybe=True)

View File

@ -182,7 +182,7 @@ class AbstractWebElement(collections.abc.MutableMapping):
# at least a classid attribute. Oh, and let's hope images/... # at least a classid attribute. Oh, and let's hope images/...
# DON'T have a classid attribute. HTML sucks. # DON'T have a classid attribute. HTML sucks.
log.webelem.debug("<object type='{}'> clicked.".format(objtype)) log.webelem.debug("<object type='{}'> clicked.".format(objtype))
return config.val.input.insert_mode_on_plugins return config.val.input.insert_mode.plugins
else: else:
# Image/Audio/... # Image/Audio/...
return False return False
@ -247,7 +247,7 @@ class AbstractWebElement(collections.abc.MutableMapping):
return self.is_writable() return self.is_writable()
elif tag in ['embed', 'applet']: elif tag in ['embed', 'applet']:
# Flash/Java/... # Flash/Java/...
return config.val.input.insert_mode_on_plugins and not strict return config.val.input.insert_mode.plugins and not strict
elif tag == 'object': elif tag == 'object':
return self._is_editable_object() and not strict return self._is_editable_object() and not strict
elif tag in ['div', 'pre']: elif tag in ['div', 'pre']:

View File

@ -194,7 +194,7 @@ class Completer(QObject):
if maxsplit is None: if maxsplit is None:
text = self._quote(text) text = self._quote(text)
model = self._model() model = self._model()
if model.count() == 1 and config.val.completion.quick_complete: if model.count() == 1 and config.val.completion.quick:
# If we only have one item, we want to apply it immediately # If we only have one item, we want to apply it immediately
# and go on to the next part. # and go on to the next part.
self._change_completed_part(text, before, after, immediate=True) self._change_completed_part(text, before, after, immediate=True)

View File

@ -149,11 +149,11 @@ class CompletionItemDelegate(QStyledItemDelegate):
self._painter.save() self._painter.save()
if self._opt.state & QStyle.State_Selected: if self._opt.state & QStyle.State_Selected:
color = config.val.completion.item.selected.fg color = config.val.colors.completion.item.selected.fg
elif not self._opt.state & QStyle.State_Enabled: elif not self._opt.state & QStyle.State_Enabled:
color = config.val.completion.category.fg color = config.val.colors.completion.category.fg
else: else:
color = config.val.completion.fg color = config.val.colors.completion.fg
self._painter.setPen(color) self._painter.setPen(color)
ctx = QAbstractTextDocumentLayout.PaintContext() ctx = QAbstractTextDocumentLayout.PaintContext()

View File

@ -257,7 +257,7 @@ class CompletionView(QTreeView):
count = self.model().count() count = self.model().count()
if count == 0: if count == 0:
self.hide() self.hide()
elif count == 1 and config.val.completion.quick_complete: elif count == 1 and config.val.completion.quick:
self.hide() self.hide()
elif config.val.completion.show == 'auto': elif config.val.completion.show == 'auto':
self.show() self.show()