`$fill` misaligns under tcsh when the prompt contains `!`
Author: nikolas-sapaCreated Sep 21, 2026Updated Sep 21, 2026
Bug Report
Current Behavior
Under tcsh, $fill miscomputes the fill width whenever the prompt contains !, so right-aligned content drifts by one column per !.
Root cause (same class as #7728)
print::get_prompt computes fill widths in ansi_strings_for_width, and only afterwards escapes !→\! (and newline) for tcsh:
// escape \n and ! characters for tcsh
if context.shell == Shell::Tcsh {
buf = buf.replace('!', "\\!");Each ! renders as one column but is measured as one and printed as two, starving/overflowing $fill exactly like the bash \$ case in #7728 (where the fix was to measure the rendered width).
Expected Behavior
Fill width accounts for tcsh ! escaping, same as #7728 did for bash/zsh escapes.
Happy to fix it the same way if that direction sounds right.
Source: starship/starship