Skip to content

Commit

Permalink
syntax: suppress brace expansions in compound assignments in Bash 5.3
Browse files Browse the repository at this point in the history
  • Loading branch information
akinomyoga committed Mar 1, 2023
1 parent 600e845 commit 1e7b884
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 1 deletion.
1 change: 1 addition & 0 deletions docs/ChangeLog.md
Expand Up @@ -480,6 +480,7 @@
- main (`ble/bin/awk`): add workaround for macOS `awk-32` `#D1974` e2ec89c
- util.hook: workaround bash-5.2 bug of nested read by `WINCH` `#D1981` xxxxxxx
- edit: always adjust the terminal states with `bind -x` (reported by linwaytin) `#D1983` xxxxxxx
- syntax: suppress brace expansions in designated array initialization in Bash 5.3 `#D1989` xxxxxxx

## Test

Expand Down
3 changes: 3 additions & 0 deletions lib/core-syntax.sh
Expand Up @@ -2956,6 +2956,9 @@ function ble/syntax:bash/check-brace-expansion {
inactive=1
elif ((ctx==CTX_CONDI||ctx==CTX_CONDQ||ctx==CTX_RDRS||ctx==CTX_VRHS)); then
inactive=1
elif ((_ble_bash>=50300&&ctx==CTX_VALR)); then
# bash-5.3 以降では arr=([9]={1..10}) 等のブレース展開は不活性
inactive=1
elif ((ctx==CTX_PATN||ctx==CTX_BRAX)); then
local ntype; ble/syntax/parse/nest-type
if [[ $ntype == glob_attr=* ]]; then
Expand Down
26 changes: 25 additions & 1 deletion note.txt
Expand Up @@ -1982,9 +1982,28 @@ bash_tips
- keymap の移動 (これは別 commit にする?)
- make_command.sh の整理 (scan 分離, char_width 分離)

2023-03-01

* [保留] decode: M-S-o と M-O のどちらか一方でに強制的に揃える?

現状では二つの形式に同じ binding を与える様に設定しているがわざわざ両方設定
するのは大変である。一方で、CapsLock 等を考慮に入れると両者は実は互換ではな
い。更に端末によって CapsLock がある時の振る舞いや、S を付加している時に
Shift 前の文字を底字にするのか Shift 後の文字を底字にするのか振る舞いが異な
る。なので正確に判定するのは難しい。

* [保留] ble/builtin/readonly などの上書きを function#push で行う?

ユーザーが独自に定義していた時などにそれを保持する為。また、ユーザーコマン
ドを実行した直後にユーザーが上書きしていたら改めて push を行う。その時には
既に push chain の中に登録済みであればそれを削除する等の仕組みが欲しい気が
する (opts 引数で指定)。

これはわざわざ表示しなくて良い気がする。

2023-02-27

* complete: compopt -o filenames が指定された時に末尾の空白を除去する?
* [保留] complete: compopt -o filenames が指定された時に末尾の空白を除去する?
bash の振る舞いを確認する。

2023-02-20
Expand Down Expand Up @@ -6661,6 +6680,11 @@ bash_tips

2023-03-01

* syntax: 5.3: 配列要素代入の右辺でブレース展開は無効 [#D1989]
https://git.savannah.gnu.org/cgit/bash.git/commit/?h=devel&id=349e21043e362914551277728159f8e55350bad7

これの修正は簡単だった。

* vi_imap: M-S-o に対する fallback が ESC o になっている [#D1988]

これは redispatch の時に S-o が O になっていないのが原因。そもそもの問題と
Expand Down

0 comments on commit 1e7b884

Please sign in to comment.