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

Directory name is not printed (path segment with powerlevel style and mapped_locations) #4162

Closed michalzielanski closed 1 year ago

michalzielanski commented 1 year ago

Code of Conduct

What happened?

The directory name is not printed when it is immediately after the mapped location.

Expected result: ⌂ > Application % pwd /Users/michal/Applications

Current result: ⌂ % pwd /Users/michal/Applications

Theme

{
  "$schema": "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json",
  "version": 2,
  "final_space": true,
  "shell_integration": true,
  "blocks": [
    {
      "type": "prompt",
      "alignment": "left",
      "segments": [
        {
          "type": "path",
          "style": "plain",
          "template": "{{ .Path }} %",
          "properties": {
            "style": "powerlevel",
            "max_width": "70",
            "folder_icon": "\uea7c",
            "folder_separator_icon": " \uf105 ",
            "mapped_locations": {
              "~": "\uf015"
            }
          }
        }
      ]
    }
  ]
}

What OS are you seeing the problem on?

macOS

Which shell are you using?

zsh

Log output

Version: 18.3.3

Shell: zsh (5.8.1)

Prompt:

 %%

Segments:

ConsoleTitle(false)                       -   0 ms
Path(true)                                -   0 ms

Run duration: 2.502709ms

Cache path: /Users/michal/.cache/oh-my-posh

Config path: /Users/michal/.zsh_extensions/test.omp.json

Logs:

