Skip to content

repl: improve continuation prompt for incomplete expressions#12846

Merged
Mic92 merged 1 commit into
NixOS:masterfrom
allrealmsoflife:clearer-continuation-prompt
Apr 3, 2025
Merged

repl: improve continuation prompt for incomplete expressions#12846
Mic92 merged 1 commit into
NixOS:masterfrom
allrealmsoflife:clearer-continuation-prompt

Conversation

@allrealmsoflife

Copy link
Copy Markdown
Contributor

Motivation

This PR improves the REPL experience by making it clearer when the user is entering an incomplete expression.

Previously, when users entered an incomplete expression in the REPL, the continuation prompt was just 10 blank spaces, which looked invisible and gave the impression that the REPL had stalled or was unresponsive.

This change updates the prompt to " > ", aligning it visually with 'nix-repl> ' and clearly indicating that the REPL is waiting for more input.

Context

Fixes: #12702

The continuation prompt logic already existed (ReplPromptType::ContinuationPrompt) but used a prompt that was functionally invisible. This small change makes it visible and improves user feedback in multi-line expressions.
Implementation Notes

This is a small change in libcmd/repl-interacter.cc:

- return "          ";
+ return "         > ";

This makes no functional changes to how the REPL parses or evaluates input. It purely affects the string shown to the user when continuing a multi-line expression.

Add 👍 to pull requests you find important.

The Nix maintainer team uses a GitHub project board to schedule and track reviews.

Previously, when users entered an incomplete expression in the REPL,
the continuation prompt was just 10 blank spaces, which looked invisible
and gave the impression that the REPL had stalled.

This change updates the prompt to "         > ", aligning it visually
with 'nix-repl> ' and clearly indicating that the REPL is waiting for
more input.

Fixes: NixOS#12702
@roberth roberth added the backports rejected PR should not be backported (or at least not in full, or unless an overriding need arises) label Apr 2, 2025
@Mic92 Mic92 merged commit c0912a1 into NixOS:master Apr 3, 2025
@allrealmsoflife allrealmsoflife deleted the clearer-continuation-prompt branch April 3, 2025 09:41
@roberth

roberth commented Apr 9, 2025

Copy link
Copy Markdown
Member

Thanks!

@nixos-discourse

Copy link
Copy Markdown

This pull request has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/nix-2-29-0-released/64609/1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backports rejected PR should not be backported (or at least not in full, or unless an overriding need arises)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Repl line continuation prompt prefix

4 participants