Closed ukdocCT closed 2 months ago
Could you provide the JSON theme in a code block? It's hard to read. Also, could you provide a larger image of the terminal?
I can reproduce this.
@lewis-yeung same but I haven't found the culprit just yet.
~@JanDeDobbeleer It's caused by the terminal width being reduced by 1 for patching the PowerShell bleed bug.~
@lewis-yeung probably I'm an idiot, but even removing that doesn't solve it as the patching isn't enabled here yet the bug remains.
This can be interesting and somewhat weird. After testing and debugging, I think the root cause lies in how PowerShell/PSReadLine handles the case when the prompt line reaches the rightmost cell on the terminal screen. Moreover, the behavior is inconsistent in different terminal programs.
I did tests on Windows and WSL 2, in VS Code terminal and Windows Terminal, with patch_pwsh_bleed
set to false
. All transient prompts are spawned by pressing the Enter key with empty input buffer in PowerShell v7.4.5 and PSReadLine v2.4.0.
Only on WSL 2 and in VS Code terminal can a transient prompt line fill up to the rightmost cell:
For other three combinations, it can only reach the cell previous to the rightmost one:
The key is, the cursor refuses to move forward to the line end even though a printed prompt line reaches the rightmost cell (i.e., it stays before the rightmost cell), thus a subsequent character will overwrite the existing one in the rightmost cell. This results in the bug that we see: the next character which is the first one of the command, seized the rightmost cell.
UPDATED: More info from my further tests:
filler
for the transient prompt does not work at all in Zsh.filler
for the transient prompt.@lewis-yeung OK, so I'm not an idiot after all. I had the same analysis after debugging over lunch.
You can also see, when you do TerminalWidth++
, it has 1 character on the next line. So oh-my-posh is calculating the width correctly, it's after printing that PSReadLine swallows the last character.
We'll have to create a bug on their end as I didn't find a way to patch this. It's either too short, or too long.
@lewis-yeung on the update, the logic is always identical as to how we position a right aligned block. So any differences theoretically originate from the shell itself.
The filler for the transient prompt does not work at all in Zsh.
I noticed that, and that theres no Info about this in the doc, is this an unpatched bug? @lewis-yeung
is this an unpatched bug?
@snoweuph It should be, but I haven't found the root cause.
Dann :(
@lewis-yeung I investigated this as well, didn't understand what is causing this as oh-my-posh does print it if I remember correctly.
Code of Conduct
What happened?
I recently implemented transient prompt for use in my powershell oh-my-plus config. I added the following block:
"transient_prompt": { "background": "transparent", "foreground": "#FEF5ED", "template": "\ue285 ", "filler": "~", "newline": true },
However, when i run a command it shows the first character of the command as the last character of my filler row:It does this for powershell 5 and 7 inside and outside terminal.
Theme
Custom theme:
What OS are you seeing the problem on?
Windows
Which shell are you using?
powershell
Log output