For pwsh and zsh, history is flushed to the file after every command that is run and we can also parse out the commands perfectly AFAICT including new lines. Contrast this to bash which doesn't flush and doesn't retain new lines (in a regular setup).
Because of this it would be ideal if we could remove previous session history all together for pwsh and zsh to consolidate on a single source of truth. However, we only parse pwsh and zsh history a single time per window currently and if we got rid of previous session we would need to track and continually update the window's knowledge of file history. An important thing to keep in mind here is we want no pty host latency when triggering the run recent command so when do we sync the history exactly?
For bash the problem is more complicated because:
bash does not flush history to file until the session exits
if bash it doesn't exit properly it can sometimes discard history
bash doesn't retain new lines, once you exit a session and history is flushed, even another bash session doesn't know 2 lines in .bash_history are 2 commands:
For pwsh and zsh, history is flushed to the file after every command that is run and we can also parse out the commands perfectly AFAICT including new lines. Contrast this to bash which doesn't flush and doesn't retain new lines (in a regular setup).
Because of this it would be ideal if we could remove previous session history all together for pwsh and zsh to consolidate on a single source of truth. However, we only parse pwsh and zsh history a single time per window currently and if we got rid of previous session we would need to track and continually update the window's knowledge of file history. An important thing to keep in mind here is we want no pty host latency when triggering the run recent command so when do we sync the history exactly?
For bash the problem is more complicated because: