From 71048a1b55fe3383f98f54237558e665b91be52b Mon Sep 17 00:00:00 2001 From: Luca Benci Date: Sat, 7 Oct 2017 15:42:42 +0200 Subject: [PATCH] Add (and use) completion.use_best_match config --- qutebrowser/commands/runners.py | 4 +++- qutebrowser/config/configdata.yml | 5 +++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/qutebrowser/commands/runners.py b/qutebrowser/commands/runners.py index 21ec41e58..d6a12e2c7 100644 --- a/qutebrowser/commands/runners.py +++ b/qutebrowser/commands/runners.py @@ -218,7 +218,9 @@ class CommandParser: for valid_command in cmdutils.cmd_dict: if valid_command.find(cmdstr) == 0: matches.append(valid_command) - if len(matches) >= 1: + if len(matches) == 1: + cmdstr = matches[0] + elif len(matches) > 1 and config.val.completion.use_best_match: cmdstr = matches[0] return cmdstr diff --git a/qutebrowser/config/configdata.yml b/qutebrowser/config/configdata.yml index 56b58f8e1..acee49f40 100644 --- a/qutebrowser/config/configdata.yml +++ b/qutebrowser/config/configdata.yml @@ -656,6 +656,11 @@ completion.web_history_max_items: 0: no history / -1: unlimited +completion.use_best_match: + type: Bool + default: true + desc: Whether to execute the best-matching command on a partial match. + ## downloads downloads.location.directory: