mirror of
https://github.com/xonsh/xonsh.git
synced 2025-03-04 00:14:41 +01:00
Don't append a space if the single available completion ends with a directory separator (#5792)
* Don't append a space if the single available completion ends with a directory separator * Update subprocess-completions-dir-spaces.rst --------- Co-authored-by: Andy Kipp <anki-code@users.noreply.github.com>
This commit is contained in:
parent
a33ccdf636
commit
43f62750ac
2 changed files with 28 additions and 1 deletions
27
news/subprocess-completions-dir-spaces.rst
Normal file
27
news/subprocess-completions-dir-spaces.rst
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
**Added:**
|
||||||
|
|
||||||
|
* <news item>
|
||||||
|
|
||||||
|
**Changed:**
|
||||||
|
|
||||||
|
* <news item>
|
||||||
|
|
||||||
|
**Deprecated:**
|
||||||
|
|
||||||
|
* <news item>
|
||||||
|
|
||||||
|
**Removed:**
|
||||||
|
|
||||||
|
* <news item>
|
||||||
|
|
||||||
|
**Fixed:**
|
||||||
|
|
||||||
|
* Subprocess-based completions like
|
||||||
|
`xontrib-fish-completer <https://github.com/xonsh/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:**
|
||||||
|
|
||||||
|
* <news item>
|
|
@ -275,7 +275,7 @@ def complete_from_sub_proc(*args: str, sep=None, filter_prefix=None, **env_vars:
|
||||||
lines = output.split(sep)
|
lines = output.split(sep)
|
||||||
|
|
||||||
# if there is a single completion candidate then maybe it is over
|
# 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:
|
for line in lines:
|
||||||
if filter_prefix and (not filter_func(line, filter_prefix)):
|
if filter_prefix and (not filter_func(line, filter_prefix)):
|
||||||
continue
|
continue
|
||||||
|
|
Loading…
Add table
Reference in a new issue