Powerlevel9k / powerlevel9k

Powerlevel9k was a tool for building a beautiful and highly functional CLI, customized for you. P9k had a substantial impact on CLI UX, and its legacy is now continued by P10k.
https://github.com/romkatv/powerlevel10k
MIT License
13.47k stars 947 forks source link

[Bugfix] Right-side prompt segments with an icon but no content double-print whitespace #1217

Closed ChrisBaker97 closed 5 years ago

ChrisBaker97 commented 5 years ago

When generating a right-side prompt segment that has an icon but no other content (like status in the OK state), whitespace is inserted both before and after this empty content, resulting in an extended prompt segment. When there is content, it looks fine, because there should be whitespace on both sides of the text:

image

(Showing status segment on both left and right for comparison.)

This fix modifies the logic in default.p9k for right-side prompt generation so that a second whitespace character is not inserted in the event of an empty ${content} string. However, it leaves the previous bracketing whitespace intact if content exists:

image
dritter commented 5 years ago

Thanks @ChrisBaker97 and sorry for the late reply.