We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 56f66e2 commit 9ddb44bCopy full SHA for 9ddb44b
scripts/bash_pinyin_completion
@@ -84,7 +84,17 @@ _pinyin_completion() {
84
# merge result
85
local -a old_candidates=("${COMPREPLY[@]}")
86
COMPREPLY=("${old_candidates[@]}" "${pinyin_matched[@]}")
87
- mapfile -t COMPREPLY < <(printf "%s\n" "${COMPREPLY[@]}" | awk '!seen[$0]++')
+
88
+ # mapfile -t COMPREPLY < <(printf "%s\n" "${COMPREPLY[@]}" | awk '!seen[$0]++')
89
+ declare -A seen
90
+ local -a unique_compreply=()
91
+ for item in "${COMPREPLY[@]}"; do
92
+ if [[ -z "${seen[$item]}" ]]; then
93
+ seen["$item"]=1
94
+ unique_compreply+=( "$item" )
95
+ fi
96
+ done
97
+ COMPREPLY=( "${unique_compreply[@]}" )
98
99
# fix space postfix
100
if ((${#COMPREPLY[@]} == 1)) && [[ ${COMPREPLY[0]} != */ ]]; then
0 commit comments