Strip quotes from completion pattern.

Given a commandline like:
`:set general editor "gvim -f"|`, the pattern should be 'gvim -f'
rather than '"gvim -f"'.
This commit is contained in:
Ryan Roden-Corrent 2016-09-12 21:30:10 -04:00
parent e65aba74fd
commit e23d611b37
2 changed files with 6 additions and 2 deletions

View File

@ -252,6 +252,7 @@ class Completer(QObject):
completion.set_model(None)
return
pattern = pattern.strip("'\"")
model = self._get_new_completion(before_cursor, pattern)
log.completion.debug("Setting completion model to {} with pattern '{}'"

View File

@ -82,7 +82,7 @@ def instances(monkeypatch):
}
instances[usertypes.Completion.value] = {
'general': {
'ignore-case': FakeCompletionModel(usertypes.Completion.value),
'editor': FakeCompletionModel(usertypes.Completion.value),
}
}
monkeypatch.setattr('qutebrowser.completion.completer.instances',
@ -150,7 +150,10 @@ def _set_cmd_prompt(cmd, txt):
(':set gen|', usertypes.Completion.section, 'gen'),
(':set general |', usertypes.Completion.option, ''),
(':set what |', None, ''),
(':set general ignore-case |', usertypes.Completion.value, ''),
(':set general editor |', usertypes.Completion.value, ''),
(':set general editor gv|', usertypes.Completion.value, 'gv'),
(':set general editor "gvim -f"|', usertypes.Completion.value, 'gvim -f'),
(':set general editor "gvim |', usertypes.Completion.value, 'gvim'),
(':set general huh |', None, ''),
(':help |', usertypes.Completion.helptopic, ''),
(':help |', usertypes.Completion.helptopic, ''),