JanDeDobbeleer / oh-my-posh

The most customisable and low-latency cross platform/shell prompt renderer
https://ohmyposh.dev
MIT License
17.01k stars 2.37k forks source link

Path segment has double seperator #2943

Closed TDarkShadow closed 1 year ago

TDarkShadow commented 1 year ago

Code of Conduct

What happened?

After updating from Oh My Posh v12.1.0 to v12.2.1, the path seperator at C:/ is doubled.

Theme

Custom theme ```json { "$schema": "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json", "console_title_template": "{{if .Root}}\u26a1 {{end}}PowerShell {{.ShellVersion}}", "blocks": [ { "alignment": "left", "segments": [ { "foreground": "cyan", "properties": { "style": "round", "threshold": 2000 }, "style": "plain", "template": "took {{ .FormattedMs }}\n", "type": "executiontime" } ], "type": "prompt" }, { "alignment": "left", "segments": [ { "foreground": "white", "properties": { "display_user": false }, "style": "plain", "template": "{{ if .SSHSession }}\uf817 {{ end }}{{ .HostName }} ", "type": "session" }, { "foreground": "blue", "properties": { "mapped_locations_enabled": false, "style": "full" }, "style": "plain", "template": "{{ .Path }} ", "type": "path" }, { "foreground": "lightYellow", "style": "plain", "properties": { "cherry_pick_icon": "\u2713 ", "commit_icon": "\u25b7 ", "fetch_status": true, "merge_icon": "\u25f4 ", "no_commits_icon": "[no commits]", "rebase_icon": "\u2c62 ", "tag_icon": "\u25b6 " }, "style": "plain", "template": "{{ .HEAD }}{{ if and (eq .Ahead 0) (eq .Behind 0) }} \u2261{{end}}{{ if gt .Ahead 0 }} \u2191{{.Ahead}}{{end}}{{ if gt .Behind 0 }} \u2193{{.Behind}}{{end}} {{ if .Working.Changed }}+{{ .Working.Added }} ~{{ .Working.Modified }} -{{ .Working.Deleted }} {{ end }}", "type": "git" } ], "type": "prompt" }, { "type": "newline" }, { "alignment": "left", "segments": [ { "foreground": "yellow", "properties": { "root_icon": "\u2206" }, "style": "powerline", "template": " \uf0e7 ", "type": "root" }, { "foreground": "white", "properties": { "display_host": false }, "style": "plain", "template": "{{ if .SSHSession }}\uf817 {{ end }}<#0973C0>{{ .UserName }} ", "type": "session" }, { "foreground": "green", "foreground_templates": [ "{{ if gt .Code 0 }}lightRed{{ end }}" ], "properties": { "always_enabled": true }, "style": "powerline", "template": "\u279c ", "type": "exit" } ], "type": "prompt" } ], "version": 2 } ```

But the bug even occurs with just the Path segment.

What OS are you seeing the problem on?

Windows

Which shell are you using?

powershell

Log output

<details>
<summary>Fairly lengthy</summary>
Version: 12.2.1

Segments:

ConsoleTitle(true)   -   1 ms - PowerShell
executiontime(false) -   0 ms -
session(true)        -   1 ms - DESKTOP-3RU1PVD
path(true)           -   1 ms - C:\\Users\Maxime
git(false)           -  53 ms -
root(false)          -   0 ms -
session(true)        -   0 ms - Maxime
exit(true)           -  76 ms - ➜

Run duration: 171.6112ms

Cache path: C:\Users\Maxime\AppData\Local\oh-my-posh

Config path: C:\Users\Maxime\.oh-my-posh.omp.json

Logs:

2022/10/14 11:23:08 debug: Getenv
C:\Users\Maxime\AppData\Local
2022/10/14 11:23:08 Getenv duration: 722.5µs, args: LOCALAPPDATA
2022/10/14 11:23:08 CachePath duration: 3.2781ms, args:
2022/10/14 11:23:08 debug: Getenv
C:\Users\Maxime\.oh-my-posh.omp.json
2022/10/14 11:23:08 Getenv duration: 0s, args: POSH_THEME
2022/10/14 11:23:08 debug: Shell
process name: pwsh.exe
2022/10/14 11:23:08 Shell duration: 28.7443ms, args:
2022/10/14 11:23:08 resolveConfigPath duration: 28.7443ms, args:
2022/10/14 11:23:08 Init duration: 32.2038ms, args:
2022/10/14 11:23:08 Flags duration: 0s, args:
2022/10/14 11:23:08 config.loadConfig duration: 2.042ms, args:
2022/10/14 11:23:08 Flags duration: 0s, args:
2022/10/14 11:23:08 debug: Getenv

2022/10/14 11:23:08 Getenv duration: 0s, args: OMP_CACHE_DISABLED
2022/10/14 11:23:08 WindowsRegistryKeyValue duration: 0s, args: HKEY_CURRENT_USER\Software\Microsoft\Windows\DWM\ColorizationColor
2022/10/14 11:23:08 GOOS duration: 0s, args:
2022/10/14 11:23:08 GOOS duration: 0s, args:
2022/10/14 11:23:08 GOOS duration: 0s, args:
2022/10/14 11:23:08 GOOS duration: 0s, args:
2022/10/14 11:23:08 GOOS duration: 0s, args:
2022/10/14 11:23:08 GOOS duration: 0s, args:
2022/10/14 11:23:08 GOOS duration: 0s, args:
2022/10/14 11:23:08 GOOS duration: 0s, args:
2022/10/14 11:23:08 GOOS duration: 0s, args:
2022/10/14 11:23:08 GOOS duration: 0s, args:
2022/10/14 11:23:08 GOOS duration: 0s, args:
2022/10/14 11:23:08 GOOS duration: 0s, args:
2022/10/14 11:23:08 GOOS duration: 0s, args:
2022/10/14 11:23:08 GOOS duration: 0s, args:
2022/10/14 11:23:08 GOOS duration: 0s, args:
2022/10/14 11:23:08 GOOS duration: 0s, args:
2022/10/14 11:23:08 GOOS duration: 0s, args:
2022/10/14 11:23:08 GOOS duration: 0s, args:
2022/10/14 11:23:08 GOOS duration: 0s, args:
2022/10/14 11:23:08 debug: WindowsRegistryKeyValue
ColorizationColor(DWORD): 0xC40078D7
2022/10/14 11:23:08 Root duration: 0s, args:
2022/10/14 11:23:08 Shell duration: 0s, args:
2022/10/14 11:23:08 ErrorCode duration: 0s, args:
2022/10/14 11:23:08 IsWsl duration: 0s, args:
2022/10/14 11:23:08 GOOS duration: 0s, args:
2022/10/14 11:23:08 debug: Pwd
C:\Users\Maxime
2022/10/14 11:23:08 Pwd duration: 451.3µs, args:
2022/10/14 11:23:08 debug: Home
C:\Users\Maxime
2022/10/14 11:23:08 GOOS duration: 0s, args:
2022/10/14 11:23:08 GOOS duration: 0s, args:
2022/10/14 11:23:08 GOOS duration: 0s, args:
2022/10/14 11:23:08 GOOS duration: 0s, args:
2022/10/14 11:23:08 GOOS duration: 0s, args:
2022/10/14 11:23:08 GOOS duration: 0s, args:
2022/10/14 11:23:08 GOOS duration: 0s, args:
2022/10/14 11:23:08 GOOS duration: 0s, args:
2022/10/14 11:23:08 GOOS duration: 0s, args:
2022/10/14 11:23:08 debug: User
Maxime
2022/10/14 11:23:08 User duration: 0s, args:
2022/10/14 11:23:08 debug: Host
DESKTOP-3RU1PVD
2022/10/14 11:23:08 Host duration: 0s, args:
2022/10/14 11:23:08 GOOS duration: 0s, args:
2022/10/14 11:23:08 TemplateCache duration: 451.3µs, args:
2022/10/14 11:23:08 Flags duration: 0s, args:
2022/10/14 11:23:08 debug: Pwd
C:\Users\Maxime
2022/10/14 11:23:08 Pwd duration: 0s, args:
2022/10/14 11:23:08 debug: Home
C:\Users\Maxime
2022/10/14 11:23:08 GOOS duration: 0s, args:
2022/10/14 11:23:08 ExecutionTime duration: 0s, args:
2022/10/14 11:23:08 Flags duration: 0s, args:
2022/10/14 11:23:08 debug: Pwd
C:\Users\Maxime
2022/10/14 11:23:08 Pwd duration: 0s, args:
2022/10/14 11:23:08 debug: Home
C:\Users\Maxime
2022/10/14 11:23:08 GOOS duration: 0s, args:
2022/10/14 11:23:08 debug: Getenv

2022/10/14 11:23:08 Getenv duration: 0s, args: SSH_CONNECTION
2022/10/14 11:23:08 debug: Getenv

2022/10/14 11:23:08 Getenv duration: 0s, args: SSH_CLIENT
2022/10/14 11:23:08 TemplateCache duration: 0s, args:
2022/10/14 11:23:08 TemplateCache duration: 0s, args:
2022/10/14 11:23:08 Shell duration: 0s, args:
2022/10/14 11:23:08 debug: Pwd
C:\Users\Maxime
2022/10/14 11:23:08 Pwd duration: 0s, args:
2022/10/14 11:23:08 debug: Home
C:\Users\Maxime
2022/10/14 11:23:08 GOOS duration: 0s, args:
2022/10/14 11:23:08 debug: Pwd
C:\Users\Maxime
2022/10/14 11:23:08 Pwd duration: 0s, args:
2022/10/14 11:23:08 Shell duration: 0s, args:
2022/10/14 11:23:08 Flags duration: 0s, args:
2022/10/14 11:23:08 PathSeparator duration: 0s, args:
2022/10/14 11:23:08 GOOS duration: 0s, args:
2022/10/14 11:23:08 GOOS duration: 0s, args:
2022/10/14 11:23:08 GOOS duration: 0s, args:
2022/10/14 11:23:08 GOOS duration: 0s, args:
2022/10/14 11:23:08 GOOS duration: 0s, args:
2022/10/14 11:23:08 GOOS duration: 0s, args:
2022/10/14 11:23:08 PathSeparator duration: 0s, args:
2022/10/14 11:23:08 PathSeparator duration: 0s, args:
2022/10/14 11:23:08 PathSeparator duration: 0s, args:
2022/10/14 11:23:08 PathSeparator duration: 0s, args:
2022/10/14 11:23:08 PathSeparator duration: 0s, args:
2022/10/14 11:23:08 PathSeparator duration: 0s, args:
2022/10/14 11:23:08 IsWsl duration: 0s, args:
2022/10/14 11:23:08 StackCount duration: 0s, args:
2022/10/14 11:23:08 debug: Pwd
C:\Users\Maxime
2022/10/14 11:23:08 Pwd duration: 0s, args:
2022/10/14 11:23:08 DirIsWritable duration: 0s, args:
2022/10/14 11:23:08 TemplateCache duration: 0s, args:
2022/10/14 11:23:08 TemplateCache duration: 0s, args:
2022/10/14 11:23:08 Shell duration: 0s, args:
2022/10/14 11:23:08 debug: Pwd
C:\Users\Maxime
2022/10/14 11:23:08 Pwd duration: 0s, args:
2022/10/14 11:23:08 debug: Home
C:\Users\Maxime
2022/10/14 11:23:08 GOOS duration: 0s, args:
2022/10/14 11:23:08 GOOS duration: 0s, args:
2022/10/14 11:23:08 debug: CommandPath
C:\Program Files\Git\cmd\git.exe
2022/10/14 11:23:08 CommandPath duration: 53.1348ms, args: git.exe
2022/10/14 11:23:08 HasCommand duration: 53.1348ms, args: git.exe
2022/10/14 11:23:08 debug: Pwd
C:\Users\Maxime
2022/10/14 11:23:08 Pwd duration: 0s, args:
2022/10/14 11:23:08 error: HasParentFilePath
CreateFile C:\.git: The system cannot find the file specified.
2022/10/14 11:23:08 HasParentFilePath duration: 722.7µs, args: .git
2022/10/14 11:23:08 Flags duration: 0s, args:
2022/10/14 11:23:08 Flags duration: 0s, args:
2022/10/14 11:23:08 debug: Pwd
C:\Users\Maxime
2022/10/14 11:23:08 Pwd duration: 0s, args:
2022/10/14 11:23:08 debug: Home
C:\Users\Maxime
2022/10/14 11:23:08 GOOS duration: 0s, args:
2022/10/14 11:23:08 Root duration: 0s, args:
2022/10/14 11:23:08 debug: Pwd
C:\Users\Maxime
2022/10/14 11:23:08 Pwd duration: 0s, args:
2022/10/14 11:23:08 debug: Home
C:\Users\Maxime
2022/10/14 11:23:08 GOOS duration: 0s, args:
2022/10/14 11:23:08 debug: Getenv

2022/10/14 11:23:08 Getenv duration: 0s, args: SSH_CONNECTION
2022/10/14 11:23:08 debug: Getenv

2022/10/14 11:23:08 Getenv duration: 0s, args: SSH_CLIENT
2022/10/14 11:23:08 TemplateCache duration: 0s, args:
2022/10/14 11:23:08 TemplateCache duration: 0s, args:
2022/10/14 11:23:08 Shell duration: 0s, args:
2022/10/14 11:23:08 debug: Pwd
C:\Users\Maxime
2022/10/14 11:23:08 Pwd duration: 0s, args:
2022/10/14 11:23:08 debug: Home
C:\Users\Maxime
2022/10/14 11:23:08 GOOS duration: 0s, args:
2022/10/14 11:23:08 ErrorCode duration: 0s, args:
2022/10/14 11:23:08 TemplateCache duration: 0s, args:
2022/10/14 11:23:08 TemplateCache duration: 0s, args:
2022/10/14 11:23:08 Shell duration: 0s, args:
2022/10/14 11:23:08 TemplateCache duration: 0s, args:
2022/10/14 11:23:08 debug: Getenv
C:\Users\Maxime\AppData\Local
2022/10/14 11:23:08 Getenv duration: 0s, args: LOCALAPPDATA
2022/10/14 11:23:08 CachePath duration: 997µs, args:
2022/10/14 11:23:08 Flags duration: 0s, args:
</details>
JanDeDobbeleer commented 1 year ago

Duplicate of #2939 and resolved in 12.2.2

TDarkShadow commented 1 year ago

My apologies, thanks for the fast response!

JanDeDobbeleer commented 1 year ago

@TDarkShadow all fine, thanks for reporting this one! Good looking out 👍🏻

iseneirik commented 1 year ago

@JanDeDobbeleer is this related to my home-folder no longer displaying as ~ in the sorin theme? My $HOME points to the correct location, but my prompt in $HOME still displays C:\Users\myusername

JanDeDobbeleer commented 1 year ago

@iseneirik maybe, can you show me the output of oh-my-posh debug?

iseneirik commented 1 year ago

@JanDeDobbeleer Nevermind, seems my $Env:HOMEDRIVE and $Env:HOMEPATH where set to "L:" and "\" for some reason.

github-actions[bot] commented 9 months ago

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.