From fdb76e9d215e007c4fadb2f54cc1b0b3f9d04765 Mon Sep 17 00:00:00 2001 From: Koichi Murase Date: Thu, 2 Feb 2023 01:03:36 +0900 Subject: [PATCH] complete: fix non-working ambiguous path completion with ".." and "." in the path --- lib/core-complete.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/core-complete.sh b/lib/core-complete.sh index 5594c010..fcbacb60 100644 --- a/lib/core-complete.sh +++ b/lib/core-complete.sh @@ -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 @@ -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