JanDeDobbeleer / oh-my-posh

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

Windows Terminal: Unexpected space between segments #3534

Closed fluentmoheshwar closed 1 year ago

fluentmoheshwar commented 1 year ago

Code of Conduct

What happened?

Unexpected space between exit and executiontime. The solutions mentioned on https://ohmyposh.dev/docs/faq#windows-terminal-unexpected-space-between-segmentstext didn't work.

image

Theme

# yaml-language-server: $schema=https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json

console_title_template: "{{.Shell}} in {{.PWD}} {{if .Root}}(root){{end}}"

blocks:
  - alignment: left
    segments:
      - type: os
        background: "#001832"
        foreground: "#ffffff"
        properties:
          macos: " "
          ubuntu: " "
          windows: " "
        style: powerline
        powerline_symbol: ""
        template: " {{ if .WSL }}WSL at {{ end }}{{.Icon}}"

      - type: "session"
        background: "#001832"
        foreground": "#ffffff"
        template: " {{ if .SSHSession }}\uf817 {{ end }}{{ .UserName }}@{{ .HostName }} "
        style: powerline
        powerline_symbol: ""

      - type: shell
        style: powerline
        powerline_symbol: ""
        foreground: "#ffffff"
        background: "#001832"
        properties:
          mapped_shell_names:
            pwsh: PS

      - type: time
        background: "#001832"
        foreground: "#ffffff"
        properties:
          time_format: 3:04PM
        style: powerline
        powerline_symbol: ""
        template: " Time: {{ .CurrentDate | date .Format }} "

      - type: path
        background: "#00342c"
        foreground: "#ffffff"
        powerline_symbol: ""
        properties:
          style: folder
        style: powerline
        template: "  {{ .Path }} "

      - type: git
        background: "#33cc33"
        foreground: "#193549"
        powerline_symbol: ""
        properties:
          fetch_stash_count: true
          fetch_status: true
          fetch_upstream_icon: true
        style: powerline
        template:
          " {{ .HEAD }} {{ .BranchStatus }}{{ if .Working.Changed }}  {{ .Working.String
          }}{{ end }}{{ if and (.Staging.Changed) (.Working.Changed) }} |{{ end }}{{ if
          .Staging.Changed }}  {{ .Staging.String }}{{ end }}{{ if gt .StashCount 0}}
           {{ .StashCount }}{{ end }}{{ if gt .WorktreeCount 0}}  {{ .WorktreeCount
          }}{{ end }} "

      - type: dotnet
        background: "#6CA35E"
        foreground: "#ffffff"
        powerline_symbol: ""
        properties:
          fetch_version: true
        style: powerline
        template: "  {{ if .Unsupported }}{{ else }}{{ .Full }}{{ end }} "

      - type: node
        background: "#0366d6"
        foreground: "#ffffff"
        powerline_symbol: ""
        properties:
          fetch_package_manager: true
        style: powerline
        template:
          " {{ if .PackageManagerIcon }}{{ .PackageManagerIcon }} {{ end }}{{
          .Full }}"
        yarn_icon: ""
        npm_icon: ""

      - type: python
        display_mode: context
        background: "#0366d6"
        foreground: "#ffffff"
        powerline_symbol: ""
        style: powerline
        template: "  {{ .Full }} "

      - type: root
        background: "#0099ff"
        foreground: "#ffffff"
        powerline_symbol: ""
        style: powerline
        template: "  "

      - type: exit
        background: "#ffffff"
        foreground: "#FF0000"
        powerline_symbol: ""
        properties:
          always_enabled: true
        style: powerline
        template: "{{ if gt .Code 0 }} 󰋔 {{ .Meaning }}{{ else }} 󰣐 {{ end }}"

      - type: executiontime
        background: "#575656"
        foreground: "#d6deeb"
        properties:
          style: roundrock
          threshold: 0
          always_enabled: true
        style: powerline
        powerline_symbol: ""
        template: " {{ .FormattedMs }} "

    type: prompt

final_space: true
version: 2

What OS are you seeing the problem on?

Windows

Which shell are you using?

powershell

Log output

Version: 14.8.0

Segments:

ConsoleTitle(true)  -   4 ms - pwsh in ~ (root)
os(true)            -   0 ms -  
session(true)       -   0 ms -  fluen@HP
shell(true)         -   0 ms -  PS
time(true)          -   0 ms -  Time: 7:19PM
path(true)          -   5 ms -   ~
git(false)          -  36 ms -
dotnet(false)       -   0 ms -
node(false)         -   0 ms -
python(false)       -   0 ms -
root(true)          -   0 ms -  
exit(true)          -   3 ms -  󰣐
executiontime(true) -   0 ms -  0ms

