Skip to content

Commit

Permalink
edit: fix a bug that "set +H" is cancelled on command execution
Browse files Browse the repository at this point in the history
  • Loading branch information
akinomyoga committed Apr 14, 2020
1 parent b7b42eb commit 02bdf4e
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 7 deletions.
4 changes: 3 additions & 1 deletion memo/ChangeLog.md
Expand Up @@ -20,6 +20,7 @@
- util (`ble/util/print-global-definitions`): support arrays and unset variables (test-util) 6e85f1c
- util (`ble/util/cat`): support NUL and multiple files (test-util) d19a9af
- edit: support Bash 5.1 `READLINE_MARK` and `PROMPT_COMMANDS` `#D1328` e97a858
- syntax: support confusing parameter expansions like `${#@}`, etc. `#D1330` b7b42eb

## Changes

Expand Down Expand Up @@ -74,6 +75,7 @@
- history: fix a problem that the history is doubled by `history -a` in `bashrc` `#D1314` 34821fe
- util (`ble/variable#get-attr`): fix an error message with special variable names such as `?` and `*` `#D1321` 557b774
- util (has-glob-pattern): fix abort in subshells (test-util) `#D1326` dc292a2
- edit: fix a bug that `set +H` is cancelled on command execution `#D1332` 0000000

## Compatibility

Expand All @@ -95,7 +97,7 @@
- complete: follow Bash-5.1 change of arithmetic literal `10#` `#D1322` 557b774
- decode: fix a bug of broken cmap cache found in ble-0.3 `#D1327` 16b56bf
- util (strftime): fix a bug not working with `-v var` option in Bash <= 4.1 (test-util) f1a2818
- complete: work around slow `compgen -c` in Cygwin `#D1329` 0000000
- complete: work around slow `compgen -c` in Cygwin `#D1329` 5327f5d

## Internal changes and fixes

Expand Down
24 changes: 19 additions & 5 deletions note.txt
Expand Up @@ -1018,18 +1018,13 @@ bash_tips

2020-04-09

* set +H としても次のコマンドの実行の時には履歴展開が有効になってしまう。
set -H についても記録・復元するべきである。

* 別の bash の枠組みについて
https://github.com/sio/bash-complete-partial-path
https://github.com/mgalgs/fuzzy_bash_completion
https://github.com/brujoand/sbp

2020-04-02

* highlight: hello! () { echo; } として hello! としても関数名着色にならない

* test: テストフレームワークの追加機能

* 単体テストの機能
Expand Down Expand Up @@ -2865,6 +2860,25 @@ bash_tips

2020-04-14

* edit: set +H としても次のコマンドの実行の時には履歴展開が有効になってしまう [#D1332]
set -H についても記録・復元するべきである。

というよりもそもそも何故 set -H が設定されているのだったか。
D0110 によるとそもそも履歴展開が実行されないということの様だ。
確かに自前で history -p を呼び出して履歴展開を実行している。
という事は eval では履歴展開は発生しないという事を意味する。
set -H は履歴展開を起こす為に念の為に設定した物であって、
特にいま history -p を使って自前で展開しているので不要である。
単に削除する事にする。

* 棄却 2020-04-02 highlight: hello! () { echo; } として hello! としても関数名着色にならない [#D1331]
と思ったがこれは履歴展開を含む単語は単純単語ではないと判断される為である。
更に、単語の境界が必ず履歴展開の終端とも限らない。
例えば echo hello!; は !; で履歴展開になっている。
従って hello! の部分だけ見て ! が末端にあるからと言って、
それが履歴展開にならないという事は保証できないのである。
これは対応しない。

* syntax: ${#@a} の着色 [#D1330]
どうも $@ に修飾 # とごみ a がついていると解析している気がする。
然し、実際には $# に修飾 @a がついていると解釈するべきである。
Expand Down
1 change: 0 additions & 1 deletion src/edit.sh
Expand Up @@ -4351,7 +4351,6 @@ function ble-edit/exec:gexec/.begin {
ble/term/leave
ble/util/buffer.flush >&2
ble-edit/bind/stdout.on
set -H

# C-c に対して
builtin trap -- 'blehook/invoke INT' INT # 何故か改めて実行しないと有効にならない
Expand Down

0 comments on commit 02bdf4e

Please sign in to comment.