Open ageron opened 1 week ago
The history_index is lost/reset each time you press enter / validate the line.
If we keep this history_index
state, we must ensure that it is invalidated if History
is cleared / reloaded / ...
linenoise
behaves like rustyline
because rustyline
was based on linenoise
but readline
behaves like you describe)History
trait ?
Julia's REPL has a really nice feature: when you press the \<down> key and you just picked and executed command #N in the history, then the REPL will select command #N+1 in the history (assuming you haven't pressed \<up> yet).
For example:
Rationale: it's very common to execute several commands in a row from the history (perhaps skipping or editing a few of them). If these commands are far up in the history, then it's cumbersome to have to go back up for each one of them. Thanks to this "next command" feature, you only need to go back up for the command #N, then for every subsequent command, you just press once (or several times if you want to skip some commands).
It's probably not very hard to implement, and it's a real pleasure to use (git it a try!). Plus it won't break any user's expectations since this scenario currently does nothing at all.