Prompt sigil uses shift not arithmetic.
This commit is contained in:
+7
-7
@@ -15,12 +15,14 @@ if( ! $?unknown_tty ) then
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
||||||
|
set reference_colors=()
|
||||||
|
set referencechars=()
|
||||||
|
|
||||||
# R G Y B C M
|
# 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
|
# 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...
|
# Select a set of Unicode codepoints for prompt referencing...
|
||||||
set referencechars_raw=""
|
set referencechars_raw=""
|
||||||
@@ -101,19 +103,17 @@ set referencechars_raw="${referencechars_raw} 2620"
|
|||||||
#set referencechars_raw="${referencechars_raw} 2615"
|
#set referencechars_raw="${referencechars_raw} 2615"
|
||||||
|
|
||||||
#echo ${referencechars[1]}
|
#echo ${referencechars[1]}
|
||||||
set prompt_hcolor=0
|
|
||||||
set prompt_hsym=0
|
|
||||||
|
|
||||||
_debug "Building unicode sigils table...."
|
_debug "Building unicode sigils table...."
|
||||||
if( ! $?CSHENV_NO_UNICODE_PRINTF ) then
|
if( ! $?CSHENV_NO_UNICODE_PRINTF ) then
|
||||||
set referencechars=()
|
set referencechars_original=()
|
||||||
foreach ch ($referencechars_raw)
|
foreach ch ($referencechars_raw)
|
||||||
set unicode=`printf "\\u${ch}"`
|
set unicode=`printf "\\u${ch}"`
|
||||||
set referencechars=( $referencechars `printf "${unicode}"` )
|
set referencechars_original=( $referencechars_original `printf "${unicode}"` )
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
# Safe fallback for when there's no unicode printf
|
# 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
|
endif
|
||||||
_debug "Done building unicode sigils table"
|
_debug "Done building unicode sigils table"
|
||||||
|
|
||||||
|
|||||||
+18
-28
@@ -62,67 +62,57 @@ _debug "Done with color cacheing loop"
|
|||||||
_debug "Dynamic color loading processed..."
|
_debug "Dynamic color loading processed..."
|
||||||
|
|
||||||
|
|
||||||
|
while( ${#reference_colors} == 0 )
|
||||||
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 )
|
|
||||||
_debug colorshuffle
|
_debug colorshuffle
|
||||||
#echo
|
#echo
|
||||||
# Shuffle, if supported
|
# Shuffle, if supported
|
||||||
if( $?cshenv_detected_shuf ) then
|
if( $?cshenv_detected_shuf ) then
|
||||||
set reference_colors=`shuf -e $reference_colors`
|
set reference_colors=`shuf -e $reference_colors_original`
|
||||||
else
|
else
|
||||||
#echo "FALLBACK COLOR!"
|
#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
|
endif
|
||||||
if( ! $?last_color ) then
|
if( ! $?last_color ) then
|
||||||
break
|
break
|
||||||
endif
|
endif
|
||||||
set first_color = ${reference_colors[1]}
|
set first_color = ${reference_colors[1]}
|
||||||
if( ${first_color} != ${last_color} ) then
|
if( ${first_color} == ${last_color} ) then
|
||||||
break
|
set reference_colors=()
|
||||||
|
continue
|
||||||
endif
|
endif
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
while( ${prompt_hsym} == 0 )
|
while( ${#referencechars} == 0 )
|
||||||
_debug symbolshuffle
|
_debug symbolshuffle
|
||||||
#echo
|
#echo
|
||||||
if( $?cshenv_detected_shuf ) then
|
if( $?cshenv_detected_shuf ) then
|
||||||
set referencechars=`shuf -e $referencechars`
|
set referencechars=`shuf -e $referencechars_original`
|
||||||
#set reference_colors=`shuf -e $reference_colors`
|
|
||||||
else
|
else
|
||||||
#echo "FALLBACK CHAR!"
|
#echo "FALLBACK CHAR!"
|
||||||
set referencechars=`echo $referencechars | tr " " "\n" | sort -R | xargs`
|
set referencechars=(`echo $referencechars_original | tr " " "\n" | sort -R | xargs`)
|
||||||
endif
|
endif
|
||||||
if( ! $?last_sym ) then
|
if( ! $?last_sym ) then
|
||||||
break
|
break
|
||||||
endif
|
endif
|
||||||
set first_sym = ${referencechars[1]}
|
set first_sym = ${referencechars[1]}
|
||||||
if( ${first_sym} != ${last_sym} ) then
|
if( ${first_sym} == ${last_sym} ) then
|
||||||
break
|
set referencechars=()
|
||||||
|
continue
|
||||||
endif
|
endif
|
||||||
end
|
end
|
||||||
|
|
||||||
@ prompt_hcolor = ${prompt_hcolor} + 1
|
|
||||||
@ prompt_hsym = ${prompt_hsym} + 1
|
|
||||||
|
|
||||||
if( $?CSHENV_DEBUG ) then
|
if( $?CSHENV_DEBUG ) then
|
||||||
_debug ${prompt_hcolor} ${prompt_hsym}
|
_debug ${reference_colors[1]} ${referencechars[1]}
|
||||||
_debug "Setting prompt"
|
_debug "Setting prompt"
|
||||||
endif
|
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
|
#if( ${referencechars[${prompt_hsym}]} == `env LC_ALL=C.UTF-8 printf "\u2328"` ) then
|
||||||
# set prompt_reference="%{${dim}%}<${prompt_reference_core} %{${dim}%}> "
|
# set prompt_reference="%{${dim}%}<${prompt_reference_core} %{${dim}%}> "
|
||||||
#else
|
#else
|
||||||
|
|||||||
Reference in New Issue
Block a user