Skip to content

With command segment, the characters are displayed sliding to the right. #6298

Description

@og900aero

Code of Conduct

  • I agree to follow this project's Code of Conduct

What happened?

When I use a command segment, the characters are displayed sliding to the right.
The basic problem is that I would like to display a character that when sudo timeout is live (like the starship prompt has built in function).
I use the following code as a prompt (json based):
https://termbin.com/sc3n

Image

But If I use "type": "text" instead for simple text, the format is good:
"template": "{{ if eq .Env.LF_LEVEL "1" }}\u256d(lf)\u2500{{ else }}{{ if eq .Env.YAZI_LEVEL "1" }}\u256d(yazi)\u2500{{ else }}\u256d\u2500{{ end }}{{ end }}"

Image

Theme

I used my own json config

What OS are you seeing the problem on?

Linux

Which shell are you using?

bash

Log output

Version: 25.5.0

Shell: bash (5.2.15(1)-release)

Prompt:


 ╭─    shyciii  ~  took 0ms                                                                                                                                                                            09:23 
╰─$ 

Segments:

ConsoleTitle(false)                        -   0 ms
Command(true)                              -  11 ms
Status(true)                               -   1 ms
Session(true)                              -   3 ms
Path(true)                                 -   1 ms
Executiontime(true)                        -   0 ms
Time(true)                                 -   0 ms
Text(true)                                 -   0 ms

Run duration: 16.954123ms

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

Config path: /home/shyciii/.config/oh-my-posh/my_prompt_theme.json

Logs:

