JanDeDobbeleer / oh-my-posh

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

Extra space at the end of the right prompt #4938

Closed Chaitanyabsprip closed 6 months ago

Chaitanyabsprip commented 6 months ago

Code of Conduct

What happened?

There is an extra space at the end of the right prompt. I don't understand where it is coming from.

image

Theme

Theme "$schema" = "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json" final_space = true version = 2 [palette] base = "#191724" surface = "#1f1d2e" overlay = "#26233a" muted = "#6e6a86" subtle = "#908caa" text = "#e0def4" love = "#eb6f92" gold = "#f6c177" rose = "#ebbcba" pine = "#31748f" foam = "#9ccfd8" iris = "#c4a7e7" hilow = "#21202e" himed = "#403d52" hihigh = "#524f67" [[blocks]] type = "prompt" alignment = "left" # starting new line before the prompt. Used to disjoint two consecutive prompts [[blocks.segments]] type = "text" style = "plain" template = "\n" [[blocks.segments]] type = "status" style = "plain" foreground = "green" background = "p:hilow" foreground_templates = ["{{ if .Error }}red{{end}}"] template = "▍" [blocks.segments.properties] always_enabled = true [[blocks.segments]] type = "battery" style = "plain" template = "{{ if lt .Percentage 5 }}█{{end}}" foreground = "red" background = "p:hilow" [[blocks.segments]] type = "path" style = "plain" foreground = "cyan" background = "p:hilow" template = "{{ if eq .PWD \"~\" }}home {{ else }}{{ .Folder }} {{ end }}" [blocks.segments.properties] style = "folder" home_icon = "home" [[blocks]] type = "rprompt" alignment = "right" overflow = "hide" [[blocks.segments]] type = "shell" style = "plain" # template = " {{ .name }} " background = "p:hilow" foreground = "p:himed"

What OS are you seeing the problem on?

Linux

Which shell are you using?

zsh

Log output

