Skip to content

Commit 261c302

Browse files
committed
enh: optimize seperator
Signed-off-by: wxiwnd <wxiwnd@outlook.com>
1 parent 9ddb44b commit 261c302

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

scripts/bash_pinyin_completion

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,14 @@ _pinyin_completion() {
7474
fi
7575

7676
if [[ -n "$dirpart" ]]; then
77+
local sep="/"
78+
# dirpart is root
79+
if [[ "$dirpart" == "/" ]]; then
80+
sep=""
81+
fi
82+
7783
for i in "${!pinyin_matched[@]}"; do
78-
pinyin_matched[$i]="${dirpart}/${pinyin_matched[$i]}"
84+
pinyin_matched[$i]="${dirpart}${sep}${pinyin_matched[$i]}"
7985
done
8086
fi
8187

0 commit comments

Comments
 (0)