feat(line_break): add break_below_width option #5760
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
When specified, this option will change
line_break
's behaviour to only insert a line break when the width of the terminal is below the given value.Motivation and Context
I value being able to see as much of my terminal history as possible, so my current starship configuration disables
line_break
. This is disadvantageous in narrow terminals, as commands I type are more likely to wrap and my right prompt may not be displayed at all.Setting an appropriate
break_below_width
value allows users like me to increase the vertical space used by their prompt only when horizontal space is at a premium: I don't "lose" lines of history off the top of my screen except when doing so will give me more space to type and/or mean that my right prompt will be displayed.Screenshots (if appropriate):
These screenshots are of the same prompt with only the width of the terminal changed:
How Has This Been Tested?
I have built
starship
locally with this change (on an Ubuntu 20.04 system) and tested it by:break_below_width
and resizing my terminal across the boundary to observe its behaviourbreak_below_width
and confirming that a line break is always emittedAdditionally, there are
cargo test
tests to ensure that the correct output is being emitted.Checklist: