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 1, 2023
1 parent b0c16dd commit 632e90a
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
1 change: 1 addition & 0 deletions docs/ChangeLog.md
Expand Up @@ -338,6 +338,7 @@
- bind: fix <kbd>M-C-@</kbd>, <kbd>C-x C-@</kbd>, and <kbd>M-C-x</kbd> (`bash-4.2 -o emacs`) `#D1920` a410b03
- complete (action:file): support `ble/syntax-raw` in the filename extraction (reported by qoreQyaS) `#D1921` 32277da
- decode: fix a bug that the tab completion do not work with bash-4.4 and lower `#D1928` 7da9bce
- complete: fix non-working ambiguous path completion with `..` and `.` in the path `#D1930` xxxxxxx

## Documentation

Expand Down
7 changes: 5 additions & 2 deletions lib/core-complete.sh
Expand Up @@ -2613,7 +2613,8 @@ function ble/complete/util/eval-pathname-expansion {

## @fn 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 @@ -2629,7 +2630,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
8 changes: 8 additions & 0 deletions note.txt
Expand Up @@ -6848,6 +6848,14 @@ bash_tips

2023-02-01

* complete: ../ で始まるパスの曖昧補完が効いていない [#D1930]

../out/data/c2w.wcwidth-compare.musl-vs-12.1.txt[TAB] の曖昧補完が効いていない

どうやら .. を .*.* 等に変換すると .. に一致しなくなってしまう様だ。
ble/complete/source:file/.construct-ambiguous-pathname-pattern を修正したら
すぐ直った。

* canvas: char_width_mode=musl の判定をより正確にする [#D1929]
https://github.com/akinomyoga/ble.sh/issues/269#issuecomment-1407360550

Expand Down

0 comments on commit 632e90a

Please sign in to comment.