From 93153525e850df5cf61579c5f3db19385f429879 Mon Sep 17 00:00:00 2001 From: ADAM David Alan Martin Date: Wed, 8 Jul 2026 00:30:16 -0400 Subject: [PATCH] Prompt sigil update uses `shift`, instead of math --- tcshrc.prompt.final | 49 +++++++++++++++++++++++++-------------------- 1 file changed, 27 insertions(+), 22 deletions(-) diff --git a/tcshrc.prompt.final b/tcshrc.prompt.final index cb66420..3357705 100644 --- a/tcshrc.prompt.final +++ b/tcshrc.prompt.final @@ -62,45 +62,50 @@ _debug "Done with color cacheing loop" _debug "Dynamic color loading processed..." -while( ${#reference_colors} == 0 ) +if( ${#reference_colors} == 0 ) then _debug colorshuffle #echo  # Shuffle, if supported if( $?cshenv_detected_shuf ) then + _debug "PRIMARY COLOR!" set reference_colors=`shuf -e $reference_colors_original` else - #echo "FALLBACK COLOR!" + _debug "FALLBACK COLOR!" 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 - set reference_colors=() - continue - endif -end + if( $?last_color ) then + set first_color = ${reference_colors[1]} + if( ${first_color} == ${last_color} ) then + _debug "COLLISION COLOR!" + # Instead of a reshuffle, we put the collision at the end. + set tmp_color="${reference_colors[1]}" + shift reference_colors + set reference_colors=( ${reference_colors} ${tmp_color} ) + endif + endif +endif -while( ${#referencechars} == 0 ) +if( ${#referencechars} == 0 ) then _debug symbolshuffle #echo  if( $?cshenv_detected_shuf ) then + _debug "PRIMARY CHAR!" set referencechars=`shuf -e $referencechars_original` else - #echo "FALLBACK CHAR!" + _debug "FALLBACK CHAR!" 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 - set referencechars=() - continue - endif -end + if( $?last_sym ) then + set first_sym = ${referencechars[1]} + if( ${first_sym} == ${last_sym} ) then + _debug "COLLISION CHAR!" + set tmp_char="${referencechars[1]}" + shift referencechars + set referencechars=( ${referencechars} ${tmp_char} ) + endif + endif +endif if( $?CSHENV_DEBUG ) then _debug ${reference_colors[1]} ${referencechars[1]}