mirror of
https://github.com/xonsh/xonsh.git
synced 2025-03-06 09:20:57 +01:00
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).
This commit is contained in:
parent
2349472f29
commit
3f9bb89614
1 changed files with 2 additions and 2 deletions
|
@ -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])
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue