curusarn / resh

RESH ❯❯ Contextual shell history for zsh and bash
MIT License
1.01k stars 19 forks source link

RESH-CLI: implicit ordering by time is weird #126

Closed curusarn closed 4 years ago

curusarn commented 4 years ago

Without a query, I would expect to see the latest history based on the current context.

But look at this: Screenshot from 2020-05-02 16-02-43 There should be history that is newer than 15 hours.

curusarn commented 4 years ago

the underlying reason why this can happen: no explicit time sorting is happening - history records are implicitly ordered as they are appended to the history file

2 reasons why records can be in the wrong order:

  1. records that are added during the uptime of the daemon are not properly appended to "the end" of the in-memory list
  2. manually appending history to ~/.resh_history.json messes up the order and it is never fixed
curusarn commented 4 years ago

https://github.com/curusarn/resh/commit/45cded18f217427ce6da37dace178ad8d23ad1b3