[X] I agree to follow this project's Code of Conduct
What happened?
I will use the attached theme as an example:
Left prompt - 13 chars
Breathing room - 5 chars (hardcoded)
Right prompt - 6 chars
Expected behavior
When using overflow: hide, I expect right-aligned prompts to be printed only if everything fits.
Using my example:
+------------------------+
|LLLLLLLLLLLLL RRRRRR| # width=24, everything is printed
+------------------------+
+-----------------------+
|LLLLLLLLLLLLL | # width=23, not enough breathing room, right prompt is not printed
+-----------------------+
+------------+
|LLLLLLLLLLLL| # width=12, overflow case, only the last line is counted.
|L RRRRRR|
+------------+
Current behavior
The right prompt is printed as long as the width of the terminal is more or equal to the length of the left prompt and the breathing room. The length of the right prompt is not accounted for.
Using my exapmle:
+------------------------+
|LLLLLLLLLLLLL RRRRRR| # width=24, everything is printed
+------------------------+
+-------------------+
|LLLLLLLLLLLLLRRRRRR| # width=19, the right prompt is printed, even though no breathing room is left.
+-------------------+ # Why? Because leftPrompt+breathingRoom <= width. (13+5 <= 19)
+------------------+
|LLLLLLLLLLLLLRRRRR| # width=18, the right prompt is printed, even though it overflows to the next line.
|R | # Why? Because leftPrompt+breathingRoom <= width. (13+5 <= 18)
+------------------+
+-----------------+
|LLLLLLLLLLLLL | # width=17, right prompt is hidden becaue 13+5 > 18.
+-----------------+
+------------+
|LLLLLLLLLLLL| # width=12, overflow case, only the last line is counted.
|L RRRRRR|
+------------+
For type: rprompt, the behavior is similar, except it hides instead of overflowing to the next line when width=18.
Possible fix
Engine.canWriteRightBlock function could take length of the new block as an argument, and calculate the result as
Code of Conduct
What happened?
I will use the attached theme as an example:
Right prompt - 6 chars
Expected behavior
When using
overflow: hide
, I expect right-aligned prompts to be printed only if everything fits.Using my example:
Current behavior
The right prompt is printed as long as the width of the terminal is more or equal to the length of the left prompt and the breathing room. The length of the right prompt is not accounted for.
Using my exapmle:
For
type: rprompt
, the behavior is similar, except it hides instead of overflowing to the next line when width=18.Possible fix
Engine.canWriteRightBlock
function could take length of the new block as an argument, and calculate the result asNote: I'm not sure whether shells other than ZSH are affected.
Theme
I am using the following config to test this functionality:
What OS are you seeing the problem on?
macOS
Which shell are you using?
zsh
Log output