diff options
| author | Koichi Murase <myoga.murase@gmail.com> | 2024-01-07 01:45:19 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-01-06 16:45:19 +0000 |
| commit | 86f2c8e58806020bc04999a5039e18ff10409e59 (patch) | |
| tree | 77fdbdd1a2307cc6c6b1dfc967c3c2ff0e32cab9 /docs/static/img | |
| parent | feat: rework record sync for improved reliability (#1478) (diff) | |
| download | atuin-86f2c8e58806020bc04999a5039e18ff10409e59.zip | |
fix(bash): avoid unexpected `atuin history start` for keybindings (#1509)
This fixes the second issue of "0s or wrong command duration" reported
at https://github.com/atuinsh/atuin/issues/1003.
The problem is that, with bash-preexec, the preexec hook may be called
even for the commands executed by the keybindings.
* In particular, the preexec is called before the command
`__atuin_history` is executed on pressing [C-r] and [up]. In this
case, $1 passed to `__atuin_preexec` contains the last entry in the
command history, so `atuin history start` is called for the last
command. As a result, pressing [C-r] and [up] clears the duration
of the last command. This causes the reported 0s duration.
* Furthermore, the precmd hook corresponding to the keybinding command
will not be called, so the duration is only filled when the next
user command starts. This replaces the duration of the last command
with the time interval between the last press of [C-r] or [up] and
the start time of the next command. This causes the reported wrong
duration.
There is no general and robust way to distinguish the preexec
invocation for keybindings from that for the user commands, but in
this patch we exclude the preexec invocation for Atuin's keybindings
[C-r] and [up] at least.
Diffstat (limited to 'docs/static/img')
0 files changed, 0 insertions, 0 deletions
