Skip to content

Commit

Permalink
complete: fix non-working ambiguous path completion with ".." and "."…
Browse files Browse the repository at this point in the history
… in the path
  • Loading branch information
akinomyoga committed Feb 9, 2023
1 parent 6d1e1ba commit fdb76e9
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/core-complete.sh
Expand Up @@ -864,7 +864,8 @@ function ble/complete/util/eval-pathname-expansion {

## 関数 ble/complete/source:file/.construct-ambiguous-pathname-pattern path
## 指定された path に対応する曖昧一致パターンを生成します。
## 例えばalpha/beta/gamma に対して a*/b*/g* でファイル名を生成します。
## 例えば alpha/beta/gamma に対して a*/b*/g* でファイル名を生成します。
## 但し "../" や "./" については (".*.*/" や ".*/" 等に変換せず) そのままにします。
##
## @param[in] path
## @var[out] ret
Expand All @@ -880,7 +881,9 @@ function ble/complete/source:file/.construct-ambiguous-pathname-pattern {
local name
for name in "${names[@]}"; do
((i++)) && pattern=$pattern/
if [[ $name ]]; then
if [[ $name == .. || $name == . && i -lt ${#names[@]} ]]; then
pattern=$pattern$name
elif [[ $name ]]; then
ble/string#quote-word "${name::fixlen}"
pattern=$pattern$ret*
for ((j=fixlen;j<${#name};j++)); do
Expand Down

0 comments on commit fdb76e9

Please sign in to comment.