Skip to content

Commit

Permalink
prompt: clear list for the cylic dependency detection
Browse files Browse the repository at this point in the history
  • Loading branch information
akinomyoga committed Apr 27, 2024
1 parent 16ff7df commit 6196849
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
1 change: 1 addition & 0 deletions docs/ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@
- util(vbell): fix previous vbell not fully cleared `#D2181` 6c740a94
- decode(rlfunc): fix widget name `vi-command/edit-and-execute-{line => command}` (fixed by alexandregv) 6aa8ba67
- util(ble/util/idle.push): fix uninitialized `ble/util/idle.clock` (reported by Anyborr) `#D2189` 83ceb124
- prompt: clear list for the cylic dependency detection (reported by micimize, neilbags) `#D2200` xxxxxxxx

## Compatibility

Expand Down
20 changes: 20 additions & 0 deletions note.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7334,6 +7334,26 @@ bash_tips
Done (実装ログ)
-------------------------------------------------------------------------------

2024-04-28

* prompt: clear list for the cylic dependency detection (reported by micimize, neilbags) [#D2200]
https://github.com/akinomyoga/ble.sh/issues/359
https://github.com/akinomyoga/ble.sh/issues/442

どちらも初期化時に発生する。前者は starship と一緒に使っている時のエラーだっ
たが、後者は starship は使っていない。代わりに atuin を使っている。

PS1 の中で循環参照が起こっているのではないかと思ったが、通常の設定である限
りは unit#update が PS1 によって (間接的であるにしても) 呼び出されるのは変
である。或いは winch を介してプロンプトの初期化をしている間に、また
ble/prompt/update が入れ子で呼び出されているのかもしれない。その場合に何が
起こるか確認する。循環参照の検出には ble_prompt_unit_mark というローカル変
数を使っている。これは存在していなければその場で作るという形になっている。
つまり、一番外側の unit#update で空の物を用意するという訳ではない様だ。

ble/prompt/update で明示的に空に初期化する事にする。これで PS1 を処理してい
る間に ble/prompt/update が入れ子で呼び出されたとしても問題ない筈。

2024-04-24

* menu-complete: support hiding menu (requested by CamRatliff) [#D2199]
Expand Down
3 changes: 3 additions & 0 deletions src/edit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1932,6 +1932,9 @@ function ble/prompt/update {
local prompt_rows=${LINES:-25}
local prompt_cols=${COLUMNS:-80}
local "${_ble_prompt_cache_vars[@]/%/=}" # WA #D1570 checked
# clear the list for cyclic dependency detection
local ble_prompt_unit_processing=1
"${_ble_util_set_declare[@]//NAME/ble_prompt_unit_mark}"

ble/prompt/unit#update _ble_prompt_ps1 && dirty=1

Expand Down

0 comments on commit 6196849

Please sign in to comment.