Run duration: 200.6764ms

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

Config path: C:\Users\fluen\ohmyposh.yaml

Logs:

[DEBUG] 19:19:38.836 shell.go:Getenv:377 → C:\Users\fluen\AppData\Local
[TRACE] 19:19:38.836 shell.go:Getenv(LOCALAPPDATA) - 3.6668ms
[TRACE] 19:19:38.837 shell_windows.go:CachePath() - 4.2161ms
[DEBUG] 19:19:38.839 shell.go:Getenv:377 → C:\Users\fluen\ohmyposh.yaml
[TRACE] 19:19:38.839 shell.go:Getenv(POSH_THEME) - 0s
[DEBUG] 19:19:38.854 shell.go:Shell:622 → process name: pwsh.exe
[TRACE] 19:19:38.854 shell.go:Shell() - 14.8887ms
[TRACE] 19:19:38.854 shell.go:resolveConfigPath() - 14.8887ms
[TRACE] 19:19:38.854 shell.go:Init() - 21.6628ms
[TRACE] 19:19:38.854 shell.go:Flags() - 0s
[TRACE] 19:19:38.961 config.go:loadConfig() - 37.6748ms
[TRACE] 19:19:38.961 shell.go:Flags() - 0s
[DEBUG] 19:19:38.961 shell.go:Getenv:377 → NO DATA
[TRACE] 19:19:38.981 shell.go:Getenv(OMP_CACHE_DISABLED) - 20.4891ms
[TRACE] 19:19:38.981 shell_windows.go:WindowsRegistryKeyValue(HKEY_CURRENT_USER\Software\Microsoft\Windows\DWM\ColorizationColor) - 0s
[TRACE] 19:19:38.981 shell.go:GOOS() - 0s
[TRACE] 19:19:38.981 shell.go:GOOS() - 0s
[TRACE] 19:19:38.981 shell.go:GOOS() - 0s
[TRACE] 19:19:38.981 shell.go:GOOS() - 0s
[TRACE] 19:19:38.981 shell.go:GOOS() - 0s
[TRACE] 19:19:38.981 shell.go:GOOS() - 0s
[TRACE] 19:19:38.981 shell.go:GOOS() - 0s
[TRACE] 19:19:38.981 shell.go:GOOS() - 0s
[TRACE] 19:19:38.981 shell.go:GOOS() - 0s
[TRACE] 19:19:38.981 shell.go:GOOS() - 0s
[TRACE] 19:19:38.981 shell.go:GOOS() - 0s
[TRACE] 19:19:38.981 shell.go:GOOS() - 0s
[TRACE] 19:19:38.981 shell.go:GOOS() - 0s
[TRACE] 19:19:38.981 shell.go:GOOS() - 0s
[TRACE] 19:19:38.981 shell.go:GOOS() - 0s
[TRACE] 19:19:38.981 shell.go:GOOS() - 0s
[TRACE] 19:19:38.981 shell.go:GOOS() - 0s
[TRACE] 19:19:38.981 shell.go:GOOS() - 0s
[TRACE] 19:19:38.981 shell.go:GOOS() - 0s
[DEBUG] 19:19:38.981 shell_windows.go:WindowsRegistryKeyValue:206 → ColorizationColor(DWORD): 0xC4723A03
[TRACE] 19:19:38.986 shell_windows.go:Root() - 4.5662ms
[TRACE] 19:19:38.986 shell.go:Shell() - 0s
[TRACE] 19:19:38.986 shell.go:ErrorCode() - 0s
[TRACE] 19:19:38.986 shell_windows.go:IsWsl() - 0s
[TRACE] 19:19:38.986 shell.go:GOOS() - 0s
[DEBUG] 19:19:38.986 shell.go:Pwd:405 → NO DATA
[TRACE] 19:19:38.986 shell.go:Pwd() - 0s
[DEBUG] 19:19:38.986 shell_windows.go:56 → C:\Users\fluen
[TRACE] 19:19:38.986 shell.go:GOOS() - 0s
[TRACE] 19:19:38.986 shell.go:GOOS() - 0s
[TRACE] 19:19:38.986 shell.go:GOOS() - 0s
[TRACE] 19:19:38.986 shell.go:GOOS() - 0s
[TRACE] 19:19:38.986 shell.go:GOOS() - 0s
[TRACE] 19:19:38.986 shell.go:GOOS() - 0s
[TRACE] 19:19:38.986 shell.go:GOOS() - 0s
[TRACE] 19:19:38.986 shell.go:GOOS() - 0s
[DEBUG] 19:19:38.986 shell.go:User:526 → fluen
[TRACE] 19:19:38.986 shell.go:User() - 0s
[DEBUG] 19:19:38.986 shell.go:Host:538 → HP
[TRACE] 19:19:38.986 shell.go:Host() - 0s
[TRACE] 19:19:38.986 shell.go:GOOS() - 0s
[TRACE] 19:19:38.986 shell.go:TemplateCache() - 4.5662ms
[TRACE] 19:19:38.986 shell.go:Flags() - 0s
[DEBUG] 19:19:38.986 shell.go:Pwd:385 → C:\Users\fluen
[TRACE] 19:19:38.986 shell.go:Pwd() - 0s
[DEBUG] 19:19:38.986 shell_windows.go:56 → C:\Users\fluen
[TRACE] 19:19:38.986 shell.go:GOOS() - 0s
[TRACE] 19:19:38.986 shell.go:GOOS() - 0s
[TRACE] 19:19:38.986 shell.go:TemplateCache() - 0s
[TRACE] 19:19:38.986 shell.go:TemplateCache() - 0s
[TRACE] 19:19:38.986 shell.go:Shell() - 0s
[DEBUG] 19:19:38.986 shell.go:Pwd:385 → C:\Users\fluen
[TRACE] 19:19:38.986 shell.go:Pwd() - 0s
[DEBUG] 19:19:38.986 shell_windows.go:56 → C:\Users\fluen
[TRACE] 19:19:38.986 shell.go:GOOS() - 0s
[DEBUG] 19:19:38.986 shell.go:Getenv:377 → NO DATA
[TRACE] 19:19:38.986 shell.go:Getenv(SSH_CONNECTION) - 0s
[DEBUG] 19:19:38.986 shell.go:Getenv:377 → NO DATA
[TRACE] 19:19:38.986 shell.go:Getenv(SSH_CLIENT) - 0s
[TRACE] 19:19:38.986 shell.go:TemplateCache() - 0s
[TRACE] 19:19:38.986 shell.go:TemplateCache() - 0s
[TRACE] 19:19:38.986 shell.go:Shell() - 0s
[DEBUG] 19:19:38.986 shell.go:Pwd:385 → C:\Users\fluen
[TRACE] 19:19:38.986 shell.go:Pwd() - 0s
[DEBUG] 19:19:38.986 shell_windows.go:56 → C:\Users\fluen
[TRACE] 19:19:38.986 shell.go:GOOS() - 0s
[TRACE] 19:19:38.986 shell.go:Shell() - 0s
[TRACE] 19:19:38.986 shell.go:Flags() - 0s
[TRACE] 19:19:38.986 shell.go:TemplateCache() - 0s
[TRACE] 19:19:38.986 shell.go:TemplateCache() - 0s
[TRACE] 19:19:38.986 shell.go:Shell() - 0s
[DEBUG] 19:19:38.986 shell.go:Pwd:385 → C:\Users\fluen
[TRACE] 19:19:38.986 shell.go:Pwd() - 0s
[DEBUG] 19:19:38.986 shell_windows.go:56 → C:\Users\fluen
[TRACE] 19:19:38.986 shell.go:GOOS() - 0s
[TRACE] 19:19:38.986 shell.go:TemplateCache() - 0s
[TRACE] 19:19:38.986 shell.go:TemplateCache() - 0s
[TRACE] 19:19:38.986 shell.go:Shell() - 0s
[DEBUG] 19:19:38.986 shell.go:Pwd:385 → C:\Users\fluen
[TRACE] 19:19:38.986 shell.go:Pwd() - 0s
[DEBUG] 19:19:38.992 shell_windows.go:56 → C:\Users\fluen
[TRACE] 19:19:38.992 shell.go:GOOS() - 0s
[DEBUG] 19:19:38.992 shell.go:Pwd:385 → C:\Users\fluen
[TRACE] 19:19:38.992 shell.go:Pwd() - 0s
[TRACE] 19:19:38.992 shell.go:Shell() - 0s
[TRACE] 19:19:38.992 shell.go:Flags() - 0s
[DEBUG] 19:19:38.992 shell_windows.go:56 → C:\Users\fluen
[TRACE] 19:19:38.992 shell.go:GOOS() - 0s
[TRACE] 19:19:38.992 shell.go:GOOS() - 0s
[TRACE] 19:19:38.992 shell.go:PathSeparator() - 0s
[TRACE] 19:19:38.992 shell.go:GOOS() - 0s
[TRACE] 19:19:38.992 shell.go:GOOS() - 0s
[TRACE] 19:19:38.992 shell.go:GOOS() - 0s
[TRACE] 19:19:38.992 shell.go:GOOS() - 0s
[TRACE] 19:19:38.992 shell.go:GOOS() - 0s
[TRACE] 19:19:38.992 shell.go:GOOS() - 0s
[TRACE] 19:19:38.992 shell.go:GOOS() - 0s
[TRACE] 19:19:38.992 shell.go:PathSeparator() - 0s
[TRACE] 19:19:38.992 shell.go:PathSeparator() - 0s
[TRACE] 19:19:38.992 shell.go:GOOS() - 0s
[TRACE] 19:19:38.992 shell.go:GOOS() - 0s
[TRACE] 19:19:38.992 shell.go:GOOS() - 0s
[TRACE] 19:19:38.992 shell.go:PathSeparator() - 0s
[TRACE] 19:19:38.992 shell.go:GOOS() - 0s
[TRACE] 19:19:38.992 shell.go:GOOS() - 0s
[TRACE] 19:19:38.992 shell.go:GOOS() - 0s
[TRACE] 19:19:38.992 shell.go:PathSeparator() - 0s
[TRACE] 19:19:38.992 shell.go:GOOS() - 0s
[TRACE] 19:19:38.992 shell.go:GOOS() - 0s
[TRACE] 19:19:38.992 shell.go:GOOS() - 0s
[TRACE] 19:19:38.992 shell.go:PathSeparator() - 0s
[DEBUG] 19:19:38.992 shell.go:Pwd:385 → C:\Users\fluen
[TRACE] 19:19:38.992 shell.go:Pwd() - 0s
[TRACE] 19:19:38.992 shell_windows.go:IsWsl() - 0s
[TRACE] 19:19:38.992 shell.go:StackCount() - 0s
[DEBUG] 19:19:38.992 win32_windows.go:isWriteable:299 → not current user or in group
[DEBUG] 19:19:38.992 win32_windows.go:isWriteable:303 → current user is member of S-1-5-32-544
[DEBUG] 19:19:38.992 win32_windows.go:isWriteable:311 ↓
    WRITE_DAC
    WRITE_OWNER
    SYNCHRONIZE
    DELETE
    READ_CONTROL
[DEBUG] 19:19:38.992 win32_windows.go:isWriteable:313 → user has write access
[TRACE] 19:19:38.992 shell_windows.go:DirIsWritable() - 0s
[TRACE] 19:19:38.992 shell.go:TemplateCache() - 0s
[TRACE] 19:19:38.992 shell.go:TemplateCache() - 0s
[TRACE] 19:19:38.992 shell.go:Shell() - 0s
[DEBUG] 19:19:38.992 shell.go:Pwd:385 → C:\Users\fluen
[TRACE] 19:19:38.992 shell.go:Pwd() - 0s
[DEBUG] 19:19:38.992 shell_windows.go:56 → C:\Users\fluen
[TRACE] 19:19:38.992 shell.go:GOOS() - 0s
[TRACE] 19:19:38.992 shell.go:GOOS() - 0s
[DEBUG] 19:19:39.021 shell.go:CommandPath:577 → C:\Program Files\Git\cmd\git.exe
[TRACE] 19:19:39.021 shell.go:CommandPath(git.exe) - 29.8953ms
[TRACE] 19:19:39.021 shell.go:HasCommand(git.exe) - 29.8953ms
[DEBUG] 19:19:39.021 shell.go:Pwd:385 → C:\Users\fluen
[TRACE] 19:19:39.021 shell.go:Pwd() - 0s
[ERROR] 19:19:39.029 shell.go:HasParentFilePath:710 → CreateFile C:\.git: The system cannot find the file specified.
[TRACE] 19:19:39.029 shell.go:HasParentFilePath(.git) - 7.0284ms
[DEBUG] 19:19:39.029 shell.go:Pwd:385 → C:\Users\fluen
[TRACE] 19:19:39.029 shell.go:Pwd() - 0s
[DEBUG] 19:19:39.029 shell_windows.go:56 → C:\Users\fluen
[TRACE] 19:19:39.029 shell.go:GOOS() - 0s
[DEBUG] 19:19:39.029 shell.go:Pwd:385 → C:\Users\fluen
[TRACE] 19:19:39.029 shell.go:Pwd() - 0s
[DEBUG] 19:19:39.029 shell_windows.go:56 → C:\Users\fluen
[DEBUG] 19:19:39.029 shell.go:Pwd:385 → C:\Users\fluen
[TRACE] 19:19:39.029 shell.go:Pwd() - 0s
[DEBUG] 19:19:39.029 shell_windows.go:56 → C:\Users\fluen
[TRACE] 19:19:39.029 shell.go:GOOS() - 0s
[DEBUG] 19:19:39.029 shell.go:Pwd:385 → C:\Users\fluen
[TRACE] 19:19:39.029 shell.go:Pwd() - 0s
[DEBUG] 19:19:39.029 shell_windows.go:56 → C:\Users\fluen
[DEBUG] 19:19:39.029 shell.go:Pwd:385 → C:\Users\fluen
[TRACE] 19:19:39.029 shell.go:Pwd() - 0s
[DEBUG] 19:19:39.029 shell_windows.go:56 → C:\Users\fluen
[TRACE] 19:19:39.029 shell.go:GOOS() - 0s
[DEBUG] 19:19:39.029 shell.go:Pwd:385 → C:\Users\fluen
[TRACE] 19:19:39.029 shell.go:Pwd() - 0s
[DEBUG] 19:19:39.029 shell_windows.go:56 → C:\Users\fluen
[DEBUG] 19:19:39.029 shell.go:Pwd:385 → C:\Users\fluen
[TRACE] 19:19:39.029 shell.go:Pwd() - 565.3µs
[DEBUG] 19:19:39.029 shell_windows.go:56 → C:\Users\fluen
[TRACE] 19:19:39.029 shell.go:GOOS() - 0s
[TRACE] 19:19:39.029 shell_windows.go:Root() - 63.3µs
[TRACE] 19:19:39.029 shell.go:TemplateCache() - 0s
[TRACE] 19:19:39.029 shell.go:Shell() - 0s
[DEBUG] 19:19:39.029 shell.go:Pwd:385 → C:\Users\fluen
[TRACE] 19:19:39.029 shell.go:Pwd() - 0s
[DEBUG] 19:19:39.029 shell_windows.go:56 → C:\Users\fluen
[TRACE] 19:19:39.029 shell.go:GOOS() - 0s
[TRACE] 19:19:39.029 shell.go:ErrorCode() - 0s
[TRACE] 19:19:39.029 shell.go:TemplateCache() - 0s
[TRACE] 19:19:39.033 shell.go:TemplateCache() - 0s
[TRACE] 19:19:39.033 shell.go:Shell() - 0s
[DEBUG] 19:19:39.033 shell.go:Pwd:385 → C:\Users\fluen
[TRACE] 19:19:39.033 shell.go:Pwd() - 0s
[DEBUG] 19:19:39.033 shell_windows.go:56 → C:\Users\fluen
[TRACE] 19:19:39.033 shell.go:GOOS() - 0s
[TRACE] 19:19:39.033 shell.go:ExecutionTime() - 0s
[TRACE] 19:19:39.033 shell.go:TemplateCache() - 0s
[TRACE] 19:19:39.033 shell.go:TemplateCache() - 0s
[TRACE] 19:19:39.033 shell.go:Shell() - 0s
[DEBUG] 19:19:39.034 shell.go:Getenv:377 → C:\Users\fluen\AppData\Local
[TRACE] 19:19:39.034 shell.go:Getenv(LOCALAPPDATA) - 0s
[TRACE] 19:19:39.035 shell_windows.go:CachePath() - 626.5µs
[TRACE] 19:19:39.035 shell.go:Flags() - 0s
JanDeDobbeleer commented 1 year ago

@fluentmoheshwar this is still a Terminal bug, so if the workaround doesn't fix it, change the icon.

fluentmoheshwar commented 1 year ago

@fluentmoheshwar this is still a Terminal bug, so if the workaround doesn't fix it, change the icon.

Or probably change terminal? I see many default themes use that heart but they don't have the issue. is my code alright?

JanDeDobbeleer commented 1 year ago

@fluentmoheshwar nothing wrong on your end!

github-actions[bot] commented 10 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.