[DEBUG] 10:51:58.446 shell.go:Getenv:389 → iTerm.app
[TRACE] 10:51:58.446 shell.go:Getenv(TERM_PROGRAM) - 37.217µs
[DEBUG] 10:51:58.446 shell.go:Getenv:389 → NO DATA
[TRACE] 10:51:58.446 shell.go:Getenv(XDG_CACHE_HOME) - 3.15µs
[TRACE] 10:51:58.446 shell_unix.go:CachePath() - 30.658µs
[DEBUG] 10:51:58.446 shell.go:Getenv:389 → /Users/michal/.zsh_extensions/test.omp.json
[TRACE] 10:51:58.446 shell.go:Getenv(POSH_THEME) - 6.986µs
[DEBUG] 10:51:58.446 shell_unix.go:Platform:77 → darwin
[TRACE] 10:51:58.446 shell.go:resolveConfigPath() - 18.024µs
[TRACE] 10:51:58.446 shell.go:Init() - 731.099µs
[TRACE] 10:51:58.446 shell.go:Flags() - 75ns
[TRACE] 10:51:58.447 config.go:loadConfig() - 299.186µs
[TRACE] 10:51:58.447 shell.go:Flags() - 94ns
[DEBUG] 10:51:58.447 shell.go:Shell:629 → no shell name provided in flags, trying to detect it
[DEBUG] 10:51:58.447 shell.go:Shell:637 → process name: zsh
[TRACE] 10:51:58.447 shell.go:Shell() - 106.696µs
[DEBUG] 10:51:58.447 shell.go:Getenv:389 → NO DATA
[TRACE] 10:51:58.447 shell.go:Getenv(OMP_CACHE_DISABLED) - 2.732µs
[TRACE] 10:51:58.447 shell.go:Shell() - 110ns
[DEBUG] 10:51:58.447 shell.go:Getenv:389 → 5.8.1
[TRACE] 10:51:58.447 shell.go:Getenv(POSH_SHELL_VERSION) - 3.071µs
[DEBUG] 10:51:58.447 debug.go:PrintDebug:22 → Segment: Title
[TRACE] 10:51:58.447 shell.go:StatusCodes() - 78ns
[TRACE] 10:51:58.447 shell.go:Flags() - 45ns
[DEBUG] 10:51:58.447 shell.go:Getenv:389 → NO DATA
[TRACE] 10:51:58.447 shell.go:Getenv(POSH_CURSOR_LINE) - 2.54µs
[DEBUG] 10:51:58.447 shell.go:Getenv:389 → NO DATA
[TRACE] 10:51:58.447 shell.go:Getenv(POSH_CURSOR_COLUMN) - 2.069µs
[TRACE] 10:51:58.447 shell.go:Flags() - 53ns
[TRACE] 10:51:58.447 shell.go:Flags() - 51ns
[TRACE] 10:51:58.447 shell.go:Shell() - 49ns
[TRACE] 10:51:58.447 shell.go:Flags() - 103ns
[TRACE] 10:51:58.447 shell.go:GOOS() - 118ns
[DEBUG] 10:51:58.447 shell.go:Pwd:419 → /Users/michal/Applications
[TRACE] 10:51:58.447 shell.go:Pwd() - 28.865µs
[TRACE] 10:51:58.447 shell.go:GOOS() - 50ns
[DEBUG] 10:51:58.447 segment.go:SetEnabled:494 → Segment: Path
[TRACE] 10:51:58.447 shell.go:Pwd() - 142ns
[TRACE] 10:51:58.447 shell.go:Shell() - 113ns
[TRACE] 10:51:58.447 shell.go:Shell() - 47ns
[DEBUG] 10:51:58.447 properties.go:GetBool:22 → mapped_locations_enabled: true
[DEBUG] 10:51:58.447 properties.go:GetString:28 → 
[DEBUG] 10:51:58.447 properties.go:GetString:28 → 
[TRACE] 10:51:58.447 shell.go:GOOS() - 56ns
[DEBUG] 10:51:58.447 properties.go:GetString:28 → ~
[DEBUG] 10:51:58.447 properties.go:GetKeyValueMap:46 → mapped_locations: map[~:]
[TRACE] 10:51:58.447 shell.go:GOOS() - 45ns
[TRACE] 10:51:58.447 shell.go:PathSeparator() - 76ns
[TRACE] 10:51:58.447 shell.go:GOOS() - 48ns
[TRACE] 10:51:58.447 shell.go:GOOS() - 72ns
[TRACE] 10:51:58.447 shell.go:GOOS() - 54ns
[TRACE] 10:51:58.447 shell.go:GOOS() - 52ns
[TRACE] 10:51:58.447 shell.go:PathSeparator() - 54ns
[TRACE] 10:51:58.447 shell.go:PathSeparator() - 55ns
[TRACE] 10:51:58.447 shell.go:GOOS() - 72ns
[TRACE] 10:51:58.447 shell.go:GOOS() - 54ns
[TRACE] 10:51:58.447 shell.go:PathSeparator() - 49ns
[TRACE] 10:51:58.447 shell.go:GOOS() - 48ns
[TRACE] 10:51:58.447 shell.go:GOOS() - 54ns
[TRACE] 10:51:58.447 shell.go:PathSeparator() - 47ns
[TRACE] 10:51:58.447 shell.go:GOOS() - 55ns
[TRACE] 10:51:58.447 shell.go:GOOS() - 48ns
[TRACE] 10:51:58.447 shell.go:PathSeparator() - 52ns
[TRACE] 10:51:58.447 shell.go:PathSeparator() - 48ns
[DEBUG] 10:51:58.447 properties.go:GetString:28 → powerlevel
[DEBUG] 10:51:58.447 properties.go:GetFloat64:34 → max_width: 0.000000
[DEBUG] 10:51:58.447 properties.go:GetString:28 → NO DATA
[TRACE] 10:51:58.447 shell.go:PathSeparator() - 47ns
[DEBUG] 10:51:58.447 properties.go:GetString:28 →  
[TRACE] 10:51:58.447 shell.go:PathSeparator() - 45ns
[TRACE] 10:51:58.447 shell.go:PathSeparator() - 51ns
[DEBUG] 10:51:58.447 properties.go:GetStringArray:52 → cycle: []
[DEBUG] 10:51:58.447 properties.go:GetString:28 → NO DATA
[TRACE] 10:51:58.447 shell.go:PathSeparator() - 67ns
[DEBUG] 10:51:58.447 properties.go:GetString:28 →  
[DEBUG] 10:51:58.447 properties.go:GetBool:22 → cycle_folder_separator: false
[DEBUG] 10:51:58.447 properties.go:GetString:28 → %s
[DEBUG] 10:51:58.447 properties.go:GetString:28 → %s
[TRACE] 10:51:58.447 shell.go:Pwd() - 123ns
[DEBUG] 10:51:58.447 shell_unix.go:IsWsl:35 → false
[TRACE] 10:51:58.447 shell_unix.go:IsWsl() - 5.522µs
[TRACE] 10:51:58.447 shell.go:StackCount() - 138ns
[TRACE] 10:51:58.447 shell_unix.go:DirIsWritable(/Users/michal/Applications) - 16.569µs
[TRACE] 10:51:58.447 shell_unix.go:Root() - 985ns
[TRACE] 10:51:58.447 shell.go:Shell() - 73ns
[TRACE] 10:51:58.447 shell.go:StatusCodes() - 67ns
[DEBUG] 10:51:58.447 shell_unix.go:IsWsl:35 → false
[TRACE] 10:51:58.447 shell_unix.go:IsWsl() - 3.084µs
[DEBUG] 10:51:58.447 shell.go:TemplateCache:810 → environment: [TERM_SESSION_ID=w0t1p0:87542A6F-936E-466E-80E5-AE57916DE2B1 SSH_AUTH_SOCK=/private/tmp/com.apple.launchd.G9QDyDxwUw/Listeners LC_TERMINAL_VERSION=3.4.20 COLORFGBG=15;0 ITERM_PROFILE=Default XPC_FLAGS=0x0 LANG=pl_PL.UTF-8 PWD=/Users/michal/Applications SHELL=/bin/zsh __CFBundleIdentifier=com.googlecode.iterm2 TERM_PROGRAM_VERSION=3.4.20 TERM_PROGRAM=iTerm.app PATH=/usr/local/var/rbenv/shims:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin LC_TERMINAL=iTerm2 COLORTERM=truecolor COMMAND_MODE=unix2003 TERM=xterm-256color HOME=/Users/michal TMPDIR=/var/folders/f1/c6lcgk1d5wqgy739tbvyp5t80000gn/T/ USER=michal XPC_SERVICE_NAME=0 LOGNAME=michal ITERM_SESSION_ID=w0t1p0:87542A6F-936E-466E-80E5-AE57916DE2B1 __CF_USER_TEXT_ENCODING=0x1F5:0x1D:0x2A SHLVL=1 OLDPWD=/Users/michal LS_COLORS= GREP_OPTIONS=--color=auto GREP_COLOR=00;35 EDITOR=vim ITERM2_SQUELCH_MARK=1 POSH_THEME=/Users/michal/.zsh_extensions/test.omp.json POSH_SHELL_VERSION=5.8.1 POSH_PID=3640 POWERLINE_COMMAND=oh-my-posh CONDA_PROMPT_MODIFIER=false POSH_PROMPT_COUNT=21 VIRTUAL_ENV_DISABLE_PROMPT=1 HISTFILE= export= _=/usr/local/bin/oh-my-posh]
[TRACE] 10:51:58.447 shell.go:Pwd() - 97ns
[TRACE] 10:51:58.447 shell.go:GOOS() - 76ns
[TRACE] 10:51:58.447 shell.go:GOOS() - 51ns
[TRACE] 10:51:58.447 shell.go:GOOS() - 46ns
[TRACE] 10:51:58.447 shell.go:GOOS() - 52ns
[TRACE] 10:51:58.447 shell.go:GOOS() - 46ns
[TRACE] 10:51:58.447 shell.go:GOOS() - 51ns
[TRACE] 10:51:58.447 shell.go:GOOS() - 65ns
[TRACE] 10:51:58.447 shell.go:GOOS() - 46ns
[TRACE] 10:51:58.447 shell.go:GOOS() - 47ns
[TRACE] 10:51:58.447 shell.go:GOOS() - 45ns
[TRACE] 10:51:58.447 shell.go:GOOS() - 47ns
[TRACE] 10:51:58.447 shell.go:GOOS() - 70ns
[TRACE] 10:51:58.447 shell.go:GOOS() - 47ns
[TRACE] 10:51:58.447 shell.go:GOOS() - 46ns
[DEBUG] 10:51:58.447 shell.go:User:540 → michal
[TRACE] 10:51:58.447 shell.go:User() - 3.01µs
[DEBUG] 10:51:58.447 shell.go:Host:552 → mbp-intel.comp.home
[TRACE] 10:51:58.447 shell.go:Host() - 28.02µs
[TRACE] 10:51:58.447 shell.go:GOOS() - 58ns
[DEBUG] 10:51:58.447 shell.go:Getenv:389 → 1
[TRACE] 10:51:58.447 shell.go:Getenv(SHLVL) - 3.076µs
[TRACE] 10:51:58.447 shell.go:TemplateCache() - 153.398µs
[TRACE] 10:51:58.448 shell.go:TemplateCache() - 705ns
[TRACE] 10:51:58.448 shell.go:Shell() - 202ns
[TRACE] 10:51:58.448 shell.go:Shell() - 120ns
[TRACE] 10:51:58.448 shell.go:Shell() - 49ns
[TRACE] 10:51:58.448 shell.go:Shell() - 48ns
[TRACE] 10:51:58.448 shell.go:Shell() - 58ns
[TRACE] 10:51:58.448 shell.go:Flags() - 81ns
[DEBUG] 10:51:58.448 shell.go:Getenv:389 → NO DATA
[TRACE] 10:51:58.448 shell.go:Getenv(XDG_CACHE_HOME) - 4.17µs
[TRACE] 10:51:58.448 shell_unix.go:CachePath() - 34.037µs
[TRACE] 10:51:58.448 shell.go:Flags() - 55ns
JanDeDobbeleer commented 1 year ago

@michalzielanski I'll have a look once I'm back from my holidays. I think you can mitigate the issue by setting the home_icon property in the meantime.

michalzielanski commented 1 year ago

@JanDeDobbeleer there is no rush. Happy Holidays. I don't actually map the ~ location. I set it so only in the example so that it is easy to repeat the issue.

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