JanDeDobbeleer / oh-my-posh

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

Wrong line length calculation #4296

Closed krtko1 closed 11 months ago

krtko1 commented 11 months ago

Code of Conduct

What happened?

When I use emojis im my config on right side, then line overflow to next line.

Theme

{ "$schema": "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json", "blocks": [ { "alignment": "left", "segments": [ { "type": "text", "style": "diamond", "leading_diamond": "\ue0b6", "foreground": "#ffffff", "background": "#cc3802", "template": "{{ if .Env.PNPPSHOST }} \uf8c5 {{ .Env.PNPPSHOST }} {{ end }}" }, { "type": "text", "style": "powerline", "foreground": "#ffffff", "background": "#047e84", "powerline_symbol": "\ue0b0", "template": "{{ if .Env.PNPPSSITE }} \uf2dd {{ .Env.PNPPSSITE }}{{ end }}" }, { "type": "text", "style": "diamond", "trailing_diamond": "\ue0b4", "foreground": "#ffffff", "background": "#047e84", "template": "{{ if .Env.PNPPSSITE }}\u00A0{{ end }}" }, { "type": "owm", "style": "plain", "foreground": "#ffffff", "template": "{{ if eq .Weather \"\ue32b\"}}šŸŒ™{{else if eq .Weather \"\ue30d\"}}šŸŒž{{else if eq .Weather \"\ue37e\"}}ā›…{{else if eq .Weather \"\ue302\"}}šŸŒ¤{{else if eq .Weather \"\ue33d\"}}ā˜ļø{{else if eq .Weather \"\ue312\"}}šŸ’­ā˜ļø{{else if eq .Weather \"\ue319\"}}šŸŒ§{{else if eq .Weather \"\ue325\"}}šŸŒ™šŸŒ§{{else if eq .Weather \"\ue308\"}}šŸŒ¦{{else if eq .Weather \"\ue32a\"}}šŸŒ™ā›ˆ{{else if eq .Weather \"\ue30f\"}}ā›ˆ{{else if eq .Weather \"\ue31a\"}}šŸŒØ{{else if eq .Weather \"\ue313\"}}šŸŒ«{{end}} ({{.Temperature}}{{.UnitIcon}}) ", "properties": {... } }, { "foreground": "#ffffff", "properties": { "time_format": "Mon 2 Jan 15:04" }, "style": "diamond", "template": "{{ .CurrentDate | date .Format }}", "type": "time" }, { "type": "os", "style": "plain", "foreground": "#26C6DA", "template": " {{.Icon}}" } ], "type": "rprompt" }, { "alignment": "left", "segments": [ { "background": "#9A348E", "foreground": "#ffffff", "leading_diamond": "\ue0b6", "style": "diamond", "template": "{{ .UserName }} ", "type": "session" }, { "background": "#DA627D", "foreground": "#ffffff", "powerline_symbol": "\ue0b0", "properties": { "style": "folder" }, "style": "powerline", "template": " {{ .Path }} ", "type": "path" }, { "background": "#FCA17D", "foreground": "#ffffff", "powerline_symbol": "\ue0b0", "properties": { "branch_icon": "", "fetch_stash_count": true, "fetch_status": false, "fetch_upstream_icon": true }, "style": "powerline", "template": " \u279c ({{ .UpstreamIcon }}{{ .HEAD }}{{ if gt .StashCount 0 }} \ueb4b {{ .StashCount }}{{ end }}) ", "type": "git" }, { "background": "#86BBD8", "foreground": "#ffffff", "powerline_symbol": "\ue0b0", "style": "powerline", "template": " \ue718 {{ if .PackageManagerIcon }}{{ .PackageManagerIcon }} {{ end }}{{ .Full }} ", "type": "node" }, { "type": "exit", "style": "diamond", "foreground": "#ffffff", "background": "#00897b", "background_templates": [ "{{ if gt .Code 0 }}#e91e63{{ end }}" ], "trailing_diamond": "ī‚“", "template": " {{ if gt .Code 0 }}\uf00d {{ .Meaning }}{{ else }}\uf42e{{ end }}", "properties": { "always_enabled": true } } ], "type": "prompt" } ], "final_space": true, "version": 2 }

What OS are you seeing the problem on?

Linux

Which shell are you using?

nu

Log output

Version: 18.10.2

Shell: nu (0.85.0)

Prompt:

ī‚¶krtko ī‚° ~ ī‚° ļ®ī‚“ 

Segments:

ConsoleTitle(false)                       -   0 ms
Text(false)                               -   0 ms
Text(false)                               -   0 ms
Text(false)                               -   0 ms
Owm(false)                                -   0 ms
Time(false)                               -   0 ms
Os(false)                                 -   0 ms
Session(true)                             -   0 ms
Path(true)                                -   0 ms
Git(false)                                -   0 ms
Node(false)                               -   0 ms
Exit(true)                                -   0 ms

Run duration: 5.764273ms

Cache path: /home/krtko/.cache/oh-my-posh

Config path: /home/krtko/.config/nushell/theme.omp.json

Logs:

[DEBUG] 11:48:38.959 shell.go:Getenv:392 ā†’ NO DATA
[TRACE] 11:48:38.959 shell.go:Getenv(TERM_PROGRAM) - 34.213Āµs
[DEBUG] 11:48:38.959 shell.go:Getenv:392 ā†’ NO DATA
[TRACE] 11:48:38.959 shell.go:Getenv(XDG_CACHE_HOME) - 4.055Āµs
[TRACE] 11:48:38.959 shell_unix.go:CachePath() - 24.687Āµs
[DEBUG] 11:48:38.959 shell.go:Getenv:392 ā†’ /home/krtko/.config/nushell/theme.omp.json
[TRACE] 11:48:38.959 shell.go:Getenv(POSH_THEME) - 7.142Āµs
[DEBUG] 11:48:38.959 shell_unix.go:Platform:77 ā†’ arch
[TRACE] 11:48:38.959 shell.go:resolveConfigPath() - 23.886Āµs
[TRACE] 11:48:38.959 shell.go:Init() - 252.739Āµs
[TRACE] 11:48:38.959 shell.go:Flags() - 67ns
[TRACE] 11:48:38.960 config.go:loadConfig() - 737.783Āµs
[TRACE] 11:48:38.960 shell.go:Flags() - 86ns
[DEBUG] 11:48:38.960 shell.go:Getenv:392 ā†’ NO DATA
[TRACE] 11:48:38.960 shell.go:Getenv(OMP_CACHE_DISABLED) - 4.44Āµs
[DEBUG] 11:48:38.960 shell.go:Shell:632 ā†’ no shell name provided in flags, trying to detect it
[DEBUG] 11:48:38.961 shell.go:Shell:640 ā†’ process name: nu
[TRACE] 11:48:38.961 shell.go:Shell() - 820.447Āµs
[DEBUG] 11:48:38.961 shell.go:Getenv:392 ā†’ 0.85.0
[TRACE] 11:48:38.961 shell.go:Getenv(POSH_SHELL_VERSION) - 4.672Āµs
[DEBUG] 11:48:38.961 debug.go:PrintDebug:22 ā†’ Segment: Title
[DEBUG] 11:48:38.961 text.go:Render:70 ā†’ Rendering template: 
[DEBUG] 11:48:38.961 shell.go:Getenv:392 ā†’ NO DATA
[TRACE] 11:48:38.961 shell.go:Getenv(POSH_CURSOR_LINE) - 6.282Āµs
[DEBUG] 11:48:38.961 shell.go:Getenv:392 ā†’ NO DATA
[TRACE] 11:48:38.961 shell.go:Getenv(POSH_CURSOR_COLUMN) - 3.177Āµs
[TRACE] 11:48:38.961 shell.go:Flags() - 93ns
[TRACE] 11:48:38.961 shell.go:Flags() - 38ns
[TRACE] 11:48:38.961 shell.go:Shell() - 101ns
[TRACE] 11:48:38.961 shell.go:Shell() - 69ns
[TRACE] 11:48:38.961 shell.go:Shell() - 44ns
[TRACE] 11:48:38.961 shell.go:Flags() - 86ns
[TRACE] 11:48:38.961 shell.go:Flags() - 193ns
[TRACE] 11:48:38.961 shell.go:GOOS() - 196ns
[DEBUG] 11:48:38.961 shell.go:Pwd:422 ā†’ /home/krtko
[TRACE] 11:48:38.961 shell.go:Pwd() - 32.976Āµs
[TRACE] 11:48:38.961 shell.go:GOOS() - 65ns
[DEBUG] 11:48:38.961 segment.go:SetEnabled:497 ā†’ Segment: Path
[TRACE] 11:48:38.961 shell.go:Pwd() - 202ns
[TRACE] 11:48:38.961 shell.go:Pwd() - 231ns
[TRACE] 11:48:38.961 shell.go:GOOS() - 110ns
[TRACE] 11:48:38.961 shell.go:Flags() - 284ns
[TRACE] 11:48:38.961 shell.go:Shell() - 100ns
[DEBUG] 11:48:38.961 segment.go:SetEnabled:497 ā†’ Segment: Exit
[TRACE] 11:48:38.961 shell.go:StatusCodes() - 114ns
[TRACE] 11:48:38.961 shell.go:Shell() - 73ns
[DEBUG] 11:48:38.961 text.go:Render:70 ā†’ Rendering template: {{ .Code }}
[TRACE] 11:48:38.961 shell.go:Pwd() - 302ns
[TRACE] 11:48:38.961 shell.go:GOOS() - 92ns
[DEBUG] 11:48:38.961 segment.go:SetEnabled:497 ā†’ Segment: Session
[DEBUG] 11:48:38.961 shell.go:Getenv:392 ā†’ NO DATA
[TRACE] 11:48:38.961 shell.go:Getenv(SSH_CONNECTION) - 7.492Āµs
[DEBUG] 11:48:38.961 shell.go:Getenv:392 ā†’ NO DATA
[TRACE] 11:48:38.961 shell.go:Getenv(SSH_CLIENT) - 6.198Āµs
[TRACE] 11:48:38.961 shell_unix.go:Root() - 1.846Āµs
[TRACE] 11:48:38.961 shell.go:Shell() - 194ns
[TRACE] 11:48:38.961 shell.go:StatusCodes() - 373ns
[DEBUG] 11:48:38.961 shell_unix.go:IsWsl:35 ā†’ false
[DEBUG] 11:48:38.961 properties.go:GetBool:22 ā†’ mapped_locations_enabled: true
[TRACE] 11:48:38.961 shell_unix.go:IsWsl() - 9.207Āµs
[DEBUG] 11:48:38.961 properties.go:GetString:28 ā†’ ļ€“
[DEBUG] 11:48:38.961 properties.go:GetString:28 ā†’ ļ€“
[TRACE] 11:48:38.961 shell.go:GOOS() - 185ns
[DEBUG] 11:48:38.961 properties.go:GetString:28 ā†’ ~
[DEBUG] 11:48:38.961 properties.go:GetKeyValueMap:46 ā†’ mapped_locations: map[]
[DEBUG] 11:48:38.961 shell.go:TemplateCache:813 ā†’ environment: [CLUTTER_BAKEND=wayland CMD_DURATION_MS=22 COLORTERM=truecolor DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus DEBUGINFOD_URLS=https://debuginfod.archlinux.org  DIRS_POSITION=0 DISPLAY=:0 ECORE_EVAS_ENGINE=wayland_egl EDITOR=vim ELM_ENGINE=wayland_egl ENV_VARIABLE=value GDK_BACKEND=wayland GREETD_SOCK=/run/greetd-549.sock HOME=/home/krtko I3SOCK=/run/user/1000/sway-ipc.1000.772.sock IPYTHONDIR=/home/krtko/.config/ipython LANG=en_US.UTF-8 LAST_EXIT_CODE=0 LOGNAME=krtko MAIL=/var/spool/mail/krtko MOTD_SHOWN=pam MOZ_ENABLE_WAYLAND=1 NU_LOG_FORMAT=%ANSI_START%%DATE%|%LEVEL%|%MSG%%ANSI_STOP% NU_VERSION=0.85.0 PATH=/home/krtko/.config/carapace/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/home/krtko/.cargo/bin:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl POSH_PID=9d98ce3f-84e7-438b-94ed-2a638622508e POSH_SHELL_VERSION=0.85.0 POSH_THEME=/home/krtko/.config/nushell/theme.omp.json POWERLINE_COMMAND=oh-my-posh PROMPT_INDICATOR= PROMPT_MULTILINE_INDICATOR=>  PWD=/home/krtko QT_QPA_PLATFORM=wayland;wayland-egl;xcb QT_QPA_PLATFORMTHEME=gtk3 QT_WAYLAND_DISABLE_WINDOWDECORATION=1 QT_WAYLAND_FORCE_DPI=physical SDL_VIDEODRIVER=wayland SHELL=/usr/bin/nu SHLVL=0 SSH_AGENT_PID=41102 SSH_AUTH_SOCK=/tmp/ssh-XXXXXXewyaim/agent.41100 SWAYSOCK=/run/user/1000/sway-ipc.1000.772.sock TERM=foot USER=krtko WAYLAND_DISPLAY=wayland-1 XCURSOR_SIZE=24 XDG_CURRENT_DESKTOP=sway XDG_RUNTIME_DIR=/run/user/1000 XDG_SEAT=seat0 XDG_SESSION_CLASS=user XDG_SESSION_DESKTOP=sway XDG_SESSION_ID=3 XDG_SESSION_TYPE=wayland XDG_VTNR=1 _=/usr/bin/foot _JAVA_AWT_WM_NONREPARENTING=1]
[TRACE] 11:48:38.961 shell.go:GOOS() - 66ns
[TRACE] 11:48:38.961 shell.go:GOOS() - 74ns
[TRACE] 11:48:38.961 shell.go:Pwd() - 194ns
[TRACE] 11:48:38.961 shell.go:GOOS() - 115ns
[TRACE] 11:48:38.961 shell.go:GOOS() - 94ns
[TRACE] 11:48:38.961 shell.go:GOOS() - 99ns
[TRACE] 11:48:38.961 shell.go:GOOS() - 145ns
[TRACE] 11:48:38.961 shell.go:GOOS() - 75ns
[TRACE] 11:48:38.961 shell.go:GOOS() - 100ns
[TRACE] 11:48:38.961 shell.go:GOOS() - 86ns
[TRACE] 11:48:38.961 shell.go:PathSeparator() - 91ns
[TRACE] 11:48:38.961 shell.go:PathSeparator() - 66ns
[TRACE] 11:48:38.961 shell.go:GOOS() - 63ns
[TRACE] 11:48:38.961 shell.go:GOOS() - 49ns
[TRACE] 11:48:38.961 shell.go:GOOS() - 88ns
[TRACE] 11:48:38.961 shell.go:PathSeparator() - 57ns
[TRACE] 11:48:38.961 shell.go:GOOS() - 108ns
[TRACE] 11:48:38.961 shell.go:GOOS() - 67ns
[DEBUG] 11:48:38.961 shell.go:User:543 ā†’ krtko
[TRACE] 11:48:38.961 shell.go:GOOS() - 67ns
[TRACE] 11:48:38.961 shell.go:User() - 7.555Āµs
[TRACE] 11:48:38.961 shell.go:PathSeparator() - 54ns
[TRACE] 11:48:38.961 shell.go:GOOS() - 60ns
[TRACE] 11:48:38.961 shell.go:GOOS() - 66ns
[DEBUG] 11:48:38.961 shell.go:Host:555 ā†’ doranda
[TRACE] 11:48:38.961 shell.go:Host() - 11.743Āµs
[TRACE] 11:48:38.961 shell.go:PathSeparator() - 77ns
[TRACE] 11:48:38.961 shell.go:GOOS() - 85ns
[TRACE] 11:48:38.961 shell.go:Pwd() - 178ns
[DEBUG] 11:48:38.961 shell_unix.go:Platform:77 ā†’ arch
[DEBUG] 11:48:38.961 shell_unix.go:IsWsl:35 ā†’ false
[DEBUG] 11:48:38.961 shell.go:Getenv:392 ā†’ 0
[TRACE] 11:48:38.961 shell_unix.go:IsWsl() - 13.042Āµs
[TRACE] 11:48:38.961 shell.go:TemplateCache() - 334.927Āµs
[TRACE] 11:48:38.962 shell_unix.go:DirIsWritable(/home/krtko) - 36.792Āµs
[TRACE] 11:48:38.962 shell.go:Flags() - 97ns
[TRACE] 11:48:38.962 shell.go:TemplateCache() - 3.877Āµs
[TRACE] 11:48:38.962 shell.go:Flags() - 218ns
[TRACE] 11:48:38.962 shell.go:Pwd() - 177ns
[TRACE] 11:48:38.962 shell.go:GOOS() - 218ns
[DEBUG] 11:48:38.962 segment.go:SetEnabled:497 ā†’ Segment: Node
[TRACE] 11:48:38.962 shell.go:Pwd() - 206ns
[TRACE] 11:48:38.962 shell.go:GOOS() - 87ns
[DEBUG] 11:48:38.962 properties.go:GetStringArray:52 ā†’ extensions: [*.js *.ts package.json .nvmrc pnpm-workspace.yaml .pnpmfile.cjs .npmrc .vue]
[DEBUG] 11:48:38.962 segment.go:SetEnabled:497 ā†’ Segment: Git
[DEBUG] 11:48:38.962 properties.go:GetStringArray:52 ā†’ folders: []
[DEBUG] 11:48:38.962 properties.go:GetBool:22 ā†’ home_enabled: false
[TRACE] 11:48:38.962 shell.go:TemplateCache() - 2.619Āµs
[DEBUG] 11:48:38.962 shell_unix.go:IsWsl:35 ā†’ false
[TRACE] 11:48:38.962 shell.go:Pwd() - 166ns
[TRACE] 11:48:38.962 shell_unix.go:IsWsl() - 8.012Āµs
[DEBUG] 11:48:38.962 properties.go:GetBool:22 ā†’ always_enabled: true
[TRACE] 11:48:38.962 shell_unix.go:IsWsl2() - 15.137Āµs
[TRACE] 11:48:38.962 shell.go:TemplateCache() - 125ns
[TRACE] 11:48:38.962 shell.go:GOOS() - 108ns
[DEBUG] 11:48:38.962 shell.go:CommandPath:594 ā†’ /usr/bin/git
[TRACE] 11:48:38.962 shell.go:CommandPath(git) - 58.371Āµs
[TRACE] 11:48:38.962 shell.go:HasCommand(git) - 62.709Āµs
[TRACE] 11:48:38.962 shell.go:Pwd() - 93ns
[ERROR] 11:48:38.962 shell.go:HasParentFilePath:728 ā†’ stat .git: no such file or directory
[TRACE] 11:48:38.962 shell.go:HasParentFilePath(.git) - 38.57Āµs
[DEBUG] 11:48:38.962 properties.go:GetBool:22 ā†’ fetch_bare_info: false
[DEBUG] 11:48:38.962 text.go:Render:70 ā†’ Rendering template:  {{ .Path }} 
[DEBUG] 11:48:38.962 text.go:Render:70 ā†’ Rendering template: {{ .UserName }} 
[DEBUG] 11:48:38.962 text.go:Render:70 ā†’ Rendering template:  {{ if gt .Code 0 }}ļ€ {{ .Meaning }}{{ else }}ļ®{{ end }}
[TRACE] 11:48:38.963 shell.go:TemplateCache() - 672ns
[TRACE] 11:48:38.963 shell.go:Shell() - 249ns
[TRACE] 11:48:38.963 shell.go:TemplateCache() - 187ns
[TRACE] 11:48:38.964 shell.go:Shell() - 103ns
[TRACE] 11:48:38.964 shell.go:TemplateCache() - 347ns
[TRACE] 11:48:38.964 shell.go:Shell() - 174ns
[DEBUG] 11:48:38.964 text.go:Render:70 ā†’ Rendering template: diamond
[DEBUG] 11:48:38.964 text.go:Render:70 ā†’ Rendering template: powerline
[DEBUG] 11:48:38.964 text.go:Render:70 ā†’ Rendering template: powerline
[DEBUG] 11:48:38.964 text.go:Render:70 ā†’ Rendering template: powerline
[DEBUG] 11:48:38.964 text.go:Render:70 ā†’ Rendering template: {{ if gt .Code 0 }}#e91e63{{ end }}
[TRACE] 11:48:38.965 shell.go:TemplateCache() - 261ns
[DEBUG] 11:48:38.965 text.go:Render:70 ā†’ Rendering template: diamond
[TRACE] 11:48:38.965 shell.go:Shell() - 119ns
[TRACE] 11:48:38.965 shell.go:Shell() - 41ns
[TRACE] 11:48:38.965 shell.go:Shell() - 43ns
[TRACE] 11:48:38.965 shell.go:Shell() - 41ns
[DEBUG] 11:48:38.965 shell.go:Getenv:392 ā†’ NO DATA
[TRACE] 11:48:38.965 shell.go:Getenv(XDG_CACHE_HOME) - 4.814Āµs
[TRACE] 11:48:38.965 shell_unix.go:CachePath() - 27.488Āµs
[TRACE] 11:48:38.965 shell.go:Flags() - 86ns
JanDeDobbeleer commented 11 months ago

@krtko1 this is a terminal issue. They make them take up more space than they should. Please create an issue on their end.

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