Closed stanio closed 3 months ago
@stanio Can you share the OMP theme? Without that, I can't attempt to reproduce or analyze what's happening.
Or, if you prefer not to share the OMP theme, then you could do these steps instead:
clink set debug.log_terminal true
to turn on logging of everything that's printed by Clink.clink.log
file from your Clink profile directory into a reply here (the file's location can be found via clink info
).clink set debug.log_terminal false
to turn off logging again.@stanio Never mind -- I made a custom prompt that prints text all the way to the right edge, and it reproduces the issue.
Note that printing text all the way to the right edge means resizing the terminal window will behave strangely (it will try to wrap the line strangely upon resize). Since I avoid letting prompts do that, I didn't notice the issue.
This seems to be an issue in how Windows Terminal and/or the Windows console subsystem implements the EraseInLine (EL) escape code ESC [ K
.
Clink appends ESC [ K
to the end of each line, to clear any leftover text on the line.
Mintty handles the ESC [ K
correctly when the cursor is past the right edge of the screen.
It seems that if text is printed up to the right edge of the screen, then Windows Terminal doesn't recognize that the cursor is actually past the right edge, and the ESC [ K
ends up also accidentally clearing the last character in the line.
The same issue seems to happen in the legacy conhost. So it seems like this is a very long-standing issue in the implementation of EraseInLine in the Windows console subsystem.
Since it's been around for a very long time, it isn't a recent regression. So, I'll make a change in Clink to work around this issue in the console subsystem.
The same issue seems to happen in the legacy conhost. So it seems like this is a very long-standing issue in the implementation of EraseInLine in the Windows console subsystem.
Sorry for the late reply. Thank you very much for looking into and providing a fix for it.
Using:
Unsure if it is strictly a Clink problem. Using oh-my-posh and a right-aligned block in the prompt, the character in the last column gets erased:
For comparison, the same prompt in Bash appears fine:
OMP theme fragment
```jsonc "blocks": [ { "alignment": "right", "segments": [ { "foreground": "green", "style": "plain", "template": "{{ if .SSHSession }}\uf817 {{ end }}{{ .UserName }}@{{ .HostName }}", "type": "session" }, { "foreground": "red", "properties": { "root_icon": "root" }, "style": "plain", "template": " as \uf0e7", "type": "root" } ], "type": "prompt" }, ... ```As a workaround, I'm using an extra space character at the end of this right-aligned block.