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

The width of the theme icon is displayed abnormally #2275

Closed SamotoKuen closed 2 years ago

SamotoKuen commented 2 years ago

Code of Conduct

What happened?

The width of the icon is fixed and the excess is hidden ,The width is not adaptive.Tried several fonts and themes (jandedobbeleer,amro,cert etc)don't work

Version

  1. powershell: 7.2.3
  2. oh-my-posh: 7.8.5.0
  3. windows10:21H2

font

  1. MesloLGL NF
  2. JetBrainsMono NF
{
  "$schema": "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json",
  "blocks": [
    {
      "alignment": "left",
      "segments": [
        {
          "background": "#003543",
          "foreground": "#00c983",
          "leading_diamond": "\ue0b6",
          "style": "diamond",
          "template": "{{ .Icon }} {{ .HostName }} ",
          "type": "os"
        },
        {
          "background": "#DA627D",
          "foreground": "#ffffff",
          "powerline_symbol": "\ue0b0",
          "properties": {
            "folder_icon": "\uf115",
            "folder_separator_icon": "\\",
            "home_icon": "\uf7db",
            "style": "full"
          },
          "style": "powerline",
          "template": " <#000>\uf07b \uf553</> {{ .Path }} ",
          "type": "path"
        },
        {
          "background": "#FCA17D",
          "foreground": "#ffffff",
          "powerline_symbol": "\ue0b0",
          "properties": {
            "branch_icon": " <#ffffff>\ue0a0 </>",
            "fetch_stash_count": true,
            "fetch_status": false,
            "fetch_upstream_icon": true
          },
          "style": "powerline",
          "template": " \u279c ({{ .UpstreamIcon }}{{ .HEAD }}{{ if gt .StashCount 0 }} \uf692 {{ .StashCount }}{{ end }}) ",
          "type": "git"
        },
        {
          "background": "#76b367",
          "foreground": "#ffffff",
          "powerline_symbol": "\ue0b0",
          "style": "powerline",
          "template": " \ue718 {{ if .PackageManagerIcon }}{{ .PackageManagerIcon }} {{ end }}{{ .Full }} ",
          "type": "node"
        },
        {
          "background": "#83769c",
          "foreground": "#ffffff",
          "powerline_symbol": "\ue0b0",
          "properties": {
            "always_enabled": true
          },
          "style": "powerline",
          "template": " \ufbab {{ .FormattedMs }} ",
          "type": "executiontime"
        },
        {
          "background": "#33658A",
          "foreground": "#ffffff",
          "powerline_symbol": "\ue0b0",
          "properties": {
            "time_format": "3:04 PM"
          },
          "style": "powerline",
          "template": " \uf017 {{ .CurrentDate | date .Format }} ",
          "type": "time"
        },
        {
          "background": "#2e9599",
          "background_templates": [
            "{{ if gt .Code 0 }}red{{ end }}"
          ],
          "foreground": "#ffffff",
          "powerline_symbol": "\ue0b0",
          "properties": {
            "always_enabled": true
          },
          "style": "diamond",
          "template": " {{ if gt .Code 0 }}\uf525{{ else }}\uf469{{ end }}",
          "trailing_diamond": "\ue0b4",
          "type": "exit"
        }
      ],
      "type": "prompt"
    },
    {
      "alignment": "left",
      "newline": true,
      "segments": [
        {
          "foreground": "#cd5e42",
          "style": "plain",
          "template": "\ue3bf ",
          "type": "root"
        },
        {
          "foreground": "#CD4277",
          "style": "plain",
          "template": " <#45F1C2><b>\u26a1</b></><b>{{ .UserName }}</b> <#26C6DA>\u276f</><#45F1C2>\u276f</>",
          "type": "text"
        }
      ],
      "type": "prompt"
    }
  ],
  "final_space": true,
  "version": 2
}

Theme

montys

What OS are you seeing the problem on?

Windows

Which shell are you using?

powershell

Log output

Logs:

