Skip to content

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

Closed
@kgryte

Description

@kgryte

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

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:.

Metadata

Metadata

Assignees

Labels

EnhancementIssue or pull request for enhancing existing functionality.JavaScriptIssue involves or relates to JavaScript.Needs DiscussionNeeds further discussion.REPLIssue or pull request specific to the project REPL.RFCRequest for comments. Feature requests and proposed changes.difficulty: 3Likely to be challenging but manageable.priority: NormalNormal priority concern or feature request.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions