`$fill` miscounts characters when displaying the `$` character in modules
Bug Report
Current Behavior
For each $ that's printed to the prompt, starship's fill over counts the character by 1 and thus information is not correctly right-aligned.
Expected Behavior
Starship's $fill should correctly calculate the spaces needed to right-align the information printed.
Additional context/Screenshots
Possible Solution
None. Not familiar with Rust.
Disclaimer: the following was suggested by ChatGPT as I was isolating the issue and troubleshooting it.
Issue is with the fact that Starship escapes certain characters in the function shell_prompt_escape in formatter/string_formatter.rs and thus $fill counts the escaped characters which the terminal ends up interpreting and rendering as a single one.
Environment
- Starship version: 1.26.0
- bash version: GNU bash, version 5.3.15(1)-release (aarch64-apple-darwin25.4.0) Copyright (C) 2025 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html
This is free software; you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.
- Operating system: Mac OS 26.6.2
- Terminal emulator: WezTerm 20240203-110809-5046fc22
- Git Commit Hash:
- Branch/Tag:
- Rust Version: rustc 1.96.0 (ac68faa20 2026-05-25) (Homebrew)
- Rust channel: release
- Build Time: 2026-06-28 17:02:30 +00:00
Relevant Shell Configuration
Not relevant. I tested starship on a bash session without bashrc using bash --norc and then executing eval "$(starship init bash)".
Starship Configuration
###
# Minimal starship config to reproduce issue with fill miscounting when printing '$' chars
#
# Insert a blank line between shell prompts
add_newline = true
# Continuation prompt
continuation_prompt = ' ▶▶ '
format = """
${custom.user}\
$fill\
${custom.uptime}
${custom.user}\
$fill\
${custom.dollarchar}\
${custom.uptime}
${custom.user}\
$fill\
${custom.dollarchar}\
${custom.dollarchar}\
${custom.uptime}
$character
"""
[fill]
symbol = '-'
[custom.dollarchar]
disabled = false
when = true
format = '\$'
[custom.user]
disabled = false
when = true
format = 'user@machine'
[custom.uptime]
disabled = false
when = true
format = 'Uptime: 10d.10m.10s'
[character]
disabled = false
success_symbol = '[❯](bold fg:green)'
error_symbol = '[❯](bold fg:red)'
vimcmd_symbol = '[❮](bold fg:green)'
vimcmd_replace_one_symbol = '[❮](bold fg:lavender)'
vimcmd_replace_symbol = '[❮](bold fg:lavender)'
vimcmd_visual_symbol = '[❮](bold fg:yellow)'
Source: starship/starship