add set of completion wrap tokens for bash escape

I've noticed a few more problems in the way that the xonsh parser can
interfere with bash completion (or vice versa).  This adds a set of
tokens that might show up in filenames that cause trouble.  If one of
these tokens is in a filename/path then the bash completer will return
the `repr` of the filename and the xonsh parser won't try to interpret
the special symbols in the filename
This commit is contained in:
Gil Forsyth 2015-12-04 17:11:17 -05:00
parent 4651e66154
commit f5b86b6a0f

View file

@ -30,6 +30,8 @@ XONSH_TOKENS = {
COMPLETION_SKIP_TOKENS = {'sudo', 'time'}
COMPLETION_WRAP_TOKENS = {' ',',','[',']','(',')','{','}'}
BASH_COMPLETE_SCRIPT = """source {filename}
COMP_WORDS=({line})
COMP_LINE={comp_line}
@ -318,7 +320,7 @@ class Completer(object):
space = ' '
slash = '/'
rtn = {_normpath(repr(s + (slash if os.path.isdir(s) else '')))
if space in s else
if (COMPLETION_WRAP_TOKENS.intersection(s) != set()) else
s + space
if s[-1:].isalnum() else
s for s in out.splitlines()}