Skip to content
This repository has been archived by the owner on Apr 24, 2020. It is now read-only.

Fix RPROMPT_ON_NEWLINE when PROMPT_ON_NEWLINE is set to false #843

Open
wants to merge 1 commit into
base: next
Choose a base branch
from

Conversation

notrev
Copy link

@notrev notrev commented May 18, 2018

By having the RPROMPT_ON_NEWLINE if-block only inside the PROMPT_ON_NEWLINE == true if-block, RPROMPT_ON_NEWLINE is ignored in the case where (RPROMPT_ON_NEWLINE == false) && (PROMPT_ON_NEWLINE == false) and there is a newline segment in the left prompt. This causes the right prompt to always be drawn in the second line.

This patch fixes the issue #840

Copy link
Member

@dritter dritter left a comment

Choose a reason for hiding this comment

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

Hi @notrev !
Thanks for your contribution. Honestly I am a bit ambivalent on this change. It seems like a good thing to give the user more control over the vertical placement of the prompts, but with the risk that it could break in some circumstances..

@@ -1500,26 +1500,25 @@ powerlevel9k_prepare_prompts() {
# Reset start time
_P9K_TIMER_START=0x7FFFFFFF

if [[ "$POWERLEVEL9K_RPROMPT_ON_NEWLINE" != true ]]; then
Copy link
Member

Choose a reason for hiding this comment

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

The Reason why that codeblock was inside of POWERLEVEL9K_PROMPT_ON_NEWLINE is that we wanted to align left and right prompt accordingly. So, with your change it is possible to have no newline on the left prompt at all, but move the right prompt one line up..
I don't say that this is necessarily bad, as the user still has full control over this.

Copy link
Author

Choose a reason for hiding this comment

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

If this is an impediment for merging, I can add a check for newlinesegments too.
On other hand, if you have POWERLEVEL9K_PROMPT_ADD_NEWLINE=true and the right prompt is printed one line before the left prompt, you can think of the segments in the right prompt as related to the previous command, like the status segment. I think this would provide another nice option for the right prompt.

Copy link

Choose a reason for hiding this comment

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

This is what I wanted!

@bhilburn
Copy link
Member

bhilburn commented Oct 8, 2018

I'd like to go ahead and close out this PR, whether the decision is merging it or foregoing it.

The use-case discussed by @notrev and seconded by @Zeta611 does indeed sound interesting, and i could see some people wanting to use the RPROMPT as basically reporting on the previous command that was run.

The only change, here, appears to be moving the conditional block outside of the other conditional. I'm okay with this as long as we expect existing configurations to continue to work with no changes. That is indeed the case, as I understand it - is that accurate, @dritter?

@bhilburn
Copy link
Member

bhilburn commented Jan 3, 2019

Just found this one again - I don't want this to accidentally bitrot. Would be good to either just close it intentionally or merge it.

@dritter - Based on your understanding of the code, if we merge this PR as-is, existing configurations would continue to work, right?

If so, I'm okay merging, although this PR does also need an update to the README documenting this feature. Also, I just changed the target to next, so it'll need the usual conflict resolution for moving to the new codebase.

@Martmists-GH
Copy link

Any ETA on when this gets merged?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants