Entered text can get overwritten while typing when wrapped
alrz opened this issue · comments
Code of Conduct
- I agree to follow this project's Code of Conduct
What happened?
Either:
- Type some text until it gets wrapped (resize for a quicker repro)
- Or past a long command and start editing it in the middle
This gif demonstrates the issue: https://i.sstatic.net/YUkP7.gif
This only happens in git-bash (windows terminal or the default console) but not powershell.
Note when the "blocks"
config is empty this doesn't happen.
Theme
What OS are you seeing the problem on?
Windows
Which shell are you using?
bash
Log output
(uploaded)
@alrz you have a command segment that inserts raw ANSI into the prompt. Remove that one and this should work as designed. We don't (and won't) escape input so you'll need to use a plaintext command output (git can do this), or resort to internal functionality to get the last commit information (which we have).
@alrz you have a command segment that inserts raw ANSI into the prompt. Remove that one and this should work as designed. We don't (and won't) escape input so you'll need to use a plaintext command output (git can do this), or resort to internal functionality to get the last commit information (which we have).
To diagnose this I have had removed segments one by one to see which one is the problem but that doesn't work until I comment out all of them. Just to be safe, I just now tried excluding the command segment as you suggested, but to no avail. Note the same setup didn't have this problem a while back but I'm not sure exactly at which point this appeared. Wondering if you could you get a repro with the information provided?
resort to internal functionality to get the last commit information (which we have).
On that, the reason I used a command
as opposed to built-in git was to print %cr
(last commit date, relative)
There is, once again, a bug in git bash and readline. I really, really dislike that shell with a passion. For reference, this doesn't happen on Linux, nor macOS.
@alrz it's a Git Bash bug and Nerd Font icons. They calculate the width incorrectly which is why this happens. You'll have to file a bug report on their end. This config works without issues, but as soon as you introduce a "special" character, it breaks:
{
"$schema": "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json",
"blocks": [
{
"alignment": "left",
"newline": true,
"segments": [
{
"foreground": "#3ae",
"properties": {
"time_format": "15:04"
},
"style": "plain",
"template": " {{ .CurrentDate | date .Format }} ",
"type": "time"
},
{
"type": "kubectl",
"style": "plain",
"foreground": "#3ae",
"template": " {{.Context}}{{if .Namespace}}:{{.Namespace}}{{end}} "
}
],
"type": "prompt"
},
{
"alignment": "left",
"newline": true,
"segments": [
{
"foreground": "#43CCEA",
"properties": {
"tag_icon": "\uf412 ",
"branch_icon": "\ueafd ",
"commit_icon": "\uF417 "
},
"style": "plain",
"template": "{{ .HEAD }}",
"type": "git"
},
{
"foreground": "#43CCEA",
//"leading_diamond": "<#ff70a6> \ue200 </>",
"properties": {
"shell": "bash",
"command": "git log --color -n 1 --format='%C(blue)(%cr)'"
},
"style": "plain",
"template": " {{ .Output }}",
"type": "command"
}
],
"type": "prompt"
},
{
"alignment": "left",
"newline": true,
"segments": [
{
"foreground": "lightBlue",
"foreground_templates": [
"{{ if gt .Code 0 }}#ef5350{{ end }}"
],
"properties": {
"always_enabled": true
},
"style": "plain",
"template": " {{ .Folder }} ",
"type": "status"
}
],
"type": "prompt"
}
],
"console_title_template": "{{ .Folder }}",
"transient_prompt": {
"background": "transparent",
"foreground": "#FEF5ED",
"template": " > "
},
"version": 2
}