Skip to content

Commit

Permalink
complete: fix "bleopt complete_source_sabbrev_{opts,ignore}" (fixup f…
Browse files Browse the repository at this point in the history
  • Loading branch information
akinomyoga committed Mar 10, 2023
1 parent 2c9b56d commit 45c7674
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 17 deletions.
13 changes: 13 additions & 0 deletions blerc.template
Expand Up @@ -739,6 +739,19 @@

#bind 'set menu-complete-display-prefix off'


## This option specifies a colon-separated list of glob patterns of sabbrev
## names ignored in generating the sabbrev completion candidates.

#bleopt complete_source_sabbrev_ignore=


## This is a colon-separated list of options. When the field
## `no-empty-completion` is specified, the sabbrev completion candidates are
## not generated when the word to complete is empty.

#bleopt complete_source_sabbrev_opts=no-empty-completion

##-----------------------------------------------------------------------------
## Color settings

Expand Down
26 changes: 13 additions & 13 deletions docs/ChangeLog.md
Expand Up @@ -135,10 +135,10 @@
- syntax: check alias expansions of `coproc` variable names `#D1996` 92ce433
- syntax: support new parameter transformation `"${arr@k}"` `#D1998` 1dd7e385
- edit: support a user command `ble append-line` (requested by mozirilla213) `#D2001` 2a524f34
- decode: accept isolated <kbd>ESC \<char\></kbd> (requested by mozirilla213) `#D2004` xxxxxxxx
- sabbrev: add widget `magic-slash` to approximate Zsh named directories (motivated by mozirilla213) `#D2008` xxxxxxxx
- sabbrev: support inline and linewise sabbre with `ble-sabbrev -il` `#D2012` xxxxxxxx
- complete: add `bleopt complete_source_sabbrev_{opts,ignore}` (motivated by mozirilla213) `#D2013` xxxxxxxx
- decode: accept isolated <kbd>ESC \<char\></kbd> (requested by mozirilla213) `#D2004` d7210494
- sabbrev: add widget `magic-slash` to approximate Zsh named directories (motivated by mozirilla213) `#D2008` e6b9581c
- sabbrev: support inline and linewise sabbre with `ble-sabbrev -il` `#D2012` 56208534
- complete: add `bleopt complete_source_sabbrev_{opts,ignore}` (motivated by mozirilla213) `#D2013` f95eb0cc `#D2016` xxxxxxxx

## Changes

Expand Down Expand Up @@ -244,11 +244,11 @@
- color: rearrange color table by `ble palette` (suggested by stackoverflow/caoanan) `#D1961` bb8541d
- util (`ble/util/idle`): process events before idle sleep `#D1980` 559d64b
- keymap/vi (`decompose-meta`): translate <kbd>S-a</kbd> to <kbd>A</kbd> `#D1988` 600e845
- sabbrev: apply sabbrev to right-hand sides of variable assignments `#D2006` xxxxxxxx
- complete (`source:argument`): fallback to rhs completion also for `name+=rhs` `#D2006` xxxxxxxx
- auto-complete: limit the line length for auto-complete `#D2009` xxxxxxxx
- complete (`source:argument`): generate sabbrev completions after normal completions (motivated by mozirilla213) `#D2011` xxxxxxxx
- complete (`source:option`): carve out `ble/complete/source:option/generate-for-command` (requested by mozirilla213) `#D2014` xxxxxxxx
- sabbrev: apply sabbrev to right-hand sides of variable assignments `#D2006` 41faa494
- complete (`source:argument`): fallback to rhs completion also for `name+=rhs` `#D2006` 41faa494
- auto-complete: limit the line length for auto-complete `#D2009` 5bfbd6f2
- complete (`source:argument`): generate sabbrev completions after normal completions (motivated by mozirilla213) `#D2011` a6f168d0
- complete (`source:option`): carve out `ble/complete/source:option/generate-for-command` (requested by mozirilla213) `#D2014` 54ace59c

## Fixes

Expand Down Expand Up @@ -378,7 +378,7 @@
- keymap/vi (`expand-range-for-linewise-operator`): fix the end point being not extended `#D1994` bce2033
- keymap/vi (`operator:filter`): do not append newline at the end of line `#D1994` bce2033
- highlight: fix shifted error marks after delayed `core-syntax` `#D2000` f4145f16
- syntax: fix unrecognized variable assignment of the form `echo arr[i]+=rhs` `#D2007` xxxxxxxx
- syntax: fix unrecognized variable assignment of the form `echo arr[i]+=rhs` `#D2007` 41faa494

## Documentation

Expand Down Expand Up @@ -500,7 +500,7 @@
- edit: always adjust the terminal states with `bind -x` (reported by linwaytin) `#D1983` 5d14cf1
- syntax: suppress brace expansions in designated array initialization in Bash 5.3 `#D1989` 1e7b884
- progcomp: work around slow `nix` completion `#D1997` 2c1aacf
- complete: suppress error messages from `_adb` (reported by mozirilla213) `#D2005` xxxxxxx
- complete: suppress error messages from `_adb` (reported by mozirilla213) `#D2005` f2aa32b0

## Test

Expand Down Expand Up @@ -572,10 +572,10 @@
- util: support `bleopt debug_idle` `#D1945` fa10184
- global: work around bash-4.4 no-argument return in trap `#D1970` eb4ffce
- util: replace builtin `readonly` with a shell function (requested by mozirilla213) `#D1985` 8683c84 e4758db
- util (`ble/builtin/readonly`): show file and line in warnings `#D2015` xxxxxxxx xxxxxxxx
- util (`ble/builtin/readonly`): show file and line in warnings `#D2015` 467fa448 2c9b56d7
- global: avoid directly using `/dev/tty` `#D1986` a835b83
- util: add `ble/util/message` `#D2001` 2a524f34
- global: normalize bracket expressions to `_a-zA-Z` / `_a-zA-Z0-9` `#D2006` xxxxxxxx
- global: normalize bracket expressions to `_a-zA-Z` / `_a-zA-Z0-9` `#D2006` 41faa494

## Contrib

Expand Down
10 changes: 6 additions & 4 deletions lib/core-complete.sh
Expand Up @@ -44,9 +44,11 @@ function ble/complete/string#common-suffix-prefix {
## @param[in] patterns
## @exit
function ble/complete/string#match-patterns {
local s=$1 pattern found=
for pattern in "${patterns[@]}"; do
[[ $s == $pattern ]] && return 0
local s=$1 found= pattern; shift
for pattern; do
if [[ $s == $pattern ]]; then
return 0
fi
done
return 1
}
Expand Down Expand Up @@ -8727,7 +8729,7 @@ function ble/complete/action:sabbrev/get-desc {
}
function ble/complete/source:sabbrev {
local opts=$bleopt_complete_source_sabbrev_opts
[[ ! $COMPV && :$opts: == *:no-empty-completion:* ]] && return 1
[[ ! $COMPS && :$opts: == *:no-empty-completion:* ]] && return 1

local keys; ble/complete/sabbrev/wordwise.get-keys "$opts"

Expand Down
12 changes: 12 additions & 0 deletions note.txt
Expand Up @@ -6624,6 +6624,18 @@ bash_tips
Done (実装ログ)
-------------------------------------------------------------------------------

2023-03-10

* complete: complete_source_sabbrev_ignore が動いていない [#D2016]

* done: そもそも全然動作していなかった。修正した。

* fixed: opts の方も動作をチェックする。no-empty-completion は '\' から始め
ても候補が生成されない様だ。うーん。COMPV ではなく COMPS に対して適用する
べきである。

* done: wiki, blerc: complete_source_sabbrev_{opts,ignore}

2023-03-09

* readonly blacklist のチェックを m scan に含める (motivated by mozirilla213) [#D2015]
Expand Down

0 comments on commit 45c7674

Please sign in to comment.