diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2024-04-09 22:16:49 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2024-04-09 22:16:49 -0700 |
commit | 10f1fccf8116f00d57562009dee8d335a30bd0a7 (patch) | |
tree | 03ca5045a2c09c38b129a9eecbcd323c359595c6 | |
parent | 815a4afea9dfd9ec854d66aa7ef50f5f7bd7c252 (diff) | |
download | basta-10f1fccf8116f00d57562009dee8d335a30bd0a7.tar.gz basta-10f1fccf8116f00d57562009dee8d335a30bd0a7.tar.bz2 basta-10f1fccf8116f00d57562009dee8d335a30bd0a7.zip |
Worked out way of protecting $_ variable.
- Remove Bugs section from README.
- Add new basta_uln_save global variable. We don't
have to preserve its value across reloads since it
is only temporarily used.
- The ALRM and WINCH traps set up by basta.install_hooks
are now three-command sequences which save $_ into
the global, then run the handler, and the restore
it using a trick involving the : null command.
-rw-r--r-- | README.md | 6 | ||||
-rw-r--r-- | basta.sh | 4 |
2 files changed, 2 insertions, 8 deletions
@@ -75,9 +75,3 @@ See the license block at the bottom of the file. The second clause says that any binary code (as if that would exist for shell customization code, ha!) is not required to carry any copyright notice. - -## Bugs - -The `$_` variable, which holds the last argument of the previous -command, is unreliable under Basta. It gets clobbered by the dispatch -of the signal trap handler refreshes the status line. @@ -8,6 +8,7 @@ basta_scroll_lines=${basta_scroll_lines-0} basta_prev_reserved_rows=${basta_prev_reserved_rows-} basta_status_alarm_pid=${basta_status_alarm_pid-} +basta_uln_save= basta.query_terminal_lines() { @@ -136,8 +137,7 @@ basta.alarm_timer() basta.install_hooks() { - trap basta.update_status ALRM - trap basta.update_status WINCH + trap 'basta_uln_save=$_; basta.update_status; : "$basta_uln_save"' ALRM WINCH trap basta.cleanup EXIT PROMPT_COMMAND='basta.initial_prompt_hook' } |