�[38;2;191;207;240m[DEBUG] �[38;2;156;231;201m09:23:41.050 �[0mdebug.go:36�[38;2;156;231;201m →�[0m debug mode enabled
�[38;2;191;207;240m[DEBUG] �[38;2;156;231;201m09:23:41.050 �[0mload.go:Path:79�[38;2;156;231;201m →�[0m config set using POSH_THEME: /home/shyciii/.config/oh-my-posh/my_prompt_theme.json
�[38;2;204;137;214m[TRACE] �[38;2;156;231;201m09:23:41.050 �[0mload.go:Path() - �[38;2;156;231;201m18.237µs�[0m
�[38;2;204;137;214m[TRACE] �[38;2;156;231;201m09:23:41.051 �[0mload.go:loadConfig() - �[38;2;156;231;201m991.673µs�[0m
�[38;2;204;137;214m[TRACE] �[38;2;156;231;201m09:23:41.051 �[0mload.go:Load() - �[38;2;156;231;201m1.003456ms�[0m
[DEBUG] 09:23:41.051 terminal.go:Init:54 → plain mode enabled
[TRACE] 09:23:41.051 path.go:Path() - 14.794µs
[DEBUG] 09:23:41.051 file.go:Init:26 → loading cache file: /home/shyciii/.cache/oh-my-posh/omp.cache
[DEBUG] 09:23:41.051 file.go:Init:47 → loading cache key: environment_platform
[DEBUG] 09:23:41.051 file.go:Init:47 → loading cache key: is_wsl
[DEBUG] 09:23:41.051 file.go:Init:47 → loading cache key: upgrade_check
[TRACE] 09:23:41.051 file.go:Init(/home/shyciii/.cache/oh-my-posh/omp.cache) - 91.597µs
[TRACE] 09:23:41.051 path.go:Path() - 10.368µs
[DEBUG] 09:23:41.051 file.go:Init:26 → loading cache file: /home/shyciii/.cache/oh-my-posh/omp.cache.11dbb838-edf0-4a09-a06f-972d1ae69c6b
[DEBUG] 09:23:41.052 file.go:Init:47 → loading cache key: prompt_count_cache
[TRACE] 09:23:41.052 file.go:Init(/home/shyciii/.cache/oh-my-posh/omp.cache.11dbb838-edf0-4a09-a06f-972d1ae69c6b) - 68.663µs
[TRACE] 09:23:41.052 terminal.go:setPromptCount() - 996ns
[TRACE] 09:23:41.052 terminal.go:GOOS() - 68ns
[DEBUG] 09:23:41.052 terminal.go:setPwd:115 → /home/shyciii
[TRACE] 09:23:41.052 terminal.go:setPwd() - 17.202µs
[TRACE] 09:23:41.052 terminal.go:Init() - 274.516µs
[TRACE] 09:23:41.052 terminal.go:Shell() - 80ns
[TRACE] 09:23:41.052 terminal.go:Flags() - 74ns
[TRACE] 09:23:41.052 cache.go:restoreCache() - 566ns
[TRACE] 09:23:41.052 terminal_unix.go:Root() - 1.216µs
[TRACE] 09:23:41.052 terminal.go:Shell() - 70ns
[TRACE] 09:23:41.052 terminal.go:Flags() - 39ns
[TRACE] 09:23:41.052 terminal.go:StatusCodes() - 157ns
[DEBUG] 09:23:41.052 terminal_unix.go:IsWsl:32 → false
[TRACE] 09:23:41.052 terminal_unix.go:IsWsl() - 4.266µs
[TRACE] 09:23:41.052 terminal.go:Flags() - 49ns
[TRACE] 09:23:41.052 terminal.go:Flags() - 40ns
[DEBUG] 09:23:41.052 home.go:12 → /home/shyciii
[DEBUG] 09:23:41.052 terminal_unix.go:IsWsl:32 → false
[TRACE] 09:23:41.052 terminal_unix.go:IsWsl() - 4.24µs
[TRACE] 09:23:41.052 terminal.go:Flags() - 39ns
[TRACE] 09:23:41.052 terminal.go:Flags() - 40ns
[TRACE] 09:23:41.052 terminal.go:GOOS() - 38ns
[DEBUG] 09:23:41.052 terminal.go:User:249 → shyciii
[TRACE] 09:23:41.052 terminal.go:User() - 4.182µs
[DEBUG] 09:23:41.052 terminal.go:Host:266 → DEBIAN
[TRACE] 09:23:41.052 terminal.go:Host() - 6.287µs
[TRACE] 09:23:41.052 terminal.go:GOOS() - 40ns
[DEBUG] 09:23:41.052 terminal_unix.go:Platform:92 → debian
[DEBUG] 09:23:41.052 terminal.go:Getenv:77 → 2
[TRACE] 09:23:41.052 terminal.go:Getenv(SHLVL) - 4.2µs
[DEBUG] 09:23:41.052 writer.go:Init:105 → terminal program: Unknown
[DEBUG] 09:23:41.052 writer.go:Init:106 → terminal shell: shell
[DEBUG] 09:23:41.052 terminal.go:Getenv:77 → NO DATA
[TRACE] 09:23:41.052 terminal.go:Getenv(OMP_CACHE_DISABLED) - 4.314µs
[TRACE] 09:23:41.052 colors.go:SetAccentColor() - 444ns
[TRACE] 09:23:41.052 terminal.go:Shell() - 71ns
[DEBUG] 09:23:41.052 terminal.go:Getenv:77 → 5.2.15(1)-release
[TRACE] 09:23:41.052 terminal.go:Getenv(POSH_SHELL_VERSION) - 4.545µs
[DEBUG] 09:23:41.052 debug.go:PrintDebug:24 → segment: Title
[TRACE] 09:23:41.052 text.go:Render() - 106ns
[TRACE] 09:23:41.052 terminal.go:Flags() - 39ns
[DEBUG] 09:23:41.052 terminal.go:Getenv:77 → NO DATA
[TRACE] 09:23:41.052 terminal.go:Getenv(POSH_CURSOR_LINE) - 3.951µs
[DEBUG] 09:23:41.052 terminal.go:Getenv:77 → NO DATA
[TRACE] 09:23:41.052 terminal.go:Getenv(POSH_CURSOR_COLUMN) - 3.034µs
[TRACE] 09:23:41.052 terminal.go:Flags() - 39ns
[TRACE] 09:23:41.052 terminal.go:Flags() - 39ns
[TRACE] 09:23:41.052 terminal.go:Flags() - 129ns
[DEBUG] 09:23:41.052 home.go:12 → /home/shyciii
[TRACE] 09:23:41.052 terminal.go:Flags() - 159ns
[TRACE] 09:23:41.052 terminal.go:GOOS() - 149ns
[DEBUG] 09:23:41.052 segment.go:Execute:111 → segment: Executiontime
[DEBUG] 09:23:41.052 home.go:12 → /home/shyciii
[TRACE] 09:23:41.052 terminal.go:GOOS() - 87ns
[DEBUG] 09:23:41.052 segment.go:isToggled:228 → no toggles found
[DEBUG] 09:23:41.052 segment.go:Execute:111 → segment: Status
[TRACE] 09:23:41.052 terminal.go:Flags() - 283ns
[DEBUG] 09:23:41.052 segment.go:isToggled:228 → no toggles found
[DEBUG] 09:23:41.052 home.go:12 → /home/shyciii
[TRACE] 09:23:41.052 terminal.go:StatusCodes() - 135ns
[DEBUG] 09:23:41.052 properties.go:GetBool:22 → always_enabled: true
[TRACE] 09:23:41.052 terminal.go:GOOS() - 140ns
[TRACE] 09:23:41.052 terminal.go:ExecutionTime() - 144ns
[DEBUG] 09:23:41.052 properties.go:GetString:28 → status_template: {{ .Code }}
[DEBUG] 09:23:41.052 segment.go:Execute:111 → segment: Command
[DEBUG] 09:23:41.052 properties.go:GetFloat64:34 → threshold: 500.000000
[DEBUG] 09:23:41.052 segment.go:isToggled:228 → no toggles found
[DEBUG] 09:23:41.052 properties.go:GetString:28 → style: austin
[DEBUG] 09:23:41.052 properties.go:GetString:28 → shell: bash
[TRACE] 09:23:41.052 terminal.go:Flags() - 128ns
[DEBUG] 09:23:41.052 home.go:12 → /home/shyciii
[TRACE] 09:23:41.052 terminal.go:GOOS() - 80ns
[DEBUG] 09:23:41.052 segment.go:Execute:111 → segment: Session
[DEBUG] 09:23:41.052 terminal.go:CommandPath:317 → /usr/bin/bash
[DEBUG] 09:23:41.052 segment.go:isToggled:228 → no toggles found
[TRACE] 09:23:41.052 terminal.go:CommandPath(bash) - 35.325µs
[DEBUG] 09:23:41.052 terminal.go:Getenv:77 → NO DATA
[TRACE] 09:23:41.052 terminal.go:HasCommand(bash) - 43.281µs
[TRACE] 09:23:41.052 terminal.go:Getenv(SSH_CONNECTION) - 6.349µs
[DEBUG] 09:23:41.052 terminal.go:Getenv:77 → NO DATA
[DEBUG] 09:23:41.052 properties.go:GetString:28 → command: if sudo -vn 2>/dev/null; then echo '╭󰌾─'; else echo '╭─'; fi
[TRACE] 09:23:41.052 terminal.go:Getenv(SSH_CLIENT) - 4.849µs
[DEBUG] 09:23:41.052 terminal_unix.go:Platform:92 → debian
[DEBUG] 09:23:41.052 properties.go:GetBool:22 → interpret: true
[DEBUG] 09:23:41.052 text.go:patchTemplate:125 → {{ .Data.Code }}
[TRACE] 09:23:41.053 text.go:Render({{ .Code }}) - 1.170027ms
[DEBUG] 09:23:41.053 properties.go:GetBool:22 → always_enabled: true
[TRACE] 09:23:41.053 terminal.go:Flags() - 706ns
[DEBUG] 09:23:41.054 home.go:12 → /home/shyciii
[TRACE] 09:23:41.054 terminal.go:GOOS() - 298ns
[DEBUG] 09:23:41.054 segment.go:Execute:111 → segment: Path
[DEBUG] 09:23:41.054 segment.go:isToggled:228 → no toggles found
[DEBUG] 09:23:41.054 properties.go:GetBool:22 → display_cygpath: false
[TRACE] 09:23:41.054 terminal.go:GOOS() - 475ns
[TRACE] 09:23:41.054 separator.go:Separator() - 278ns
[TRACE] 09:23:41.054 terminal.go:Shell() - 1.976µs
[TRACE] 09:23:41.054 terminal.go:Shell() - 106ns
[TRACE] 09:23:41.054 terminal.go:GOOS() - 187ns
[DEBUG] 09:23:41.054 properties.go:GetBool:22 → mapped_locations_enabled: true
[DEBUG] 09:23:41.054 properties.go:GetString:28 → windows_registry_icon: 
[DEBUG] 09:23:41.054 properties.go:GetString:28 → windows_registry_icon: 
[DEBUG] 09:23:41.054 home.go:12 → /home/shyciii
[TRACE] 09:23:41.054 separator.go:Separator() - 255ns
[TRACE] 09:23:41.054 terminal.go:GOOS() - 301ns
[TRACE] 09:23:41.054 terminal.go:GOOS() - 59ns
[DEBUG] 09:23:41.054 properties.go:GetString:28 → home_icon: ~
[DEBUG] 09:23:41.054 properties.go:GetKeyValueMap:46 → mapped_locations: map[]
[TRACE] 09:23:41.054 separator.go:Separator() - 278ns
[TRACE] 09:23:41.054 terminal.go:GOOS() - 95ns
[TRACE] 09:23:41.054 terminal.go:GOOS() - 75ns
[TRACE] 09:23:41.054 separator.go:Separator() - 89ns
[TRACE] 09:23:41.054 terminal.go:GOOS() - 108ns
[TRACE] 09:23:41.054 terminal.go:GOOS() - 78ns
[TRACE] 09:23:41.054 terminal.go:GOOS() - 40ns
[TRACE] 09:23:41.054 terminal.go:GOOS() - 41ns
[TRACE] 09:23:41.054 terminal.go:GOOS() - 101ns
[TRACE] 09:23:41.054 terminal.go:Flags() - 837ns
[DEBUG] 09:23:41.055 properties.go:GetStringArray:52 → cycle: []
[DEBUG] 09:23:41.055 properties.go:GetString:28 → folder_separator_template: 
[DEBUG] 09:23:41.055 properties.go:GetString:28 → folder_separator_icon: /
[DEBUG] 09:23:41.055 properties.go:GetBool:22 → cycle_folder_separator: false
[DEBUG] 09:23:41.055 properties.go:GetString:28 → folder_format: %s
[DEBUG] 09:23:41.055 properties.go:GetString:28 → edge_format: %s
[DEBUG] 09:23:41.055 properties.go:GetString:28 → left_format: %s
[DEBUG] 09:23:41.055 properties.go:GetString:28 → right_format: %s
[TRACE] 09:23:41.055 terminal.go:Flags() - 534ns
[TRACE] 09:23:41.055 terminal.go:GOOS() - 95ns
[TRACE] 09:23:41.055 terminal.go:StackCount() - 169ns
[TRACE] 09:23:41.055 terminal_unix.go:DirIsWritable(/home/shyciii) - 10.532µs
[DEBUG] 09:23:41.055 terminal.go:RunCommand:293 → NO DATA
[TRACE] 09:23:41.055 terminal.go:RunCommand(who am i) - 3.324604ms
[DEBUG] 09:23:41.063 terminal.go:RunCommand:293 → ╭─
[TRACE] 09:23:41.063 terminal.go:RunCommand(bash -c if sudo -vn 2>/dev/null; then echo '╭󰌾─'; else echo '╭─'; fi) - 11.080105ms
[TRACE] 09:23:41.063 terminal.go:RunShellCommand() - 11.094146ms
[DEBUG] 09:23:41.063 text.go:patchTemplate:125 →  {{ .Data.Output }} 
[TRACE] 09:23:41.064 text.go:Render( {{ .Output }} ) - 146.553µs
[TRACE] 09:23:41.064 text.go:Render(plain) - 242ns
[DEBUG] 09:23:41.064 text.go:patchTemplate:125 →  {{ if gt .Data.Code 0 }} {{ .Data.Code }}{{ else }}{{ end }} 
[TRACE] 09:23:41.064 text.go:Render( {{ if gt .Code 0 }} {{ .Code }}{{ else }}{{ end }} ) - 104.713µs
[DEBUG] 09:23:41.064 text.go:patchTemplate:125 → {{ if .Data.Error }}#ff0000{{ end }}
[TRACE] 09:23:41.064 text.go:Render({{ if .Error }}#ff0000{{ end }}) - 51.588µs
[TRACE] 09:23:41.064 text.go:Render(powerline) - 212ns
[DEBUG] 09:23:41.064 text.go:patchTemplate:125 → {{ if .Data.Error }}#ff0000{{ end }}
[TRACE] 09:23:41.064 text.go:Render({{ if .Error }}#ff0000{{ end }}) - 42.922µs
[DEBUG] 09:23:41.064 text.go:patchTemplate:125 →  {{ if .Data.SSHSession }} {{ end }}{{ .UserName }}{{ if .Data.SSHSession }}@{{ .HostName }}{{ end }} 
[TRACE] 09:23:41.064 text.go:Render( {{ if .SSHSession }} {{ end }}{{ .UserName }}{{ if .SSHSession }}@{{ .HostName }}{{ end }} ) - 132.324µs
[TRACE] 09:23:41.064 text.go:Render(powerline) - 190ns
[DEBUG] 09:23:41.064 text.go:patchTemplate:125 → {{ if .Data.Error }}#ff0000{{ end }}
[TRACE] 09:23:41.065 text.go:Render({{ if .Error }}#ff0000{{ end }}) - 629.052µs
[DEBUG] 09:23:41.065 text.go:patchTemplate:125 →  {{ .Data.Path }} 
[TRACE] 09:23:41.065 text.go:Render( {{ .Path }} ) - 77.319µs
[TRACE] 09:23:41.065 text.go:Render(powerline) - 157ns
[DEBUG] 09:23:41.065 text.go:patchTemplate:125 →  took <i>{{ .Data.FormattedMs }}</i> 
[TRACE] 09:23:41.065 text.go:Render( took <i>{{ .FormattedMs }}</i> ) - 59.191µs
[TRACE] 09:23:41.065 text.go:Render(powerline) - 119ns
[TRACE] 09:23:41.065 terminal.go:Shell() - 181ns
[TRACE] 09:23:41.065 terminal.go:Shell() - 46ns
[TRACE] 09:23:41.065 terminal.go:Flags() - 81ns
[DEBUG] 09:23:41.065 home.go:12 → /home/shyciii
[TRACE] 09:23:41.065 terminal.go:GOOS() - 81ns
[DEBUG] 09:23:41.065 segment.go:Execute:111 → segment: Time
[DEBUG] 09:23:41.065 segment.go:isToggled:228 → no toggles found
[DEBUG] 09:23:41.065 properties.go:GetString:28 → time_format: 15:04
[DEBUG] 09:23:41.065 text.go:patchTemplate:125 →  {{ .Data.CurrentDate | date .Data.Format }} 
[TRACE] 09:23:41.065 text.go:Render( {{ .CurrentDate | date .Format }} ) - 360.901µs
[TRACE] 09:23:41.065 text.go:Render(diamond) - 168ns
[DEBUG] 09:23:41.067 terminal_unix.go:TerminalWidth:85 → terminal width: 212
[TRACE] 09:23:41.067 terminal_unix.go:TerminalWidth() - 1.163743ms
[TRACE] 09:23:41.067 terminal.go:Shell() - 164ns
[TRACE] 09:23:41.067 terminal.go:Shell() - 74ns
[TRACE] 09:23:41.067 terminal.go:Flags() - 80ns
[DEBUG] 09:23:41.067 home.go:12 → /home/shyciii
[TRACE] 09:23:41.067 terminal.go:GOOS() - 110ns
[DEBUG] 09:23:41.067 segment.go:Execute:111 → segment: Text
[DEBUG] 09:23:41.067 segment.go:isToggled:228 → no toggles found
[DEBUG] 09:23:41.067 text.go:patchTemplate:125 → {{ if eq (call .Getenv "LF_LEVEL") "1" }}╰───${{ else }}{{ if eq (call .Getenv "YAZI_LEVEL") "1" }}╰─────${{ else }}╰─${{ end }}{{ end }}
[DEBUG] 09:23:41.067 terminal.go:Getenv:77 → NO DATA
[TRACE] 09:23:41.067 terminal.go:Getenv(LF_LEVEL) - 31.204µs
[DEBUG] 09:23:41.067 terminal.go:Getenv:77 → NO DATA
[TRACE] 09:23:41.067 terminal.go:Getenv(YAZI_LEVEL) - 4.761µs
[TRACE] 09:23:41.067 text.go:Render({{ if eq .Env.LF_LEVEL "1" }}╰───${{ else }}{{ if eq .Env.YAZI_LEVEL "1" }}╰─────${{ else }}╰─${{ end }}{{ end }}) - 346.235µs
[TRACE] 09:23:41.067 text.go:Render(plain) - 161ns
[TRACE] 09:23:41.067 terminal.go:Shell() - 166ns
[TRACE] 09:23:41.067 terminal.go:Shell() - 56ns
[TRACE] 09:23:41.067 terminal.go:Shell() - 57ns
[TRACE] 09:23:41.067 path.go:Path() - 14.855µs
[TRACE] 09:23:41.067 terminal.go:Flags() - 67ns

Metadata

Metadata

Labels

🐛 bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions