From fe339c3e79fe2b0a39ed4baf153e4c68280e382f Mon Sep 17 00:00:00 2001 From: Koichi Murase Date: Mon, 20 Feb 2023 11:51:57 +0900 Subject: [PATCH] prompt: fix a bug that "\u" is expanded to the shell name --- docs/ChangeLog.md | 1 + note.txt | 14 +++++++------- src/edit.sh | 2 +- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/docs/ChangeLog.md b/docs/ChangeLog.md index fb69cef0..90299613 100644 --- a/docs/ChangeLog.md +++ b/docs/ChangeLog.md @@ -105,6 +105,7 @@ - util (blehook): support `hook!=handler` and `hook+-=handler` `#D1791` 0b8c097 - prompt: escape control characters in `\w` and `\W` `#D1798` 8940434 a9551e5 - prompt: fix wrongly escaped UTF-8 chars in `\w` and `\W` `#D1806` d340233 + - prompt: fix a bug that `\u` is expanded to the shell name `#D1975` xxxxxxx - emacs: support `bleopt keymap_emacs_mode_string_multiline` (motivated by ArianaAsl) `#D1818` 8e9d273 - util: synchronize rlvars with `bleopt complete_{menu_color{,_match},skip_matched} term_bracketed_paste_mode` (motivated by ArianaAsl) `#D1819` 6d20f51 - util: suppress false warnings of `bind` inside non-interactive shells (reported by wukuan405) `#D1823` 1e19a67 diff --git a/note.txt b/note.txt index 0af00859..2c601395 100644 --- a/note.txt +++ b/note.txt @@ -1942,13 +1942,6 @@ bash_tips - keymap の移動 (これは別 commit にする?) - make_command.sh の整理 (scan 分離, char_width 分離) -2023-02-19 - - * cygwin: sudo すると PS1 の \u が bash に化けてしまう。何故? - - PS1='\u' だと発生しない。 PS1='\u\$ ' だと発生する。Cygwin では '\$' を特別 - 視してこれが含まれている時には自前処理している。 - 2023-02-12 * syntax: 5.0 以降では関数名として function `xxx` 等も実は許されている。5.3 @@ -6597,6 +6590,13 @@ bash_tips 2023-02-20 + * cygwin: sudo すると PS1 の \u が bash に化けてしまう。何故? [#D1975] + + PS1='\u' だと発生しない。 PS1='\u\$ ' だと発生する。Cygwin では '\$' を特別 + 視してこれが含まれている時には自前処理している。 + + 何と \s で展開していた。これは a9551e54 (2022-03-12 #D1801) で導入されている。 + * 2022-06-09 macOS の nawk の振る舞いが変だという事 (reported in killermoehre) [#D1974] https://github.com/akinomyoga/ble.sh/issues/190 diff --git a/src/edit.sh b/src/edit.sh index af071758..46cd6f80 100644 --- a/src/edit.sh +++ b/src/edit.sh @@ -597,7 +597,7 @@ function ble/prompt/initialize { _ble_prompt_const_s=$ret # user - ble/prompt/.initialize-constant '\s' 'ret=${USER:-$_ble_base_env_USER}' escape + ble/prompt/.initialize-constant '\u' 'ret=${USER:-$_ble_base_env_USER}' escape _ble_prompt_const_u=$ret # bash versions