mirror of
https://github.com/xonsh/xonsh.git
synced 2025-03-05 17:00:58 +01:00
Merge pull request #2610 from xonsh/trail
fixed trailing bash whitespace completion issue
This commit is contained in:
commit
bd5be59f00
2 changed files with 27 additions and 1 deletions
15
news/trail.rst
Normal file
15
news/trail.rst
Normal file
|
@ -0,0 +1,15 @@
|
|||
**Added:** None
|
||||
|
||||
**Changed:** None
|
||||
|
||||
**Deprecated:** None
|
||||
|
||||
**Removed:** None
|
||||
|
||||
**Fixed:**
|
||||
|
||||
* Commands like ``git c`` would complete to ``git 'checkout '`` because git adds an extra space
|
||||
to the end of the completion, which was being captured in the completion. Xonsh now fixes the git issue
|
||||
while retaining all whitespace when there is other internal whitespace.
|
||||
|
||||
**Security:** None
|
|
@ -239,7 +239,18 @@ COMP_COUNT={end}
|
|||
COMP_CWORD={n}
|
||||
$_func {cmd} {prefix} {prev}
|
||||
|
||||
for ((i=0;i<${{#COMPREPLY[*]}};i++)) do echo "${{COMPREPLY[i]}}"; done
|
||||
# print out completions, right-stripped if they contain no internal spaces
|
||||
shopt -s extglob
|
||||
for ((i=0;i<${{#COMPREPLY[*]}};i++))
|
||||
do
|
||||
no_spaces="${{COMPREPLY[i]//[[:space:]]}}"
|
||||
no_trailing_spaces="${{COMPREPLY[i]%%+([[:space:]])}}"
|
||||
if [[ "$no_spaces" == "$no_trailing_spaces" ]]; then
|
||||
echo "$no_trailing_spaces"
|
||||
else
|
||||
echo "${{COMPREPLY[i]}}"
|
||||
fi
|
||||
done
|
||||
"""
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue