4cd281ba1be0d8a2e44f96bdb1f2a98b15f54c47

Author
Andrew Janke <andrew@apjanke.net>
Committer
Andrew Janke <andrew@apjanke.net>
Date

Message

agnoster: Define Powerline chars with escape sequence, and use same character on
all platforms. Add clarifying comments. This makes everything consistent
with the current Powerline-patched fonts definitions.

Diff

 1diff --git a/themes/agnoster.zsh-theme b/themes/agnoster.zsh-theme
 2index 3a0c58b89bdb01a8d665257662350c9c46c0322b..3e454a0a0a76f8b97945d2d27bb1a2d6c549185e 100644
 3--- a/themes/agnoster.zsh-theme
 4+++ b/themes/agnoster.zsh-theme
 5@@ -7,6 +7,9 @@
 6 #
 7 # In order for this theme to render correctly, you will need a
 8 # [Powerline-patched font](https://github.com/Lokaltog/powerline-fonts).
 9+# Make sure you have a recent version: the code points that Powerline
10+# uses changed in 2012, and older versions will display incorrectly,
11+# in confusing ways.
12 #
13 # In addition, I recommend the
14 # [Solarized theme](https://github.com/altercation/solarized/) and, if you're
15@@ -27,12 +30,19 @@
16 
17 CURRENT_BG='NONE'
18 
19-# Fix odd char on mac
20-if [[ `uname` == 'Darwin' ]]; then
21-    SEGMENT_SEPARATOR='\ue0b0'
22-else
23-    SEGMENT_SEPARATOR=''
24-fi
25+# Special Powerline characters
26+
27+# NOTE: This segment separator character is correct.  In 2012, Powerline changed
28+# the code points they use for their special characters. This is the new code point.
29+# If this is not working for you, you probably have an old version of the 
30+# Powerline-patched fonts installed. Download and install the new version.
31+# Do not submit PRs to change this unless you have reviewed the Powerline code point
32+# history and have new information.
33+# This is defined using a Unicode escape sequence so it is unambiguously readable, regardless of
34+# what font the user is viewing this source code in. Do not replace the
35+# escape sequence with a single literal character.
36+SEGMENT_SEPARATOR='\ue0b0' # 
37+
38 
39 # Begin a segment
40 # Takes two arguments, background and foreground. Both can be omitted,
41@@ -73,6 +83,7 @@ prompt_context() {
42 
43 # Git: branch/detached head, dirty status
44 prompt_git() {
45+  local PL_BRANCH_CHAR='\ue0a0'         # 
46   local ref dirty mode repo_path
47   repo_path=$(git rev-parse --git-dir 2>/dev/null)
48 
49@@ -104,7 +115,7 @@ prompt_git() {
50     zstyle ':vcs_info:*' formats ' %u%c'
51     zstyle ':vcs_info:*' actionformats ' %u%c'
52     vcs_info
53-    echo -n "${ref/refs\/heads\// }${vcs_info_msg_0_%% }${mode}"
54+    echo -n "${ref/refs\/heads\//$PL_BRANCH_CHAR }${vcs_info_msg_0_%% }${mode}"
55   fi
56 }
57