Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

repl: add support for multiline history #57400

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

puskin94
Copy link
Contributor

@puskin94 puskin94 commented Mar 10, 2025

Previously, when navigating the history in the Node.js REPL, multiline commands were displayed line by line, making it difficult to review and edit complete blocks of input.

This PR improves the REPL history behavior by treating multiline commands as a single entry. Now, when scrolling through history, entire blocks of multiline input are displayed together, improving usability and consistency.

Key changes:

  • Adjusted history handling to store and retrieve multiline commands as single entries.
  • Updated navigation logic to properly display multiline inputs.
  • Improved editing experience, allowing users to modify multiline history entries in place.

Impact:

This change significantly enhances the REPL experience for users who frequently enter complex or multiline expressions, making command recall and editing more intuitive.

Testing:

  • Manually tested with various multiline inputs, both on unix and windows systems
  • Verified history navigation behaves as expected with both single-line and multiline commands.

Demos

Before:

before

After:

after

@nodejs-github-bot nodejs-github-bot added needs-ci PRs that need a full CI run. readline Issues and PRs related to the built-in readline module. repl Issues and PRs related to the REPL subsystem. labels Mar 10, 2025
@puskin94 puskin94 force-pushed the repl-multiline-history branch 2 times, most recently from 9137def to 5f9b8f1 Compare March 12, 2025 10:27
@puskin94 puskin94 marked this pull request as ready for review March 12, 2025 10:27
Copy link

codecov bot commented Mar 12, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 90.22%. Comparing base (27f98c3) to head (8b261ae).
Report is 33 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #57400      +/-   ##
==========================================
+ Coverage   90.20%   90.22%   +0.01%     
==========================================
  Files         630      629       -1     
  Lines      185307   185145     -162     
  Branches    36269    36237      -32     
==========================================
- Hits       167162   167044     -118     
+ Misses      11084    11053      -31     
+ Partials     7061     7048      -13     
Files with missing lines Coverage Δ
lib/internal/readline/interface.js 96.95% <100.00%> (+<0.01%) ⬆️
lib/internal/repl/history.js 86.26% <100.00%> (ø)
lib/repl.js 94.95% <100.00%> (+0.04%) ⬆️

... and 56 files with indirect coverage changes

🚀 New features to boost your workflow:
  • Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@puskin94 puskin94 force-pushed the repl-multiline-history branch from 5f9b8f1 to 8b261ae Compare March 12, 2025 12:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-ci PRs that need a full CI run. readline Issues and PRs related to the built-in readline module. repl Issues and PRs related to the REPL subsystem.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants