From 3f9bb89614835821ce4af1a1eb8b78b4dcc31b91 Mon Sep 17 00:00:00 2001 From: Gil Forsyth Date: Wed, 4 Jul 2018 19:43:43 -0400 Subject: [PATCH] Fix bash quote completion strip calculation `xonsh.completers.bash_completion.bash_completions` was returning incorrect prefix lengths depending on whether or not a user had typed a leading quote. Now it should be agnostic to how the prefix is started (no quote, single quote, or double quote). --- xonsh/completers/bash_completion.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xonsh/completers/bash_completion.py b/xonsh/completers/bash_completion.py index 6b954b31c..adbb5d778 100644 --- a/xonsh/completers/bash_completion.py +++ b/xonsh/completers/bash_completion.py @@ -344,14 +344,14 @@ def bash_completions(prefix, line, begidx, endidx, env=None, paths=None, # Ensure input to `commonprefix` is a list (now required by Python 3.6) commprefix = os.path.commonprefix(list(out)) strip_len = 0 + strip_prefix = prefix.strip("\"'") while strip_len < len(prefix): - if commprefix.startswith(prefix[strip_len:]): + if commprefix.startswith(strip_prefix[strip_len:]): break strip_len += 1 if '-o noquote' not in complete_stmt: out, need_quotes = quote_paths(out, '', '') - strip_len += int(need_quotes) if '-o nospace' in complete_stmt: out = set([x.rstrip() for x in out])