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

Space Between `executiontime` and `exit` On Less Than 1 Second Runs In `wt.exe` Using jandedobbeleer.omp #1115

Closed mattcargile closed 2 years ago

mattcargile commented 2 years ago

Code of Conduct

What happened?

Within Windows Terminal 1.11.2921.0, there is an unsightly space between executiontime and exit within the jandedobbeleer.omp. This appears to occur on less than one second runtimes.

image

I found it running the below code and from my slightly modified json.

Get-ChildItem -Path "~\AppData\Local\Programs\oh-my-posh\themes\*" -Include '*.omp.json' | Sort-Object Name | ForEach-Object -Process {
    $esc = [char]27
    Write-Host ""
    Write-Host "$esc[1m$($_.BaseName)$esc[0m"
    Write-Host ""
    oh-my-posh --config $($_.FullName) --pwd $PWD
    Write-Host ""
}

An interesting note is that VS Code doesn't reflect this same behavior.

Version

5.14.0

Theme

A modified jandedobbeleer.omp. The default theme has the same "issue".

Here is my version below. I have only added Spotify instead of Youtube to it. Might be other differences from the original theme if there have been changes to this theme since maybe early version 3 of oh-my-posh.exe.

{
  "$schema": "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json",
  "blocks": [
    {
      "alignment": "left",
      "segments": [
        {
          "background": "#c386f1",
          "foreground": "#ffffff",
          "leading_diamond": "",
          "properties": {
            "display_host": false,
            "postfix": " "
          },
          "style": "diamond",
          "trailing_diamond": "",
          "type": "session"
        },
        {
          "background": "#ff479c",
          "foreground": "#ffffff",
          "powerline_symbol": "",
          "properties": {
            "folder_separator_icon": "  ",
            "home_icon": "~",
            "prefix": "   ",
            "style": "folder"
          },
          "style": "powerline",
          "type": "path"
        },
        {
          "background": "#fffb38",
          "foreground": "#193549",
          "powerline_symbol": "",
          "properties": {
            "ahead_and_behind_color": "#f26d50",
            "ahead_color": "#89d1dc",
            "behind_color": "#f17c37",
            "display_stash_count": true,
            "display_upstream_icon": true,
            "local_changes_color": "#ff9248",
            "stash_count_icon": " ",
            "status_colors_enabled": true
          },
          "style": "powerline",
          "type": "git"
        },
        {
          "background": "#6CA35E",
          "foreground": "#ffffff",
          "powerline_symbol": "",
          "properties": {
            "display_version": true,
            "prefix": "  "
          },
          "style": "powerline",
          "type": "node"
        },
        {
          "background": "#8ED1F7",
          "foreground": "#111111",
          "powerline_symbol": "",
          "properties": {
            "display_version": true,
            "prefix": "  "
          },
          "style": "powerline",
          "type": "go"
        },
        {
          "background": "#4063D8",
          "foreground": "#111111",
          "powerline_symbol": "",
          "properties": {
            "display_version": true,
            "prefix": "  "
          },
          "style": "powerline",
          "type": "julia"
        },
        {
          "background": "#FFDE57",
          "foreground": "#111111",
          "powerline_symbol": "",
          "properties": {
            "display_mode": "files",
            "display_version": true,
            "display_virtual_env": false,
            "prefix": "  "
          },
          "style": "powerline",
          "type": "python"
        },
        {
          "background": "#AE1401",
          "foreground": "#ffffff",
          "powerline_symbol": "",
          "properties": {
            "display_mode": "files",
            "display_version": true,
            "prefix": "  "
          },
          "style": "powerline",
          "type": "ruby"
        },
        {
          "background": "#FEAC19",
          "foreground": "#ffffff",
          "powerline_symbol": "",
          "properties": {
            "display_mode": "files",
            "display_version": false,
            "prefix": " "
          },
          "style": "powerline",
          "type": "azfunc"
        },
        {
          "background_templates": [
            "{{if contains \"default\" .Profile}}#FFA400{{end}}",
            "{{if contains \"jan\" .Profile}}#f1184c{{end}}"
          ],
          "foreground": "#ffffff",
          "powerline_symbol": "",
          "properties": {
            "display_default": false,
            "prefix": "  "
          },
          "style": "powerline",
          "type": "aws"
        },
        {
          "background": "#ffff66",
          "foreground": "#111111",
          "powerline_symbol": "",
          "properties": {
            "root_icon": ""
          },
          "style": "powerline",
          "type": "root"
        },
        {
          "background": "#83769c",
          "foreground": "#ffffff",
          "leading_diamond": "",
          "properties": {
            "always_enabled": true,
            "prefix": "<transparent></> 羽"
          },
          "style": "plain",
          "trailing_diamond": "",
          "type": "executiontime"
        },
        {
          "background": "#2e9599",
          "foreground": "#ffffff",
          "leading_diamond": "",
          "properties": {
            "always_enabled": true,
            "color_background": true,
            "display_exit_code": false,
            "error_color": "#f1184c",
            "prefix": "<#83769c></> "
          },
          "style": "diamond",
          "trailing_diamond": "",
          "type": "exit"
        }
      ],
      "type": "prompt"
    },
    {
      "segments": [
        {
          "background": "#0077c2",
          "foreground": "#ffffff",
          "properties": {
            "postfix": " <transparent,#0077c2></>",
            "prefix": "<#0077c2,transparent></>  "
          },
          "style": "plain",
          "type": "shell"
        },
        {
          "background": "#1BD760",
          "foreground": "#111111",
          "invert_powerline": true,
          "powerline_symbol": "",
          "properties": {
            "paused_icon": " ",
            "playing_icon": " ",
            "stopped_icon": "",
            "track_separator": " - ",
            "prefix": "阮 "
          },
          "style": "powerline",
          "type": "spotify"
        },
        {
          "background": "#f36943",
          "foreground": "#ffffff",
          "invert_powerline": true,
          "powerline_symbol": "",
          "properties": {
            "battery_icon": "",
            "charged_color": "#4caf50",
            "charged_icon": " ",
            "charging_color": "#40c4ff",
            "charging_icon": " ",
            "color_background": true,
            "discharging_color": "#ff5722",
            "discharging_icon": " ",
            "postfix": " "
          },
          "style": "powerline",
          "type": "battery"
        },
        {
          "background": "#2e9599",
          "foreground": "#111111",
          "invert_powerline": true,
          "leading_diamond": "",
          "style": "diamond",
          "trailing_diamond": "",
          "type": "time"
        }
      ],
      "type": "rprompt"
    }
  ],
  "console_title": true,
  "console_title_style": "template",
  "console_title_template": "{{ .Shell }} in {{ .Folder }}",
  "final_space": true
}

What OS are you seeing the problem on?

Windows

Which shell are you using?

powershell

Relevant log output

N/A
lnu commented 2 years ago

it's related to this property: "prefix": "<transparent></> \ufa1e".
If the \ufa1e font is removed, the problem disappears. The issue does not happen with iTerm2 on macos for example.
It's an issue related to unicode font space with windows terminal which is open since months(if I remember well).
see https://github.com/JanDeDobbeleer/oh-my-posh/discussions/668

mattcargile commented 2 years ago

Oops! I should have done more searching of open issues! Not sure how to handle this one now.

EDIT: Oh I see it is a Discussion. I'll have to remember to search there. Can the "postfix" fix be added to the default jandedobbeller.omp.json? Or would it be more ideal on a per user basis fix?

mattcargile commented 2 years ago

I followed the Answer in the previously mentioned Discussion and I couldn't get it to work. I modified this json block. I added "postfix"

        {
          "background": "#83769c",
          "foreground": "#ffffff",
          "leading_diamond": "",
          "properties": {
            "always_enabled": true,
            "prefix": "<transparent></> 羽",
            "postfix": "\u2800"
          },
          "style": "plain",
          "trailing_diamond": "",
          "type": "executiontime"
        }
JanDeDobbeleer commented 2 years ago

@mattcargile changing the icon can also help, but in this case the spaces in between the prefix might also be causing the issue. Let's continue the conversation as a Q&A as this isn't an issue with oh-my-posh.