log output ```Shell Version: 19.29.1 Shell: zsh (5.9) Prompt: ▍dotfiles Segments: ConsoleTitle(false) - 0 ms Text(true) - 3 ms Status(true) - 5 ms Battery(false) - 9 ms Path(true) - 3 ms Shell(true) - 0 ms Run duration: 15.994485ms Cache path: /home/chaitanya/.local/cache/oh-my-posh Config path: /home/chaitanya/dotfiles/oh-my-posh.rc.toml Logs: [DEBUG] 23:43:56.545 shell.go:Getenv:325 → tmux [TRACE] 23:43:56.545 shell.go:Getenv(TERM_PROGRAM) - 131.914µs [DEBUG] 23:43:56.545 shell.go:Getenv:325 → NO DATA [TRACE] 23:43:56.545 shell.go:Getenv(OMP_CACHE_DIR) - 8.315µs [DEBUG] 23:43:56.545 shell.go:Getenv:325 → /home/chaitanya/.local/cache [TRACE] 23:43:56.545 shell.go:Getenv(XDG_CACHE_HOME) - 8.989µs [TRACE] 23:43:56.545 shell_unix.go:CachePath() - 54.052µs [DEBUG] 23:43:56.545 shell.go:Getenv:325 → /home/chaitanya/dotfiles/oh-my-posh.rc.toml [TRACE] 23:43:56.545 shell.go:Getenv(POSH_THEME) - 30.127µs [DEBUG] 23:43:56.545 shell_unix.go:Platform:87 → arch [TRACE] 23:43:56.546 shell.go:resolveConfigPath() - 60.091µs [TRACE] 23:43:56.546 shell.go:Init() - 757.103µs [TRACE] 23:43:56.546 shell.go:Flags() - 184ns [TRACE] 23:43:56.546 config.go:loadConfig() - 287.047µs [TRACE] 23:43:56.546 shell.go:Flags() - 78ns [DEBUG] 23:43:56.546 shell.go:Getenv:325 → NO DATA [TRACE] 23:43:56.546 shell.go:Getenv(OMP_CACHE_DISABLED) - 8.012µs [DEBUG] 23:43:56.546 shell.go:Shell:593 → no shell name provided in flags, trying to detect it [DEBUG] 23:43:56.549 shell.go:Shell:601 → process name: zsh [TRACE] 23:43:56.549 shell.go:Shell() - 2.718409ms [DEBUG] 23:43:56.549 shell.go:Getenv:325 → 5.9 [TRACE] 23:43:56.549 shell.go:Getenv(POSH_SHELL_VERSION) - 8.431µs [DEBUG] 23:43:56.549 debug.go:PrintDebug:22 → Segment: Title [DEBUG] 23:43:56.549 text.go:Render:71 → Rendering template: [DEBUG] 23:43:56.549 shell.go:Getenv:325 → NO DATA [TRACE] 23:43:56.549 shell.go:Getenv(POSH_CURSOR_LINE) - 6.954µs [DEBUG] 23:43:56.549 shell.go:Getenv:325 → NO DATA [TRACE] 23:43:56.549 shell.go:Getenv(POSH_CURSOR_COLUMN) - 5.454µs [TRACE] 23:43:56.549 shell.go:Flags() - 145ns [TRACE] 23:43:56.549 shell.go:Flags() - 79ns [TRACE] 23:43:56.549 shell.go:Shell() - 178ns [TRACE] 23:43:56.549 shell.go:Shell() - 79ns [TRACE] 23:43:56.549 shell.go:Flags() - 149ns [TRACE] 23:43:56.549 shell.go:GOOS() - 248ns [DEBUG] 23:43:56.549 shell.go:Pwd:355 → /home/chaitanya/dotfiles [TRACE] 23:43:56.549 shell.go:Pwd() - 31.425µs [TRACE] 23:43:56.549 shell.go:GOOS() - 75ns [DEBUG] 23:43:56.549 segment.go:SetEnabled:535 → Segment: Path [TRACE] 23:43:56.549 shell.go:Pwd() - 329ns [TRACE] 23:43:56.549 shell.go:Shell() - 234ns [TRACE] 23:43:56.549 shell.go:Shell() - 77ns [TRACE] 23:43:56.549 shell.go:Flags() - 431ns [DEBUG] 23:43:56.549 properties.go:GetBool:22 → mapped_locations_enabled: true [TRACE] 23:43:56.549 shell.go:Pwd() - 409ns [DEBUG] 23:43:56.549 properties.go:GetString:28 →  [TRACE] 23:43:56.549 shell.go:GOOS() - 147ns [DEBUG] 23:43:56.549 properties.go:GetString:28 →  [TRACE] 23:43:56.549 shell.go:GOOS() - 159ns [DEBUG] 23:43:56.549 segment.go:SetEnabled:535 → Segment: Text [DEBUG] 23:43:56.549 properties.go:GetString:28 → home [TRACE] 23:43:56.549 shell_unix.go:Root() - 1.522µs [DEBUG] 23:43:56.549 properties.go:GetKeyValueMap:46 → mapped_locations: map[] [TRACE] 23:43:56.549 shell.go:Shell() - 197ns [TRACE] 23:43:56.549 shell.go:StatusCodes() - 193ns [TRACE] 23:43:56.549 shell.go:PathSeparator() - 233ns [DEBUG] 23:43:56.549 shell_unix.go:IsWsl:35 → false [TRACE] 23:43:56.549 shell.go:GOOS() - 78ns [TRACE] 23:43:56.549 shell_unix.go:IsWsl() - 9.847µs [TRACE] 23:43:56.549 shell.go:GOOS() - 78ns [TRACE] 23:43:56.549 shell.go:GOOS() - 121ns [TRACE] 23:43:56.549 shell.go:GOOS() - 78ns [TRACE] 23:43:56.549 shell.go:PathSeparator() - 315ns [TRACE] 23:43:56.549 shell.go:PathSeparator() - 80ns [TRACE] 23:43:56.549 shell.go:GOOS() - 80ns [TRACE] 23:43:56.549 shell.go:GOOS() - 80ns [TRACE] 23:43:56.549 shell.go:PathSeparator() - 81ns [TRACE] 23:43:56.549 shell.go:GOOS() - 79ns [TRACE] 23:43:56.549 shell.go:GOOS() - 82ns [TRACE] 23:43:56.549 shell.go:PathSeparator() - 78ns [DEBUG] 23:43:56.549 shell.go:TemplateCache:774 ↓ environment: [ALACRITTY_LOG=/tmp/Alacritty-1348.log ALACRITTY_SOCKET=/run/user/1000/Alacritty-wayland-1-1348.sock ALACRITTY_WINDOW_ID=111322785426064 ANDROID_HOME=/home/chaitanya/programs/android ANDROID_SDK_ROOT=/home/chaitanya/programs/android BAT_THEME=material-rose-pine COLORTERM=truecolor DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus DEBUGINFOD_URLS=https://debuginfod.archlinux.org DESKTOP_SESSION=default DISPLAY=:1 DOTFILES=/home/chaitanya/dotfiles DOWNLOADS=/home/chaitanya/downloads EDITOR=nvim FLUTTER_SDK_ROOT=/home/chaitanya/programs/flutter/default FVM_CACHE_PATH=/home/chaitanya/programs/flutter FZF_ALT_C_COMMAND=fd . -t d --hidden FZF_ALT_C_OPTS=--preview='eza --tree {} | head -50' FZF_CTRL_R_OPTS= --info=inline --border --reverse --preview 'echo {}' --preview-window up:3:hidden:wrap --bind 'ctrl-/:toggle-preview' --bind 'ctrl-y:execute-silent(echo -n {2..} | pbcopy)+abort' --color header:italic --header 'Press CTRL-Y to copy command into clipboard' FZF_CTRL_T_COMMAND=fd --type file --hidden --exclude .git FZF_CTRL_T_OPTS= --info=hidden --border --preview 'bat -n --color=always {}' --bind 'ctrl-/:change-preview-window(down|hidden|)' FZF_DEFAULT_COMMAND=fd --type file --hidden --exclude .git FZF_DEFAULT_OPTS= --cycle --info=hidden --prompt='▍' --pointer='▍' --tabstop=4 --color=fg:#908caa,bg:#0f111a,hl:#ebbcba --color=fg+:#e0def4,bg+:#0f111a,hl+:#ebbcba --color=border:#403d52,header:#31748f,gutter:#0f111a --color=spinner:#f6c177,info:#9ccfd8,separator:#403d52 --color=pointer:#c4a7e7,marker:#eb6f92,prompt:#908caa GOBIN=/home/chaitanya/programs/go/bin GOPATH=/home/chaitanya/programs/go HL_INITIAL_WORKSPACE_TOKEN=71410eb4-66c2-48c0-87f2-7519dc2cb2d5 HOME=/home/chaitanya HYPRLAND_CMD=Hyprland HYPRLAND_INSTANCE_SIGNATURE=cba1ade848feac44b2eda677503900639581c3f4_1715702618_2136801908 JAVA_HOME=/usr/lib/jvm/java-17-openjdk LANG=en_US.UTF-8 LANGUAGE=en_US.UTF-8 LC_ALL=en_US.UTF-8 LC_CTYPE=UTF-8 LC_TYPE=UTF-8 LOGNAME=chaitanya MAIL=/var/spool/mail/chaitanya MOTD_SHOWN=pam MOZ_ENABLE_WAYLAND=1 NOTESPATH=/home/chaitanya/projects/library OLDPWD=/home/chaitanya PATH=/home/chaitanya/.local/bin/overrides:/home/chaitanya/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl:/usr/lib/rustup/bin:/home/chaitanya/programs/go/bin:/home/chaitanya/.local/share/nvim/mason/bin:/home/chaitanya/programs/flutter/default/bin:/home/chaitanya/programs/flutter/default/bin/cache/dart-sdk/bin:/home/chaitanya/dotfiles/bin PWD=/home/chaitanya/dotfiles QT_QPA_PLATFORMTHEME=qt5ct SCRIPTS=/home/chaitanya/.local/bin SHELL=/bin/zsh SHLVL=2 TERM=screen-256color TERM_PROGRAM=tmux TERM_PROGRAM_VERSION=3.4 TMUX=/tmp/tmux-1000/default,1562,6 TMUX_PANE=%27 USER=chaitanya VISUAL=nvim WAYLAND_DISPLAY=wayland-1 WINDOWID=111322785426064 XCURSOR_SIZE=24 XDG_BACKEND=wayland XDG_CACHE_HOME=/home/chaitanya/.local/cache XDG_CONFIG_HOME=/home/chaitanya/.config XDG_CURRENT_DESKTOP=Hyprland XDG_DATA_HOME=/home/chaitanya/.local/share XDG_RUNTIME_DIR=/run/user/1000 XDG_SEAT=seat0 XDG_SEAT_PATH=/org/freedesktop/DisplayManager/Seat0 XDG_SESSION_CLASS=user XDG_SESSION_DESKTOP= XDG_SESSION_ID=2 XDG_SESSION_PATH=/org/freedesktop/DisplayManager/Session1 XDG_SESSION_TYPE=wayland XDG_STATE_HOME=/home/chaitanya/.local/state XDG_VTNR=1 ZDOTDIR=/home/chaitanya/.config/zsh _=/usr/bin/oh-my-posh _JAVA_AWT_WM_NONREPARENTING=1 POSH_THEME=/home/chaitanya/dotfiles/oh-my-posh.rc.toml POSH_SHELL_VERSION=5.9 POSH_PID=994539 POWERLINE_COMMAND=oh-my-posh CONDA_PROMPT_MODIFIER=false POSH_PROMPT_COUNT=101 ZSHRC=/home/chaitanya/.config/zsh/.zshrc ZAP_DIR=/home/chaitanya/.local/share/zap ZAP_PLUGIN_DIR=/home/chaitanya/.local/share/zap/plugins CDPATH=.:/home/chaitanya/dotfiles:/home/chaitanya/projects:/home/chaitanya/.config:/home/chaitanya/programs:/home/chaitanya/.local/share/nvim/lazy] [TRACE] 23:43:56.549 shell.go:GOOS() - 81ns [TRACE] 23:43:56.549 shell.go:PathSeparator() - 79ns [TRACE] 23:43:56.549 shell.go:PathSeparator() - 78ns [TRACE] 23:43:56.549 shell.go:PathSeparator() - 78ns [DEBUG] 23:43:56.549 properties.go:GetString:28 → NO DATA [TRACE] 23:43:56.549 shell.go:GOOS() - 75ns [TRACE] 23:43:56.549 shell.go:PathSeparator() - 76ns [DEBUG] 23:43:56.549 properties.go:GetString:28 → folder [TRACE] 23:43:56.549 shell.go:GOOS() - 78ns [TRACE] 23:43:56.549 shell.go:GOOS() - 78ns [TRACE] 23:43:56.549 shell.go:GOOS() - 86ns [TRACE] 23:43:56.549 shell.go:GOOS() - 78ns [TRACE] 23:43:56.549 shell.go:GOOS() - 78ns [TRACE] 23:43:56.549 shell.go:GOOS() - 78ns [TRACE] 23:43:56.549 shell.go:GOOS() - 78ns [TRACE] 23:43:56.549 shell.go:GOOS() - 78ns [TRACE] 23:43:56.549 shell.go:GOOS() - 78ns [TRACE] 23:43:56.549 shell.go:PathSeparator() - 120ns [DEBUG] 23:43:56.549 properties.go:GetString:28 → NO DATA [TRACE] 23:43:56.549 shell.go:PathSeparator() - 81ns [DEBUG] 23:43:56.549 properties.go:GetString:28 → / [TRACE] 23:43:56.549 shell.go:Pwd() - 364ns [DEBUG] 23:43:56.549 shell_unix.go:IsWsl:35 → false [TRACE] 23:43:56.549 shell_unix.go:IsWsl() - 11.272µs [TRACE] 23:43:56.549 shell.go:StackCount() - 222ns [TRACE] 23:43:56.549 shell_unix.go:DirIsWritable(/home/chaitanya/dotfiles) - 12.005µs [TRACE] 23:43:56.550 shell.go:Flags() - 755ns [TRACE] 23:43:56.550 shell.go:Pwd() - 498ns [TRACE] 23:43:56.550 shell.go:GOOS() - 156ns [DEBUG] 23:43:56.550 segment.go:SetEnabled:535 → Segment: Battery [TRACE] 23:43:56.550 shell.go:Flags() - 582ns [DEBUG] 23:43:56.550 shell_unix.go:IsWsl:35 → false [TRACE] 23:43:56.550 shell_unix.go:IsWsl() - 30.599µs [DEBUG] 23:43:56.550 properties.go:GetString:28 → {{ .Code }} [TRACE] 23:43:56.550 shell.go:Pwd() - 993ns [TRACE] 23:43:56.550 shell.go:GOOS() - 165ns [DEBUG] 23:43:56.550 segment.go:SetEnabled:535 → Segment: Status [TRACE] 23:43:56.550 shell.go:StatusCodes() - 455ns [DEBUG] 23:43:56.550 text.go:Render:71 → Rendering template: {{ .Code }} [TRACE] 23:43:56.552 shell.go:Pwd() - 931ns [TRACE] 23:43:56.552 shell.go:GOOS() - 482ns [TRACE] 23:43:56.552 shell.go:GOOS() - 81ns [TRACE] 23:43:56.552 shell.go:GOOS() - 82ns [TRACE] 23:43:56.552 shell.go:GOOS() - 79ns [TRACE] 23:43:56.552 shell.go:GOOS() - 80ns [TRACE] 23:43:56.552 shell.go:GOOS() - 81ns [TRACE] 23:43:56.552 shell.go:GOOS() - 79ns [TRACE] 23:43:56.552 shell.go:GOOS() - 77ns [TRACE] 23:43:56.552 shell.go:GOOS() - 80ns [TRACE] 23:43:56.552 shell.go:GOOS() - 80ns [DEBUG] 23:43:56.552 shell.go:User:493 → chaitanya [TRACE] 23:43:56.552 shell.go:User() - 42.906µs [DEBUG] 23:43:56.552 shell.go:Host:505 → archlinux [TRACE] 23:43:56.552 shell.go:Host() - 26.726µs [TRACE] 23:43:56.552 shell.go:GOOS() - 80ns [DEBUG] 23:43:56.552 shell_unix.go:Platform:87 → arch [DEBUG] 23:43:56.552 shell.go:Getenv:325 → 2 [TRACE] 23:43:56.552 shell.go:Getenv(SHLVL) - 11.584µs [TRACE] 23:43:56.552 shell.go:TemplateCache() - 3.080705ms [TRACE] 23:43:56.553 shell.go:TemplateCache() - 3.424656ms [TRACE] 23:43:56.555 shell.go:TemplateCache() - 503ns [DEBUG] 23:43:56.555 properties.go:GetBool:22 → always_enabled: true [TRACE] 23:43:56.555 shell.go:TemplateCache() - 135ns [TRACE] 23:43:56.560 shell_windows_nix.go:BatteryState() - 9.755542ms [DEBUG] 23:43:56.560 properties.go:GetString:28 → NO DATA [TRACE] 23:43:56.560 shell.go:TemplateCache() - 290ns [DEBUG] 23:43:56.560 text.go:Render:71 → Rendering template: {{ if eq .PWD "~" }}home {{ else }}{{ .Folder }} {{ end }} [DEBUG] 23:43:56.560 text.go:Render:71 → Rendering template: ▍ [TRACE] 23:43:56.560 shell.go:Shell() - 530ns [DEBUG] 23:43:56.560 text.go:Render:71 → Rendering template: {{ if lt .Percentage 5 }}█{{end}} [DEBUG] 23:43:56.560 text.go:Render:71 ↓ Rendering template: [TRACE] 23:43:56.560 shell.go:Shell() - 611ns [TRACE] 23:43:56.560 shell.go:TemplateCache() - 174ns [TRACE] 23:43:56.560 shell.go:Shell() - 126ns [TRACE] 23:43:56.560 shell.go:TemplateCache() - 242ns [TRACE] 23:43:56.560 shell.go:TemplateCache() - 93ns [TRACE] 23:43:56.560 shell.go:Shell() - 66ns [DEBUG] 23:43:56.560 text.go:Render:71 → Rendering template: plain [DEBUG] 23:43:56.560 text.go:Render:71 → Rendering template: {{ if .Error }}red{{end}} [TRACE] 23:43:56.560 shell.go:TemplateCache() - 155ns [DEBUG] 23:43:56.560 text.go:Render:71 → Rendering template: plain [DEBUG] 23:43:56.560 text.go:Render:71 → Rendering template: plain [DEBUG] 23:43:56.560 text.go:Render:71 → Rendering template: plain [TRACE] 23:43:56.560 shell.go:Shell() - 54ns [TRACE] 23:43:56.560 shell.go:Shell() - 36ns [TRACE] 23:43:56.560 shell.go:Shell() - 34ns [TRACE] 23:43:56.560 shell.go:Shell() - 34ns [TRACE] 23:43:56.560 shell.go:Flags() - 191ns [TRACE] 23:43:56.560 shell.go:Pwd() - 147ns [TRACE] 23:43:56.560 shell.go:GOOS() - 70ns [DEBUG] 23:43:56.560 segment.go:SetEnabled:535 → Segment: Shell [DEBUG] 23:43:56.560 properties.go:GetKeyValueMap:46 → mapped_shell_names: map[] [TRACE] 23:43:56.560 shell.go:Shell() - 39ns [TRACE] 23:43:56.560 shell.go:Flags() - 34ns [TRACE] 23:43:56.560 shell.go:TemplateCache() - 81ns [DEBUG] 23:43:56.560 text.go:Render:71 → Rendering template: {{ .Name }} [TRACE] 23:43:56.561 shell.go:TemplateCache() - 130ns [TRACE] 23:43:56.561 shell.go:Shell() - 52ns [DEBUG] 23:43:56.561 text.go:Render:71 → Rendering template: plain [TRACE] 23:43:56.561 shell.go:Shell() - 36ns [TRACE] 23:43:56.561 shell.go:Shell() - 36ns [TRACE] 23:43:56.561 shell.go:Shell() - 38ns [TRACE] 23:43:56.561 shell.go:Shell() - 34ns [TRACE] 23:43:56.561 shell.go:Flags() - 58ns [DEBUG] 23:43:56.561 shell.go:Getenv:325 → NO DATA [TRACE] 23:43:56.561 shell.go:Getenv(OMP_CACHE_DIR) - 3.995µs [DEBUG] 23:43:56.561 shell.go:Getenv:325 → /home/chaitanya/.local/cache [TRACE] 23:43:56.561 shell.go:Getenv(XDG_CACHE_HOME) - 13.611µs [TRACE] 23:43:56.561 shell_unix.go:CachePath() - 36.91µs [TRACE] 23:43:56.561 shell.go:Flags() - 175ns ```
JanDeDobbeleer commented 6 months ago

That's the native ZSH right prompt functionality doing that. This is by their design.

Chaitanyabsprip commented 6 months ago

For people who come across this issue, ZLE_RPROMPT_INDENT=0 setting this envvar will remove the trailing space.

JanDeDobbeleer commented 6 months ago

@Chaitanyabsprip that's something I didn't know! I'm adding that natively to oh-my-posh, that way this can be aligned with other shells.

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