Skip to content

fix(prompt): restore the clock in the fallback right prompt - #19613

Merged
kronberger-droid merged 2 commits into
nushell:mainfrom
kronberger-droid:fallback-right-prompt-clock
Nov 22, 2026
Merged

kronberger-droid merged 2 commits into
nushell:mainfrom
kronberger-droid:fallback-right-prompt-clock

Conversation

@kronberger-droid

Copy link
Copy Markdown
Contributor

Description

reedline 0.53 dropped its built-in CurrentDateTime segment as part of removing chrono (nushell/reedline#1248), since a clock needs the local timezone and std cannot provide one.
DefaultPrompt::default() now has an empty right prompt.

Nushell falls back to DefaultPrompt whenever no right prompt is set, so under --no-config-file or with $env.config.prompt.right = null the clock silently disappeared.
That was missed when bumping reedline.

The fallback now builds its own DefaultPrompt with a DefaultPromptSegment::Dynamic clock rendered by jiff, in the same %m/%d/%Y %I:%M:%S %p format reedline used.
The left side stays the working directory.

Sessions with a config are unaffected, since the default right prompt there is still the Nu closure in DEFAULT_PROMPTS.

Tests: nu-cli prompt:: 7/7, including a new the_fallback_right_prompt_is_a_clock.

User-facing changes (Release notes)

Fixed the right prompt being empty when running without a config file.
It shows the current date and time again.

Additional notes

Follow-up to the reedline 0.53 bump.

AI:W WRITE

reedline 0.53 dropped its `CurrentDateTime` segment along with chrono,
since a clock needs the local timezone and std cannot provide one, and
left `DefaultPrompt::default()` with an empty right prompt. Our fallback
went through that default, thus `--no-config-file` and a `null`
`prompt.right` lost the clock without anyone deciding so.

The clock is now ours, rendered with jiff through
`DefaultPromptSegment::Dynamic` in the format reedline used.
@kronberger-droid
kronberger-droid marked this pull request as ready for review November 20, 2026 00:15

@fdncred fdncred left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review overview

🟢 Minor suggestions

The clock is back. On 2118887, nu --no-config-file and a config with $env.config.prompt.right = null both show the date and time again, in the local zone (I checked TZ=Asia/Tokyo, UTC and EST5EDT against date), and prompt.right = "" still gives no right prompt. One comment nit left.

Findings: 0 High severity · 0 Medium severity · 1 Low severity

Open (1)

Notes from my clanker, checked on 2118887. Built the branch, ran cargo test -p nu-cli --lib -- prompt:: (7 passed), and drew the first prompt in a PTY on the branch binary and on main 651f0e4 with --no-config-file, several TZ values, prompt.right = null, prompt.right = "" and the default prompts. Didn't run clippy locally. CI's lint jobs passed on this head.

Comment thread crates/nu-cli/src/prompt.rs Resolved
@github-actions

Copy link
Copy Markdown

Hey, just a bot checking in! You edited files related to the configuration.
If you changed any of the default values or added a new config option, don't forget to update the doc_config.nu which documents the options for our users including the defaults provided by the Rust implementation.
If you didn't make a change here, you can just ignore me.

@kronberger-droid
kronberger-droid merged commit e6ab229 into nushell:main Nov 22, 2026
16 checks passed
@github-actions github-actions Bot added this to the v0.118.0 milestone Nov 22, 2026
@fdncred fdncred added notes:fixes Noted in "Bug fixes" section notes:ready Indicates Ready for Release notes labels Nov 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

notes:fixes Noted in "Bug fixes" section notes:ready Indicates Ready for Release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants