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

Allow configuration of multiline prompt color #531

Merged
merged 5 commits into from
Jan 27, 2023

Conversation

dgkf
Copy link
Contributor

@dgkf dgkf commented Jan 13, 2023

The color of the multiline prompt is currently hard-coded to be LightBlue. This ended up being a pretty straightforward change to allow it to be configured using the Prompt trait similar to the other prompt colors.

One oddity in here is that the multiline prompt uses a nu_ansi_term::Color, whereas the other colors use a crossterm::style::Color. I'm not sure which one is preferred at this point, but I'd be willing to work toward some consistency if there's a current direction toward one or the other.

Comment on lines -43 to +49
let prompt_style = Style::new().fg(Color::LightBlue);

let multiline_prompt = prompt.render_prompt_multiline_indicator();
let prompt_style = Style::new().fg(prompt.get_prompt_multiline_color());
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is the heart of the change. Instead of fixing this to Color::LightBlue, it is instead configured in Prompt::get_prompt_multiline_color().

Comment on lines +110 to +112
fn get_prompt_multiline_color(&self) -> nu_ansi_term::Color {
DEFAULT_PROMPT_MULTILINE_COLOR
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added a new function to the Prompt to allow for it fetch a color. For now it uses a nu_ansi_term::Color unlike the others.

Copy link
Member

@sholderbach sholderbach left a comment

Choose a reason for hiding this comment

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

Thanks that is very reasonable!

new lints from rust 1.67
@sholderbach sholderbach merged commit e136626 into nushell:main Jan 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants