Skip to content

Commit 0c7d00b

Browse files
svnltoclaude
andcommitted
fix(claude-code): use real ANSI escapes in statusline script
$'...' quoting so escape sequences render correctly instead of printing literal \033 codes. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 56b140c commit 0c7d00b

File tree

1 file changed

+10
-13
lines changed

1 file changed

+10
-13
lines changed

common/claude-code/statusline-command.sh

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,14 @@ if [ "$part_count" -gt 3 ]; then
1717
short_path=".../${parts[$((part_count-2))]}/${parts[$((part_count-1))]}"
1818
fi
1919

20-
# ANSI 24-bit color helpers
21-
blue='\033[38;2;137;180;250m'
22-
pink='\033[38;2;245;194;231m'
23-
lavender='\033[38;2;180;190;254m'
24-
orange='\033[38;2;250;179;135m'
25-
muted='\033[38;2;147;153;178m'
26-
reset='\033[0m'
20+
# ANSI 24-bit color helpers (using $'...' for real escape characters)
21+
blue=$'\033[38;2;137;180;250m'
22+
pink=$'\033[38;2;245;194;231m'
23+
lavender=$'\033[38;2;180;190;254m'
24+
orange=$'\033[38;2;250;179;135m'
25+
red=$'\033[38;2;243;139;168m'
26+
muted=$'\033[38;2;147;153;178m'
27+
reset=$'\033[0m'
2728

2829
# Build status line
2930
user_host="$(whoami)@$(hostname -s)"
@@ -33,7 +34,7 @@ ctx_part=""
3334
if [ -n "$used_pct" ]; then
3435
pct_int=$(printf "%.0f" "$used_pct")
3536
if [ "$pct_int" -ge 80 ]; then
36-
ctx_color='\033[38;2;243;139;168m' # red (#F38BA8)
37+
ctx_color="$red"
3738
elif [ "$pct_int" -ge 50 ]; then
3839
ctx_color="$orange"
3940
else
@@ -42,8 +43,4 @@ if [ -n "$used_pct" ]; then
4243
ctx_part=" ${ctx_color}ctx:${pct_int}%${reset}"
4344
fi
4445

45-
printf "${blue}%s${reset} ${pink}%s${reset} ${muted}[%s]${reset}%s\n" \
46-
"$user_host" \
47-
"$short_path" \
48-
"$model" \
49-
"$ctx_part"
46+
echo "${blue}${user_host}${reset} ${pink}${short_path}${reset} ${muted}[${model}]${reset}${ctx_part}"

0 commit comments

Comments
 (0)