diff --git a/news/subprocess-completions-dir-spaces.rst b/news/subprocess-completions-dir-spaces.rst new file mode 100644 index 000000000..eebb28791 --- /dev/null +++ b/news/subprocess-completions-dir-spaces.rst @@ -0,0 +1,27 @@ +**Added:** + +* + +**Changed:** + +* + +**Deprecated:** + +* + +**Removed:** + +* + +**Fixed:** + +* Subprocess-based completions like + `xontrib-fish-completer `_ + no longer append a space if the single available completion ends with + a directory separator. This is consistent with the behavior of the + default completer. + +**Security:** + +* diff --git a/xonsh/completers/tools.py b/xonsh/completers/tools.py index 48ddeb908..cdb369bd2 100644 --- a/xonsh/completers/tools.py +++ b/xonsh/completers/tools.py @@ -275,7 +275,7 @@ def complete_from_sub_proc(*args: str, sep=None, filter_prefix=None, **env_vars: lines = output.split(sep) # if there is a single completion candidate then maybe it is over - append_space = len(lines) == 1 + append_space = len(lines) == 1 and not lines[0].rstrip().endswith(os.sep) for line in lines: if filter_prefix and (not filter_func(line, filter_prefix)): continue