Skip to content

Commit

Permalink
prompt: fix a bug that the special treatment of "\$" in Cygwin/MSYS i…
Browse files Browse the repository at this point in the history
…s disabled
  • Loading branch information
akinomyoga committed Jan 20, 2022
1 parent e14fa5d commit 4782a33
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
1 change: 1 addition & 0 deletions docs/ChangeLog.md
Expand Up @@ -249,6 +249,7 @@
- history: use `mapfile -d ''` to load history in Bash 5.2 `#D1603` 72c274e
- prompt: use `${PS1@P}` when the prompt contains only safe prompt sequences `#D1617` 8b5da08
- prompt: fix not properly set `$?` in `${PS1@P}` evaluation (reported by nihilismus) `#D1644` 521aff9
- prompt: fix a bug that the special treatment of `\$` in Cygwin/MSYS is disabled `#D1741` 0000000
- decode: cache `inputrc` translations `#D1652` 994e2a5
- complete: use `awk` for batch `quote-insert` (motivated by banoris) `#D1714` a0b2ad2 92d9734
- complete (quote-insert.batch): fix regex escaping in bracket expr of awk (reported by telometto) `#D1729` 8039b77
Expand Down
14 changes: 8 additions & 6 deletions note.txt
Expand Up @@ -1690,12 +1690,6 @@ bash_tips

2022-01-20

* cygwin で root prompt mark が正しく表示されなくなっていると思ったが、よく考
えたら ${PS1@P} を使う様にしているからではないか。振る舞いを修正している物
が含まれている場合にも ${PS1@P} の仕様は無効化する必要がある。

つまり、cygwin, msys, etc において PS1 に \$ が含まれていたら駄目。

* bash-completion や oh-my-bash の version と terminal ID について C-xC-v で
出力したい。

Expand Down Expand Up @@ -5844,6 +5838,14 @@ bash_tips

2022-01-20

* prompt: cygwin で root prompt mark が正しく表示されなくなっている [#D1741]

よく考えたら ${PS1@P} を使う様にしているからではないか。振る舞いを修正して
いる物が含まれている場合にも ${PS1@P} の仕様は無効化する必要がある。

つまり、cygwin, msys, etc において PS1 に \$ が含まれていたら駄目。
これは簡単な修正だった。

* prompt: bash-it や oh-my-bash で最初のプロンプトの座標計算がずれる [#D1740]

ble.sh を読み込むと最初のプロンプトの表示がずれてしまう。これは ble.sh をロー
Expand Down
2 changes: 2 additions & 0 deletions src/edit.sh
Expand Up @@ -1082,6 +1082,8 @@ function ble/prompt/.instantiate {

local expanded=
local chars_safe_esc='][0-7aenrdtAT@DhHjlsuvV!$\wW'
[[ ( $OSTYPE == cygwin || $OSTYPE == msys ) && $_ble_prompt_const_root == '#' ]] &&
chars_safe_esc=${chars_safe_esc//'$'} # Note: cygwin では ble.sh 独自の方法で \$ を処理する。
if ((_ble_bash>=40400)) && [[ $ps != *'\'[!"$chars_safe_esc"]* ]]; then
[[ $ps == *'\'[wW]* ]] && ble/prompt/unit/add-hash '$PWD'
ble-edit/exec/.setexit "$_ble_edit_exec_lastarg"
Expand Down

0 comments on commit 4782a33

Please sign in to comment.