Skip to content

Commit

Permalink
edit: restore "PS1" while processing "bind -x"
Browse files Browse the repository at this point in the history
  • Loading branch information
akinomyoga committed Mar 16, 2023
1 parent b91b8bc commit 2eadcd5
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 3 deletions.
3 changes: 3 additions & 0 deletions README-ja_JP.md
Expand Up @@ -328,6 +328,9 @@ $ cp -r ble-0.3.3 /path/to/blesh
[[ ${BLE_VERSION-} ]] && ble-attach
```

`source /path/to/ble.sh` 及び `ble-attach` を呼び出す時は、
標準ストリーム (`stdin`, `stdout`, `stderr`) が現在のセッションの制御端末とは別の物にリダイレクトされていない様にして下さい。
`source /path/to/ble.sh` をシェル関数の中から実行するのは避けて下さい。
この「より確実な設定」が必要になる詳細な条件については [Discussion #254 への回答 (英語)](https://github.com/akinomyoga/ble.sh/discussions/254#discussioncomment-4284757) で説明されています。

## 1.4 初期化スクリプト `~/.blerc` について
Expand Down
8 changes: 5 additions & 3 deletions README.md
Expand Up @@ -57,8 +57,7 @@ place other module files in appropriate places, and strip code comments for shor

Note: This does not involve any C/C++/Fortran compilations and generating binaries, so C/C++/Fortran compilers are not needed.
Some people seem to bilindly believe that one always need to use `make` with C/C++/Fortran compilers to generate binaries.
They complain about `ble.sh`'s make process, which comes from the lack of knowledge on `make`.
One should learn the general principle of `make`.
They complain about `ble.sh`'s make process, but it comes from the lack of knowledge on the general principle of `make`.
C/C++ programs in the repository is used to update the Unicode character table from the Unicode database when a new Unicode standard appears.
The generated table is included in the repository:
[`canvas.GraphemeClusterBreak.sh`](https://github.com/akinomyoga/ble.sh/blob/master/src/canvas.GraphemeClusterBreak.sh),
Expand Down Expand Up @@ -308,7 +307,7 @@ The stable versions are significantly old compared to the devel version, so many

## 1.3 Set up `.bashrc`<sup><a id="set-up-bashrc" href="#set-up-bashrc">†</a></sup>

If you want to load `ble.sh` by default in interactive sessions of `bash`, usually one can just source `ble.sh` in `~/.bashrc`,
If you want to load `ble.sh` in interactive sessions of `bash` by default, usually one can just source `ble.sh` in `~/.bashrc`,
but more reliable way is to add the following codes to your `.bashrc` file:

```bash
Expand All @@ -323,6 +322,9 @@ but more reliable way is to add the following codes to your `.bashrc` file:
[[ ${BLE_VERSION-} ]] && ble-attach
```

Basically, when `source /path/to/ble.sh` and `ble-attach` are performed,
standard streams (`stdin`, `stdout`, and `stderr`) should not be redirected but should be connected to the controlling TTY of the current session.
Also, please avoid calling `source /path/to/ble.sh` in shell functions.
The detailed conditions that we need the above *more reliable setup* are explained in [an answer in Discussion #254](https://github.com/akinomyoga/ble.sh/discussions/254#discussioncomment-4284757).

## 1.4 User settings `~/.blerc`
Expand Down
1 change: 1 addition & 0 deletions docs/ChangeLog.md
Expand Up @@ -500,6 +500,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` a5b10e8
- edit: always adjust the terminal states with `bind -x` (reported by linwaytin) `#D1983` 5d14cf1
- edit: restore `PS1` while processing `bind -x` (reported by adoyle-h) `#D2024` xxxxxxxx
- syntax: suppress brace expansions in designated array initialization in Bash 5.3 `#D1989` 1e7b884
- progcomp: work around slow `nix` completion `#D1997` 2c1aacf
- complete: suppress error messages from `_adb` (reported by mozirilla213) `#D2005` f2aa32b0
Expand Down
6 changes: 6 additions & 0 deletions note.txt
Expand Up @@ -6716,6 +6716,12 @@ bash_tips

2023-03-16

* edit: bind -x で PS1 も一時的に復元する (requested by adoyle-h) [#D2024]
https://github.com/akinomyoga/ble.sh/issues/304

lincheney/fzf-tab-completion で退避中の一時 PS1 が表示されるというから何か
と思ったら自分で PS1 を出力しているのだった。

* 2023-03-06 menu-complete: 番号で選択する (requested by bkerin) [#D2023]
https://github.com/akinomyoga/ble.sh/discussions/284

Expand Down
2 changes: 2 additions & 0 deletions src/edit.sh
Expand Up @@ -10420,9 +10420,11 @@ function ble/widget/.EDIT_COMMAND {
local -x READLINE_ARGUMENT=$_ble_edit_arg
ble/edit/enter-command-layout # #D1800 pair=leave-command-layout
ble/widget/.hide-current-line keep-header
ble-edit/restore-PS1
ble/term/leave-for-widget
builtin eval -- "$command"; local ext=$?
ble/term/enter-for-widget
ble-edit/adjust-PS1
ble-edit/content/clear-arg
ble/edit/leave-command-layout # #D1800 pair=enter-command-layout

Expand Down

0 comments on commit 2eadcd5

Please sign in to comment.