agnoster: Protect Unicode esape sequences with local LC_* settings

This commit is contained in:
Andrew Janke 2015-07-03 01:44:47 -04:00
parent 4cd281ba1b
commit c82deedc97

View File

@ -32,6 +32,8 @@ CURRENT_BG='NONE'
# Special Powerline characters # Special Powerline characters
() {
local LC_ALL="" LC_CTYPE="en_US.UTF-8"
# NOTE: This segment separator character is correct. In 2012, Powerline changed # NOTE: This segment separator character is correct. In 2012, Powerline changed
# the code points they use for their special characters. This is the new code point. # the code points they use for their special characters. This is the new code point.
# If this is not working for you, you probably have an old version of the # If this is not working for you, you probably have an old version of the
@ -41,8 +43,8 @@ CURRENT_BG='NONE'
# This is defined using a Unicode escape sequence so it is unambiguously readable, regardless of # This is defined using a Unicode escape sequence so it is unambiguously readable, regardless of
# what font the user is viewing this source code in. Do not replace the # what font the user is viewing this source code in. Do not replace the
# escape sequence with a single literal character. # escape sequence with a single literal character.
SEGMENT_SEPARATOR='\ue0b0' #  SEGMENT_SEPARATOR=$'\ue0b0' # 
}
# Begin a segment # Begin a segment
# Takes two arguments, background and foreground. Both can be omitted, # Takes two arguments, background and foreground. Both can be omitted,
@ -83,7 +85,12 @@ prompt_context() {
# Git: branch/detached head, dirty status # Git: branch/detached head, dirty status
prompt_git() { prompt_git() {
local PL_BRANCH_CHAR='\ue0a0' # 
local PL_BRANCH_CHAR
() {
local LC_ALL="" LC_CTYPE="en_US.UTF-8"
PL_BRANCH_CHAR=$'\ue0a0' # 
}
local ref dirty mode repo_path local ref dirty mode repo_path
repo_path=$(git rev-parse --git-dir 2>/dev/null) repo_path=$(git rev-parse --git-dir 2>/dev/null)