Allow completion to be disabled
This commit is contained in:
parent
9bf7dd2bbb
commit
9c209c0cdd
1
TODO
1
TODO
@ -25,7 +25,6 @@ IPC, like dwb -x
|
||||
Mode handling?
|
||||
Bookmarks
|
||||
sensible crash handling (exceptions, segfaults [windows?])
|
||||
more configuration (hide completion)
|
||||
|
||||
Minor features/bugs
|
||||
===================
|
||||
|
@ -8,6 +8,9 @@ config = None
|
||||
colordict = {}
|
||||
|
||||
default_config = {
|
||||
'general': {
|
||||
'show_completion': 'true',
|
||||
},
|
||||
'keybind': {
|
||||
'o': 'open',
|
||||
'O': 'tabopen',
|
||||
|
@ -45,9 +45,13 @@ class CompletionView(QTreeView):
|
||||
completion_models = {}
|
||||
append_cmd_text = pyqtSignal(str)
|
||||
ignore_next = False
|
||||
enabled = True
|
||||
completing = False
|
||||
|
||||
def __init__(self, parent=None):
|
||||
super().__init__(parent)
|
||||
self.enabled = config.config.getboolean('general', 'show_completion',
|
||||
fallback=True)
|
||||
self.completion_models[''] = None
|
||||
self.completion_models['command'] = CommandCompletionModel()
|
||||
self.model = CompletionFilterModel()
|
||||
@ -94,13 +98,16 @@ class CompletionView(QTreeView):
|
||||
# FIXME more sophisticated completions
|
||||
if ' ' in text or not text.startswith(':'):
|
||||
self.hide()
|
||||
self.completing = False
|
||||
return
|
||||
|
||||
self.completing = True
|
||||
self.setmodel('command')
|
||||
text = text.lstrip(':')
|
||||
self.model.pattern = text
|
||||
self.mark_all_items(text)
|
||||
self.show()
|
||||
if self.enabled:
|
||||
self.show()
|
||||
|
||||
def first_item(self):
|
||||
cat = self.model.index(0, 0)
|
||||
@ -133,7 +140,7 @@ class CompletionView(QTreeView):
|
||||
return marks
|
||||
|
||||
def tab_handler(self, shift):
|
||||
if self.isHidden():
|
||||
if not self.completing:
|
||||
return
|
||||
idx = self._next_idx(shift)
|
||||
self.ignore_next = True
|
||||
|
Loading…
Reference in New Issue
Block a user