render right prompt on the last row of the left prompt
This PR makes nushell+starship behave like other shells (e.g. zsh). Related: starship/starship#3982 Closes nushell/nushell#4909
- nushell native prompt

- nushell + starship(disable
line_breakandadd_newline)
- nushell + starship(enable
line_breakand disableadd_newline)
- nushell + starship(enable
line_breakandadd_newline)
to me, it's a bit weird to have the left prompt and the right prompt on different lines. My personal preference would be like the middle one in #4909. Is this option available with your change?
starship on master [$] is 📦 v1.4.2 via 🦀 v1.59.0 10/16/2022 12:08:15 AM
❯
Is this option available with your change? Nope. This PR always render the right prompt on the last row. Shall we provide an option to render it on the first or the last row?
My personal preference would be like the middle one in #4909.
I think you must have disabled add_newline :joy:
I have a base implementation to control whether we render the right prompt on the first or last line by setting an environment variable. @fdncred

it's a beautiful things @nibon7! thanks for considering my request!
I don't have strong opinions on this one. Will the right prompt still be hidden when the first line is full? Do we need to make this an option?
I do think this should be some configurable option in nushell vs an env var maybe?
Will the right prompt still be hidden when the first line is full?
In fact, we just calculate the width of the last row, so if there are multiple rows and the last row is not full, it won't be hidden.
https://github.com/nushell/reedline/blob/5061d2288c7ab8373700253ad56127fb8b0b5f73/src/painting/prompt_lines.rs#L95-L118
e.g. (term size).columns is 79, the following code still shows the right prompt.
let-env PROMPT_COMMAND = { "LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLONG_LINE_EATEN\n<PROMPT_INDICATOR>" }
let-env PROMPT_COMMAND_RIGHT = { "RIGHT_PROMPT" }
If there is one line, it will be hidden.
Do we need to make this an option?
I think it's nice to provide an option to let right prompt to override if the line is full.
I do think this should be some configurable option in nushell vs an env var maybe?
Agreed, I did this just for a quick test.
@sholderbach I think we're ready to land this if you are, as well as https://github.com/nushell/nushell/pull/6781 when ready.
Let's get this in, I haven't fully validated the last line behavior but that can probably best evaluated with the nushell side with the different prompt configurations.