stdlib-js/stdlib

[RFC]: add support for whole command insertion when pressing up/down in the REPL

kgryte opened this issue · 0 comments

Description

This RFC proposes changing the default behavior in the REPL such that, when hitting the up/down arrow, an entire command is inserted, rather than just a line.

Currently, if you enter multi-line input

In [1]: function foo() {
    // ...
};

In [2]: <|>

and hit the up arrow, you get

In [2]:    };

This may be useful, but it is likely not what you want. Instead, you'd probably prefer to cycle through the entire command. In which case, when we press the UP arrow, we'd like to re-enter multi-line mode with the entirety of the previous command.

Note that currently we rely on built-in readline/REPL history behavior. In order to support this feature, we may need to maintain our own history record and capture key presses in order to efficiently cycle through entire previous commands.

Related Issues

  • Reverse search is related: #2069

Questions

  • Should this be configurable?
  • Should we support a mode (e.g., via a modifier key) to allow single-line insertion, as currently supported?

Other

No.

Checklist

  • I have read and understood the Code of Conduct.
  • Searched for existing issues and pull requests.
  • The issue name begins with RFC:.