2022/05/16 17:06:40 debug: Getenv
C:\Users\dio\AppData\Local
2022/05/16 17:06:40 Getenv duration: 505.2µs, args: LOCALAPPDATA
2022/05/16 17:06:40 CachePath duration: 524.5µs, args:
2022/05/16 17:06:40 debug: Getenv
C:\Users\dio\.posh_themes\montys.omp.json
2022/05/16 17:06:40 Getenv duration: 0s, args: POSH_THEME
2022/05/16 17:06:40 Shell duration: 7.3983ms, args:
2022/05/16 17:06:40 resolveConfigPath duration: 7.3983ms, args:
2022/05/16 17:06:40 Init duration: 7.9228ms, args:
2022/05/16 17:06:40 Flags duration: 0s, args:
2022/05/16 17:06:40 config.loadConfig duration: 526µs, args:
2022/05/16 17:06:40 Flags duration: 0s, args:
2022/05/16 17:06:40 debug: Getenv

2022/05/16 17:06:40 Getenv duration: 0s, args: OMP_CACHE_DISABLED
2022/05/16 17:06:40 Root duration: 0s, args:
2022/05/16 17:06:40 Shell duration: 0s, args:
2022/05/16 17:06:40 ErrorCode duration: 0s, args:
2022/05/16 17:06:40 IsWsl duration: 0s, args:
2022/05/16 17:06:40 debug: Pwd
C:\Users\dio
2022/05/16 17:06:40 Pwd duration: 0s, args:
2022/05/16 17:06:40 debug: Home
C:\Users\dio
2022/05/16 17:06:40 PathSeparator duration: 0s, args:
2022/05/16 17:06:40 PathSeparator duration: 0s, args:
2022/05/16 17:06:40 debug: User
dio
2022/05/16 17:06:40 User duration: 0s, args:
2022/05/16 17:06:40 debug: Host
DESKTOP-FPR50OU
2022/05/16 17:06:40 Host duration: 0s, args:
2022/05/16 17:06:40 GOOS duration: 0s, args:
2022/05/16 17:06:40 TemplateCache duration: 0s, args:
2022/05/16 17:06:40 Flags duration: 0s, args:
2022/05/16 17:06:40 debug: Pwd
C:\Users\dio
2022/05/16 17:06:40 Pwd duration: 0s, args:
2022/05/16 17:06:40 debug: Home
C:\Users\dio
2022/05/16 17:06:40 GOOS duration: 0s, args:
2022/05/16 17:06:40 GOOS duration: 0s, args:
2022/05/16 17:06:40 TemplateCache duration: 0s, args:
2022/05/16 17:06:40 TemplateCache duration: 0s, args:
2022/05/16 17:06:40 Shell duration: 0s, args:
2022/05/16 17:06:40 debug: Pwd
C:\Users\dio
2022/05/16 17:06:40 Pwd duration: 0s, args:
2022/05/16 17:06:40 debug: Home
C:\Users\dio
2022/05/16 17:06:40 GOOS duration: 0s, args:
2022/05/16 17:06:40 debug: Pwd
C:\Users\dio
2022/05/16 17:06:40 Pwd duration: 0s, args:
2022/05/16 17:06:40 Flags duration: 0s, args:
2022/05/16 17:06:40 debug: Pwd
C:\Users\dio
2022/05/16 17:06:40 Pwd duration: 0s, args:
2022/05/16 17:06:40 debug: Home
C:\Users\dio
2022/05/16 17:06:40 GOOS duration: 0s, args:
2022/05/16 17:06:40 GOOS duration: 0s, args:
2022/05/16 17:06:40 PathSeparator duration: 0s, args:
2022/05/16 17:06:40 PathSeparator duration: 0s, args:
2022/05/16 17:06:40 GOOS duration: 0s, args:
2022/05/16 17:06:40 IsWsl duration: 0s, args:
2022/05/16 17:06:40 StackCount duration: 0s, args:
2022/05/16 17:06:40 DirIsWritable duration: 0s, args:
2022/05/16 17:06:40 TemplateCache duration: 0s, args:
2022/05/16 17:06:40 TemplateCache duration: 0s, args:
2022/05/16 17:06:40 Shell duration: 0s, args:
2022/05/16 17:06:40 debug: Pwd
C:\Users\dio
2022/05/16 17:06:40 Pwd duration: 0s, args:
2022/05/16 17:06:40 debug: Home
C:\Users\dio
2022/05/16 17:06:40 GOOS duration: 0s, args:
2022/05/16 17:06:40 GOOS duration: 0s, args:
2022/05/16 17:06:40 HasCommand duration: 3.4708ms, args: git.exe
2022/05/16 17:06:40 debug: Pwd
C:\Users\dio
2022/05/16 17:06:40 Pwd duration: 0s, args:
2022/05/16 17:06:40 error: HasParentFilePath
CreateFile C:\.git: The system cannot find the file specified.
2022/05/16 17:06:40 HasParentFilePath duration: 0s, args: .git
2022/05/16 17:06:40 debug: Pwd
C:\Users\dio
2022/05/16 17:06:40 Pwd duration: 0s, args:
2022/05/16 17:06:40 debug: Home
C:\Users\dio
2022/05/16 17:06:40 GOOS duration: 0s, args:
2022/05/16 17:06:40 debug: Pwd
C:\Users\dio
2022/05/16 17:06:40 Pwd duration: 0s, args:
2022/05/16 17:06:40 debug: Home
C:\Users\dio
2022/05/16 17:06:40 debug: Pwd
C:\Users\dio
2022/05/16 17:06:40 Pwd duration: 0s, args:
2022/05/16 17:06:40 debug: Home
C:\Users\dio
2022/05/16 17:06:40 GOOS duration: 0s, args:
2022/05/16 17:06:40 ExecutionTime duration: 0s, args:
2022/05/16 17:06:40 TemplateCache duration: 0s, args:
2022/05/16 17:06:40 TemplateCache duration: 0s, args:
2022/05/16 17:06:40 Shell duration: 0s, args:
2022/05/16 17:06:40 debug: Pwd
C:\Users\dio
2022/05/16 17:06:40 Pwd duration: 0s, args:
2022/05/16 17:06:40 debug: Home
C:\Users\dio
2022/05/16 17:06:40 GOOS duration: 0s, args:
2022/05/16 17:06:40 TemplateCache duration: 0s, args:
2022/05/16 17:06:40 TemplateCache duration: 0s, args:
2022/05/16 17:06:40 Shell duration: 0s, args:
2022/05/16 17:06:40 debug: Pwd
C:\Users\dio
2022/05/16 17:06:40 Pwd duration: 0s, args:
2022/05/16 17:06:40 debug: Home
C:\Users\dio
2022/05/16 17:06:40 GOOS duration: 0s, args:
2022/05/16 17:06:40 ErrorCode duration: 0s, args:
2022/05/16 17:06:40 TemplateCache duration: 0s, args:
2022/05/16 17:06:40 TemplateCache duration: 0s, args:
2022/05/16 17:06:40 Shell duration: 0s, args:
2022/05/16 17:06:40 TemplateCache duration: 0s, args:
2022/05/16 17:06:40 Flags duration: 0s, args:
2022/05/16 17:06:40 debug: Pwd
C:\Users\dio
2022/05/16 17:06:40 Pwd duration: 0s, args:
2022/05/16 17:06:40 debug: Home
C:\Users\dio
2022/05/16 17:06:40 GOOS duration: 0s, args:
2022/05/16 17:06:40 Root duration: 0s, args:
2022/05/16 17:06:40 debug: Pwd
C:\Users\dio
2022/05/16 17:06:40 Pwd duration: 0s, args:
2022/05/16 17:06:40 debug: Home
C:\Users\dio
2022/05/16 17:06:40 GOOS duration: 0s, args:
2022/05/16 17:06:40 TemplateCache duration: 0s, args:
2022/05/16 17:06:40 TemplateCache duration: 0s, args:
2022/05/16 17:06:40 Shell duration: 0s, args:
2022/05/16 17:06:40 debug: Getenv
C:\Users\dio\AppData\Local
2022/05/16 17:06:40 Getenv duration: 0s, args: LOCALAPPDATA
2022/05/16 17:06:40 CachePath duration: 0s, args:
2022/05/16 17:06:40 Flags duration: 0s, args:
JanDeDobbeleer commented 2 years ago

@SamotoKuen that's a terminal responsibility and thus issue. For example, this is your theme in iTerm2:

image

On Hyper for example, only the battery icon is rendered incorrectly:

image
SamotoKuen commented 2 years ago

@SamotoKuen that's a terminal responsibility and thus issue. For example, this is your theme in iTerm2:

image

On Hyper for example, only the battery icon is rendered incorrectly:

image

So do I need to change terminals to solve this problem?Basically all theme have same problem :(

JanDeDobbeleer commented 2 years ago

@SamotoKuen you can upvote some issues on the Windows Terminal repo to have them address this:

JanDeDobbeleer commented 2 years ago

@SamotoKuen btw, the easiest fix is to add a space in your theme. That will render it correctly in your terminal, but obviously potentially wrong in another one.

SamotoKuen commented 2 years ago

Thanks for anwser! It help me a lot.

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