Prompt sigil uses shift not arithmetic.

This commit is contained in:
2026-06-28 01:37:34 -04:00
parent 1c1365214a
commit a7d9745e41
2 changed files with 25 additions and 35 deletions
+7 -7
View File
@@ -15,12 +15,14 @@ if( ! $?unknown_tty ) then
endif
set reference_colors=()
set referencechars=()
# R G Y B C M
set reference_colors=( ${csi}91m ${csi}92m ${csi}93m ${csi}38\;5\;33m ${csi}95m ${csi}96m )
set reference_colors_original=( ${csi}91m ${csi}92m ${csi}93m ${csi}38\;5\;33m ${csi}95m ${csi}96m )
# R G Y B M
#set reference_colors=( ${csi}91m ${csi}92m ${csi}93m ${csi}38\;5\;33m ${csi}96m )
#set reference_colors_original=( ${csi}91m ${csi}92m ${csi}93m ${csi}38\;5\;33m ${csi}96m )
# Select a set of Unicode codepoints for prompt referencing...
set referencechars_raw=""
@@ -101,19 +103,17 @@ set referencechars_raw="${referencechars_raw} 2620"
#set referencechars_raw="${referencechars_raw} 2615"
#echo ${referencechars[1]}
set prompt_hcolor=0
set prompt_hsym=0
_debug "Building unicode sigils table...."
if( ! $?CSHENV_NO_UNICODE_PRINTF ) then
set referencechars=()
set referencechars_original=()
foreach ch ($referencechars_raw)
set unicode=`printf "\\u${ch}"`
set referencechars=( $referencechars `printf "${unicode}"` )
set referencechars_original=( $referencechars_original `printf "${unicode}"` )
end
else
# Safe fallback for when there's no unicode printf
set referencechars="A B C D X Y Z"
set referencechars_original="A B C D X Y Z"
endif
_debug "Done building unicode sigils table"
+18 -28
View File
@@ -62,67 +62,57 @@ _debug "Done with color cacheing loop"
_debug "Dynamic color loading processed..."
if( ${prompt_hcolor} != 0 ) then
set last_color = ${reference_colors[${prompt_hcolor}]}
endif
if( ${prompt_hsym} != 0 ) then
set last_sym = ${referencechars[${prompt_hsym}]}
endif
@ prompt_hcolor = $prompt_hcolor % ${#reference_colors}
@ prompt_hsym = $prompt_hsym % ${#referencechars}
while( ${prompt_hcolor} == 0 )
while( ${#reference_colors} == 0 )
_debug colorshuffle
#echo 
# Shuffle, if supported
if( $?cshenv_detected_shuf ) then
set reference_colors=`shuf -e $reference_colors`
set reference_colors=`shuf -e $reference_colors_original`
else
#echo "FALLBACK COLOR!"
set reference_colors=`echo $reference_colors | tr " " "\n" | sort -R | xargs`
set reference_colors=`echo $reference_colors_original | tr " " "\n" | sort -R | xargs`
endif
if( ! $?last_color ) then
break
endif
set first_color = ${reference_colors[1]}
if( ${first_color} != ${last_color} ) then
break
if( ${first_color} == ${last_color} ) then
set reference_colors=()
continue
endif
end
while( ${prompt_hsym} == 0 )
while( ${#referencechars} == 0 )
_debug symbolshuffle
#echo 
if( $?cshenv_detected_shuf ) then
set referencechars=`shuf -e $referencechars`
#set reference_colors=`shuf -e $reference_colors`
set referencechars=`shuf -e $referencechars_original`
else
#echo "FALLBACK CHAR!"
set referencechars=`echo $referencechars | tr " " "\n" | sort -R | xargs`
set referencechars=(`echo $referencechars_original | tr " " "\n" | sort -R | xargs`)
endif
if( ! $?last_sym ) then
break
endif
set first_sym = ${referencechars[1]}
if( ${first_sym} != ${last_sym} ) then
break
if( ${first_sym} == ${last_sym} ) then
set referencechars=()
continue
endif
end
@ prompt_hcolor = ${prompt_hcolor} + 1
@ prompt_hsym = ${prompt_hsym} + 1
if( $?CSHENV_DEBUG ) then
_debug ${prompt_hcolor} ${prompt_hsym}
_debug ${reference_colors[1]} ${referencechars[1]}
_debug "Setting prompt"
endif
set last_color = ${reference_colors[1]}
set last_sym = ${referencechars[1]}
set prompt_reference_core="%{${reference_colors[${prompt_hcolor}]}%}${referencechars[${prompt_hsym}]}"
set prompt_reference_core="%{${last_color}%}${last_sym}"
shift reference_colors
shift referencechars
#if( ${referencechars[${prompt_hsym}]} == `env LC_ALL=C.UTF-8 printf "\u2328"` ) then
# set prompt_reference="%{${dim}%}<${prompt_reference_core} %{${dim}%}> "
#else