Skip to content

Commit

Permalink
edit: update prompts on g2sgr change
Browse files Browse the repository at this point in the history
  • Loading branch information
akinomyoga committed Dec 8, 2022
1 parent 09bb4d3 commit 40625ac
Show file tree
Hide file tree
Showing 5 changed files with 66 additions and 7 deletions.
2 changes: 1 addition & 1 deletion contrib
Submodule contrib updated 2 files
+18 −0 README.md
+67 −8 colorglass.bash
9 changes: 6 additions & 3 deletions docs/ChangeLog.md
Expand Up @@ -498,17 +498,20 @@
- benchmark (zsh): fix for `KSH_ARRAYS` `#D1886` a144ffa 8cb9b84
- benchmark: support for ksh as `benchmark.ksh` `#D1886` 5dae4da
- github/workflows (build): rename directory in `ble-nightly.tar.xz` to `ble-nightly` (reported by Harduex) `#D1891` f20854f 4ea2e23 43c6d4b
- edit: update prompts on g2sgr change `#D1906` xxxxxxx

## Contrib

- prompt-git: detect staged changes `#D1718` 2b48e31
- prompt-git: fix a bug that information is not updated on reload `#D1732` 361e9c5
- config/execmark: show exit status in a separate line `#D1828` 4d24f84
- prompt-git: ignore untracked files in submodules `#D1829` 4d24f84
- contrib/fzf-completion: fix integration (reported by ferdinandyb) `#D1837` 12c022b
- contrib/fzf-completion: remove `noquote` (reported by MK-Alias) `#D1889` 0c6291f
- fzf-completion: fix integration (reported by ferdinandyb) `#D1837` 12c022b
- fzf-completion: remove `noquote` (reported by MK-Alias) `#D1889` 0c6291f
- README: update description on `_ble_contrib_fzf_base` (reported by Strykar) `#D1904` xxxxxxx
- contrib/fzf-initialize: check directory existence before adding it to `PATH` (reported by Strykar) `#D1904` xxxxxxx
- fzf-initialize: check directory existence before adding it to `PATH` (reported by Strykar) `#D1904` xxxxxxx
- colorglass: add color filter `#D1902` xxxxxxx
- colorglass: add `bleopt colorglass_{saturation,brightness}` (motivated by auwsom) `#D1906` xxxxxxx

<!---------------------------------------------------------------------------->
# ble-0.4.0-devel2
Expand Down
57 changes: 55 additions & 2 deletions note.txt
Expand Up @@ -1883,11 +1883,31 @@ bash_tips
2022-12-03 報告を受けた筈なのに何処かに行ってしまったとおもったら #58 の下
にあった。

2022-12-04 cevhyruz への私信での解説を何処かに移植して説明するのが良い気が
する。

* menu-complete: 一時挿入をしない設定
https://github.com/akinomyoga/ble.sh/discussions/252#discussioncomment-4293518

* colorglass: saturation (彩度) についての設定を追加する (motivated by auwsom)
https://github.com/akinomyoga/ble.sh/issues/258
* colorglass: オプションで指定した時に256色(またはより少ない色に)に減色する機能?

* colorglass: face から読み取る時に作用する色設定?

現在は全ての出力に対して色を変更しているが、プロンプトのテーマを別に指定し
ている場合などを考えると、プロンプトの色には作用して欲しくない気がする。一
方で元々の colorglass のアイディアでは全ての色に対して作用する事を考えてい
た。両方の種類のオプションを提供するという手が考えられる。例えば、現在のオ
プションはそのままにして、colorglass_face_* という物も提供する。

インターフェイスは別として実装は考える必要がある。

a 現在は face は全くキャッシュしていないので、face 読み取り部分に filter を
挟むとなると遅くなる。或いはキャッシュするか。キャッシュするとしても将来
的に face 間に依存性を持たせる実装を考えると個別にキャッシュできない。

b 或いは、別の colorglass domain の区分けとしてプロンプトを処理する時とそれ
以外で分けるという事も考えられるだろうか。しかしそれだと vim-airline の設
定は prompt に含まれるので既定の色を抑える等の調整ができなくなる。

2022-10-02

Expand Down Expand Up @@ -6645,6 +6665,39 @@ bash_tips
Done (実装ログ)
-------------------------------------------------------------------------------

2022-12-05

* colorglass: saturation (彩度) についての設定を追加する (motivated by auwsom) [#D1906]
https://github.com/akinomyoga/ble.sh/issues/258

24-bit color のサポートがない時には256色に減色する機能もつけようと思ったが
自動で検出するのは困難である。既定で256色にして指定した時にだけ256色にする
というのだと、既定では色が思うように変化しなかったり急に変わったりして使い
にくくなる。指定した時にだけ256色に減色するというのもありかもしれないが、其
処までする必要は今の所は感じられない。→取り敢えず項目は作る事にした。

* fixed: contrast -100..100 の境界値も許容する様に修正した。

* fixed: 色がすぐに PS1 に反映されない問題を修正した。trace_hash に
clear-g2sgr cache の回数を含める事にする。

* reject: ble-face で face 設定を変更した時にも clear-g2sgr を呼び出す事に
する? それ程頻繁に変更する事もないので大丈夫だろう

x と思ったが face -> g に関しては毎回完全に計算していてキャッシュしていな
いので g2sgr キャッシュをクリアする必要もない。特に g2sgr は重くなる可
能性があるので余り頻繁にクリアはしたくない。実際に vim-airline が編集す
る度に face を変更しているのでこれでキャッシュをクリアするのは割に合わ
ない。

* それよりはプロンプトの計算が face に依存しているのにプロンプトのキャッ
シュがクリアされないという所が face 更新における問題である。vim-airline
の時には背景色を変更していたが背景色は _ble_lib_vim_airline_mode という
変数で決まっており、更にこの変数は prompt/unit の枠組み経由で更新してい
た。なので何れにしてもプロンプトが更新されるので気にしなくても良かった。

* done: brightness についても対応した。

2022-12-03

* README: bashrc 設定の背景に対するリンクを載せる (motivated by telometto) [#D1905]
Expand Down
2 changes: 2 additions & 0 deletions src/color.sh
Expand Up @@ -103,6 +103,7 @@ function ble-color-show {
# ない物をここで使いたい時には、それを
# ble/textarea#slice-text-buffer の正規表現に追加しなければならない。
#
_ble_color_g2sgr_version=0
_ble_color_g2sgr=()
_ble_color_g2sgr_ansi=()
function ble/color/g2sgr/.impl {
Expand Down Expand Up @@ -140,6 +141,7 @@ function ble/color/g2sgr/.impl {
}
function ble/color/g2sgr/.clear-cache {
_ble_color_g2sgr=()
((_ble_color_g2sgr_version++))
}
function ble/color/g2sgr {
ret=${_ble_color_g2sgr[$1]}
Expand Down
3 changes: 2 additions & 1 deletion src/edit.sh
Expand Up @@ -1323,8 +1323,9 @@ function ble/prompt/.instantiate {
elif
local rows=${prompt_rows:-${LINES:-25}}
local cols=${prompt_cols:-${COLUMNS:-80}}
local color=$_ble_color_g2sgr_version
local bleopt=$bleopt_char_width_mode,$bleopt_char_width_version,$bleopt_emoji_version,$bleopt_emoji_opts
trace_hash=$opts#$rows,$cols#$bleopt#$expanded
trace_hash=$opts#$rows,$cols,$color#$bleopt#$expanded
[[ $trace_hash != "$trace_hash0" ]]
then
local trace_opts=$opts:prompt
Expand Down

0 comments on commit 40625ac

Please sign in to comment.