Closed bearoxo closed 2 years ago
@bearoxo does this happen only in this repository folder? As it seems your git status is broken (which could add weird ANSI to the output).
@JanDeDobbeleer I fixed my git status issue and its still the same if I run git diff
.
Usually the cursor go haywire as well and it jumps around.
I usually just clear the terminal.
That's because of git diff. You might want to update your git version. We've seen this before. The output of old git diff versions can cause this.
git version 2.33.0.windows.2
It's identical to what's reported in 352. I never found out what was causing it though. The same question applies, do you have a specific pager or git config that can push me in some direction?
.gitconfig
theme json
{
"$schema": "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh3/main/themes/schema.json",
"blocks": [
{
"newline": true,
"type": "prompt",
"alignment": "right",
"segments": [
{
"type": "spotify",
"style": "powerline",
"powerline_symbol": "",
"invert_powerline": true,
"foreground": "#18354c",
"background": "#ecc100",
"properties": {
"postfix": " \uFC58 ",
"playing_icon": "",
"paused_icon": "",
"stopped_icon": "",
"track_separator" : " - "
}
},
{
"type": "executiontime",
"style": "powerline",
"powerline_symbol": "",
"invert_powerline": true,
"foreground": "#ecc100",
"background": "#18354c",
"properties": {
"prefix": " ",
"always_enabled": true,
"postfix": " \uF252 "
}
},
{
"type": "exit",
"style": "powerline",
"powerline_symbol": "",
"invert_powerline": false,
"foreground": "#18354c",
"background": "#07c800",
"properties": {
"always_enabled": true,
"display_exit_code": true,
"error_color": "#ee0000",
"color_background": true,
"success_icon": " ✔ "
}
}
]
},
{
"newline": true,
"type": "prompt",
"alignment": "left",
"segments": [
{
"type": "time",
"style": "powerline",
"foreground": "#ecc100",
"background": "#18354c",
"powerline_symbol": "",
"invert_powerline": true,
"properties": {
"prefix": " \uF017 ",
"time_format": " 3:04:05 PM "
}
},
{
"type": "time",
"style": "powerline",
"powerline_symbol": "",
"invert_powerline": true,
"foreground": "#18354c",
"background": "#ecc100",
"properties": {
"prefix": " \uF073 ",
"time_format": " Mon, 2/Jan/2006"
}
},
{
"type": "text",
"style": "powerline",
"foreground": "#ecc100",
"background": "#ecc100",
"powerline_symbol": "",
"properties": {
"text": ""
}
}
]
},
{
"type": "prompt",
"alignment": "right",
"segments": [
{
"type": "dotnet",
"style": "powerline",
"powerline_symbol": "",
"invert_powerline": true,
"foreground": "#ecc100",
"background": "#18354c",
"properties": {
"display_mode": "files",
"postfix": " \uE77F ",
"display_version": true
}
},
{
"type": "node",
"style": "powerline",
"powerline_symbol": "",
"invert_powerline": true,
"foreground": "#18354c",
"background": "#ecc100",
"properties": {
"postfix": " \uF898 ",
"display_version": true
}
},
{
"type": "go",
"style": "powerline",
"powerline_symbol": "",
"invert_powerline": true,
"foreground": "#ecc100",
"background": "#18354c",
"properties": {
"display_mode": "files",
"postfix": " \uE627 ",
"display_version": true
}
},
{
"type": "julia",
"style": "powerline",
"powerline_symbol": "",
"invert_powerline": true,
"foreground": "#18354c",
"background": "#ecc100",
"properties": {
"display_mode": "files",
"postfix": " \uE624 ",
"display_version": true
}
},
{
"type": "python",
"style": "powerline",
"powerline_symbol": "",
"invert_powerline": true,
"foreground": "#ecc100",
"background": "#18354c",
"properties": {
"postfix": " \uE235 ",
"display_version": true,
"display_mode": "files",
"display_virtual_env": false
}
},
{
"type": "ruby",
"style": "powerline",
"powerline_symbol": "",
"invert_powerline": true,
"foreground": "#18354c",
"background": "#ecc100",
"properties": {
"postfix": " \uE791 ",
"display_version": true,
"display_mode": "files"
}
},
{
"type": "aws",
"style": "powerline",
"powerline_symbol": "",
"invert_powerline": true,
"foreground": "#ecc100",
"background_templates": [
"{{if contains \"default\" .Profile}}#FFA400{{end}}",
"{{if contains \"jan\" .Profile}}#f1184c{{end}}"
],
"properties": {
"display_mode": "files",
"postfix": " \uE7AD ",
"display_default": false
}
},
{
"type": "azfunc",
"style": "powerline",
"powerline_symbol": "",
"invert_powerline": true,
"foreground": "#18354c",
"background": "#ecc100",
"properties": {
"postfix": " \uf0e7 ",
"display_version": false,
"display_mode": "files"
}
},
{
"type": "session",
"style": "powerline",
"foreground": "#ecc100",
"background": "#18354c",
"powerline_symbol": "",
"invert_powerline": true,
"properties": {
"postfix": " \uF007 ",
"display_host": false,
"display_user": true
}
},
{
"type": "root",
"style": "powerline",
"powerline_symbol": "",
"invert_powerline": false,
"foreground": "#18354c",
"background": "#07c800",
"properties": {
"root_icon": " \uF80A "
}
}
]
},
{
"newline": true,
"type": "prompt",
"alignment": "left",
"segments": [
{
"type": "os",
"style": "powerline",
"powerline_symbol": "",
"invert_powerline": true,
"foreground": "#ecc100",
"background": "#18354c",
"properties": {
"postfix": "",
"windows": "\uF17A ",
"macos": "mac"
}
},
{
"type": "path",
"style": "powerline",
"powerline_symbol": "",
"foreground": "#ecc100",
"background": "#18354c",
"properties": {
"home_icon": "\uF7DD ",
"folder_icon": " \uF07C ",
"style": "agnoster"
}
},
{
"type": "text",
"style": "diamond",
"leading_diamond": "",
"foreground": "#ecc100",
"background": "#18354c00",
"properties": {
"prefix": "",
"text": ""
}
}
]
},
{
"type": "rprompt",
"segments": [
{
"type": "git",
"style": "diamond",
"leading_diamond": "",
"trailing_diamond": "",
"foreground": "#18354c",
"background": "#07c800",
"properties": {
"branch_icon": "\uF126 | ",
"display_status": true,
"display_stash_count": true,
"display_upstream_icon": true,
"status_colors_enabled": true,
"local_changes_color": "#fffb00",
"ahead_color": "#07c800",
"ahead_and_behind_color": "#fffb00",
"behind_color": "#ee0000",
"working_color": "#cc1100",
"staging_color": "#ff9100",
"color_background": true,
"stash_count_icon": "\uF692 "
}
}
]
}
],
"final_space": true,
"console_title": true,
"console_title_style": "template",
"console_title_template": " {{ .Host }} | {{ .Path }} "
}
This is a weird bug where git diff is outputting characters it shouldn't. Can you open up an issue at git for windows?
@JanDeDobbeleer If you trick your git diff
to do git diff --color=always
you can probably reproduce the issue as it will force terminal color codes into the output, which is what the copy-paste from #352 looked like it had and possibly here also.
If you're doing git diff
in the Go code you may wanna do git diff --color=never
so that no other config can turn it on behind your back. (That flag is not a global setting that gets remembered, just a flag for command that moment.)
I took a quick glance at the git segment here: https://github.com/JanDeDobbeleer/oh-my-posh/blob/main/src/segment_git.go and I could not find any execution of "git diff" though. (Is the diff output used somewhere else?)
@bearoxo Hey, a little googling and it seems the "index file corrupt" may be an issue with your actual repo (and might explain ohmyposh failing to parse its state.) I found this SO post: https://stackoverflow.com/questions/1115854/how-to-resolve-error-bad-index-fatal-index-file-corrupt-when-using-git
Could you humor my theory and git-clone a fresh copy of your repo from whatever its origin url is? and tell me: does the prompt break when you "cd" into there, from that new fresh clone of your repo? (and maybe do a few edits like removing some lines from a readme, just so it's in a non-clean state.)
If it still breaks, it's an ohmyposh bug.
If it doesn't break, your git repo was corrupt and you may need to do something about it.
@darkvertex tried to reproduce using your suggestion, doesn't really do anything. I'm unable to reproduce this so grasping for straws here.
@bearoxo does this still occur on newer versions of both git and oh-my-posh?
@bearoxo does this still occur on newer versions of both git and oh-my-posh?
No. I haven't got this problem from quite some time.
@bearoxo in that case I'm closing the issue. Feel free to reopen in case it happens again.
This issue has been automatically locked since there has not been any recent activity (i.e. last half year) after it was closed. It helps our maintainers focus on the active issues. If you have found a problem that seems similar, please open a discussion first, complete the body with all the details necessary to reproduce, and mention this issue as reference.
Code of Conduct
What happened?
Sometime the prompt breaks. Using it on Powershell 5 or 7 on VS Code terminal.
Version
oh-my-posh 5.6.4
Theme
Customized theme using the documented segments.
What OS are you seeing the problem on?
Windows
Which shell are you using?
powershell
Relevant log output
No response