SCM_CURRENT_USER supports accented characters
`tr 'A-Z' 'a-z'` will only convert non-accented characters. Switching to `[:upper:]` and `[:lower:]` adds support for accents. See https://github.com/koalaman/shellcheck/wiki/SC2018 Additionally, printf's character splitting does not support accented characters, so output isn't as expected. Using bash's variable expansion syntax instead will correctly get the full accented character.
This commit is contained in:
@@ -362,6 +362,11 @@ setup_repo_with_upstream() {
|
||||
git_prompt_vars
|
||||
assert_equal "$SCM_BRANCH" "${pre} ☺︎ cu"
|
||||
|
||||
git config user.name "Çool Üser"
|
||||
|
||||
git_prompt_vars
|
||||
assert_equal "$SCM_BRANCH" "${pre} ☺︎ çü"
|
||||
|
||||
# show initials set by `git pair`
|
||||
|
||||
git config user.initials "ab cd"
|
||||
|
||||
@@ -325,7 +325,7 @@ function git_user_info {
|
||||
# support two or more initials, set by 'git pair' plugin
|
||||
SCM_CURRENT_USER=$(git config user.initials | sed 's% %+%')
|
||||
# if `user.initials` weren't set, attempt to extract initials from `user.name`
|
||||
[[ -z "${SCM_CURRENT_USER}" ]] && SCM_CURRENT_USER=$(printf "%s" $(for word in $(git config user.name | tr 'A-Z' 'a-z'); do printf "%1.1s" $word; done))
|
||||
[[ -z "${SCM_CURRENT_USER}" ]] && SCM_CURRENT_USER=$(printf "%s" $(for word in $(git config user.name | PERLIO=:utf8 perl -pe '$_=lc'); do printf "%s" "${word:0:1}"; done))
|
||||
[[ -n "${SCM_CURRENT_USER}" ]] && printf "%s" "$SCM_THEME_CURRENT_USER_PREFFIX$SCM_CURRENT_USER$SCM_THEME_CURRENT_USER_SUFFIX"
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user