Merge branch 'master' of https://gitea.nerdland.org/adam/cshenv into master

* 'master' of https://gitea.nerdland.org/adam/cshenv:
  Gracefully handle no unicode in printf
  Probe the local printf for unicode

 Conflicts:
	tcshrc.aliases
This commit is contained in:
2026-02-15 23:00:22 -05:00
3 changed files with 30 additions and 9 deletions
+11
View File
@@ -170,6 +170,17 @@ else
alias p echo "Password store not found!" alias p echo "Password store not found!"
endif endif
# Pick up the coreutils printf, if it exists...
if( -f `which gprintf` ) then
alias printf gprintf
endif
if( ! { printf '\u0000' } ) >&/dev/null then
setenv CSHENV_NO_UNICODE_PRINTF
endif
alias prompt source ${CSHENV_DIR}/tcshrc.prompt.command alias prompt source ${CSHENV_DIR}/tcshrc.prompt.command
safe_source ${CSHENV_DIR}/tcshrc.aliases.${CSHENV_SYSTEM} safe_source ${CSHENV_DIR}/tcshrc.aliases.${CSHENV_SYSTEM}
+8 -3
View File
@@ -99,11 +99,16 @@ set referencechars_raw="${referencechars_raw} 262e"
set prompt_hcolor=0 set prompt_hcolor=0
set prompt_hsym=0 set prompt_hsym=0
set referencechars=() if( ! $?CSHENV_NO_UNICODE_PRINTF ) then
foreach ch ($referencechars_raw) set referencechars=()
foreach ch ($referencechars_raw)
set unicode=`printf "\\u${ch}"` set unicode=`printf "\\u${ch}"`
set referencechars=( $referencechars `printf "${unicode}"` ) set referencechars=( $referencechars `printf "${unicode}"` )
end end
else
# Safe fallback for when there's no unicode printf
set referencechars="A B C D X Y Z"
endif
# Rotation # Rotation
alias precmd 'source ${CSHENV_DIR}/tcshrc.prompt.final' alias precmd 'source ${CSHENV_DIR}/tcshrc.prompt.final'
+5
View File
@@ -278,10 +278,15 @@ if( 0 == ${__res} ) then
#set git_prompt="%{${csi}${branch_indent}C${csi}mBranch: ${csi}3;38;2;255;192;192m${git_branch}${csi}m${csi}${branch_space}C\n%}" #set git_prompt="%{${csi}${branch_indent}C${csi}mBranch: ${csi}3;38;2;255;192;192m${git_branch}${csi}m${csi}${branch_space}C\n%}"
if( ! $?CSHENV_NO_UNICODE_PRINTF ) then
# If the font doesn't support the special branch symbol... # If the font doesn't support the special branch symbol...
set branch_symbol=`printf "\uE0A0"` set branch_symbol=`printf "\uE0A0"`
# I could always fallback to this one... (keep padded spaces... for alignment) # I could always fallback to this one... (keep padded spaces... for alignment)
set branch_symbol=`printf '\u2387\ \ '` set branch_symbol=`printf '\u2387\ \ '`
else
# Non unicode fallback 'X'
set branch_symbol='X'
endif
git rev-list --count --left-right \@\{upstream\}..HEAD>&/dev/null git rev-list --count --left-right \@\{upstream\}..HEAD>&/dev/null
set __res=$? set __res=$?
#echo "Got: ${git_counts}" #echo "Got: ${git_counts}"