diff options
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | Functions/Prompts/.distfiles | 1 | ||||
-rw-r--r-- | Functions/Prompts/prompt_adam2_setup | 19 | ||||
-rw-r--r-- | Functions/Prompts/prompt_bigfade_setup | 12 | ||||
-rw-r--r-- | Functions/Prompts/prompt_elite2_setup | 11 | ||||
-rw-r--r-- | Functions/Prompts/prompt_elite_setup | 11 | ||||
-rw-r--r-- | Functions/Prompts/prompt_fade_setup | 10 | ||||
-rw-r--r-- | Functions/Prompts/prompt_fire_setup | 11 | ||||
-rw-r--r-- | Functions/Prompts/prompt_special_chars | 18 |
9 files changed, 69 insertions, 31 deletions
diff --git a/ChangeLog b/ChangeLog index 31a212edc..8799d6ffa 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2007-06-14 Peter Stephenson <pws@csr.com> + + * users/11568: Functions/Prompts/.distfiles, + Functions/Prompts/prompt_{adam2,bigfade,elite2,elite,fade,fire}_setup, + Functions/Prompts/prompt_special_chars: allow UTF-8 versions + of certain visually striking but uninformative characters. + 2007-06-14 Clint Adams <clint@zsh.org> * 23561: Completion/Unix/Command/_git: merge in relevant changes diff --git a/Functions/Prompts/.distfiles b/Functions/Prompts/.distfiles index 758c28594..8d2a8f117 100644 --- a/Functions/Prompts/.distfiles +++ b/Functions/Prompts/.distfiles @@ -6,4 +6,5 @@ prompt_bart_setup prompt_fire_setup prompt_zefram_setup prompt_bigfade_setup prompt_off_setup promptinit prompt_elite2_setup prompt_oliver_setup prompt_clint_setup prompt_walters_setup +prompt_special_chars ' diff --git a/Functions/Prompts/prompt_adam2_setup b/Functions/Prompts/prompt_adam2_setup index e36b1475c..612cb8958 100644 --- a/Functions/Prompts/prompt_adam2_setup +++ b/Functions/Prompts/prompt_adam2_setup @@ -10,8 +10,8 @@ where the colors are for the hyphens, current directory, user@host, and user input bits respectively. The default colors are cyan, green, cyan, and white. This theme works best with a dark background. -If you have the `nexus' or `vga' console fonts or similar, you -can specify the `8bit' option to use 8-bit replacements for the +If you have either UTF-8 or the `nexus' or `vga' console fonts or similar, +you can specify the `8bit' option to use 8-bit replacements for the 7-bit characters. And you probably thought adam1 was overkill ... @@ -24,10 +24,17 @@ prompt_adam2_setup () { if [[ $1 == '8bit' ]]; then shift - prompt_gfx_tlc=$'\xda' - prompt_gfx_mlc=$'\xc3' - prompt_gfx_blc=$'\xc0' - prompt_gfx_hyphen=$'\xc4' + if [[ ${LC_ALL:-${LC_CTYPE:-$LANG}} = *UTF-8* ]]; then + prompt_gfx_tlc=$'\xe2\x94\x8c' + prompt_gfx_mlc=$'\xe2\x94\x9c' + prompt_gfx_blc=$'\xe2\x94\x94' + prompt_gfx_hyphen=$'\xe2\x94\x80' + else + prompt_gfx_tlc=$'\xda' + prompt_gfx_mlc=$'\xc3' + prompt_gfx_blc=$'\xc0' + prompt_gfx_hyphen=$'\xc4' + fi else prompt_gfx_tlc='.' prompt_gfx_mlc='|' diff --git a/Functions/Prompts/prompt_bigfade_setup b/Functions/Prompts/prompt_bigfade_setup index 3b73c1e0f..89ae44981 100644 --- a/Functions/Prompts/prompt_bigfade_setup +++ b/Functions/Prompts/prompt_bigfade_setup @@ -14,8 +14,10 @@ date text, and current working directory respectively. The default colors are blue, white, white, and yellow. This theme works best with a dark background. -Recommended fonts for this theme: nexus or vga or similar. If you -don't have any of these, the 8-bit characters will probably look stupid. + +Recommended fonts for this theme: either UTF-8, or nexus or vga or similar. +If you don't have any of these, the 8-bit characters will probably look +stupid. EOH } @@ -25,9 +27,9 @@ prompt_bigfade_setup () { local date=${3:-'white'} local cwd=${4:-'yellow'} - for code in 333 262 261 260; do - local char_$code=$(echo -n "\\0$code") - done + local char_333 char_262 char_261 char_260 + autoload -U prompt_special_chars + prompt_special_chars PS1="%{$bold_color$fg[$fadebar]$bold_color%}$char_333$char_262$char_261$char_260%{$bold_color$fg[$userhost]$bg[$fadebar]%}%n@%m%{$reset_color$fg[$fadebar]$bg[grey]%}$char_260$char_261$char_262$char_333%{$reset_color$fg[$fadebar]$bg[grey]%}$char_333$char_262$char_261$char_260%{$bold_color$fg[$date]$bg[grey]%} %D{%a %b %d} %D{%I:%M:%S%P}$prompt_newline%{$bold_color$fg[$cwd]$bg[grey]%}$PWD>%{$reset_color%} " PS2="%{$bold_color$fg[$fadebar]$bold_color%}$char_333$char_262$char_261$char_260%{$reset_color$fg[$fadebar]$bg[grey]%}$char_260$char_261$char_262$char_333%{$reset_color$fg[$fadebar]$bg[grey]%}$char_333$char_262$char_261$char_260%{$bold_color$bold_color$fg[$fadebar]%}>%{$reset_color%} " diff --git a/Functions/Prompts/prompt_elite2_setup b/Functions/Prompts/prompt_elite2_setup index 41080187b..0c1500a16 100644 --- a/Functions/Prompts/prompt_elite2_setup +++ b/Functions/Prompts/prompt_elite2_setup @@ -11,8 +11,9 @@ This prompt is color-scheme-able. You can invoke it thus: The default colors are both cyan. This theme works best with a dark background. -Recommended fonts for this theme: nexus or vga or similar. If you -don't have any of these, the 8-bit characters will probably look stupid. +Recommended fonts for this theme: either UTF-8, or nexus or vga or similar. +If you don't have any of these, the 8-bit characters will probably look +stupid. EOH } @@ -20,9 +21,9 @@ prompt_elite2_setup () { local text_col=${1:-'cyan'} local parens_col=${2:-$text_col} - for code in 332 304 300; do - local char_$code=$(echo -n "\\0$code") - done + local char_333 char_262 char_261 char_260 + autoload -U prompt_special_chars + prompt_special_chars local text="%{$fg_no_bold[$text_col]%}" local parens="%{$fg_bold[$parens_col]%}" diff --git a/Functions/Prompts/prompt_elite_setup b/Functions/Prompts/prompt_elite_setup index 53216c52a..89e9bffdf 100644 --- a/Functions/Prompts/prompt_elite_setup +++ b/Functions/Prompts/prompt_elite_setup @@ -11,8 +11,9 @@ This prompt is color-scheme-able. You can invoke it thus: The default colors are red and blue respectively. This theme is intended for use with a black background. -Recommended fonts for this theme: nexus or vga or similar. If you -don't have any of these, the 8-bit characters will probably look stupid. +Recommended fonts for this theme: either UTF-8, or nexus or vga or similar. +If you don't have any of these, the 8-bit characters will probably look +stupid. EOH } @@ -20,9 +21,9 @@ prompt_elite_setup () { local text=${1:-'red'} local punctuation=${2:-'blue'} - for code in 332 304 371 372 300; do - local char_$code=$(echo -n "\\0$code") - done + local char_333 char_262 char_261 char_260 + autoload -U prompt_special_chars + prompt_special_chars PS1="%{$fg[$text]%}$char_332$char_304%{$fg[$punctuation]%}(%{$fg[$text]%}%n%{$fg[$punctuation]%}@%{$fg[$text]%}%m%{$fg[$punctuation]%})%{$fg[$text]%}-%{$fg[$punctuation]%}(%{$fg[$text]%}%D{%I:%M%P}%{$fg[$punctuation]%}-:-%{$fg[$text]%}%D{%m}%{$fg[$punctuation]$fg[$text]%}/%D{%d}%{$fg[$punctuation]%})%{$fg[$text]%}$char_304-%{$fg[$punctuation]]%}$char_371%{$fg[$text]%}-$char_371$char_371%{$fg[$punctuation]%}$char_372$prompt_newline%{$fg[$text]%}$char_300$char_304%{$fg[$punctuation]%}(%{$fg[$text]%}%1~%{$fg[$punctuation]%})%{$fg[$text]%}$char_304$char_371%{$fg[$punctuation]%}$char_372%{$reset_color%}" PS2="> " diff --git a/Functions/Prompts/prompt_fade_setup b/Functions/Prompts/prompt_fade_setup index ab908e41e..10b27f164 100644 --- a/Functions/Prompts/prompt_fade_setup +++ b/Functions/Prompts/prompt_fade_setup @@ -14,8 +14,8 @@ working directory, user@host text, and date text respectively. The default colors are green, white, and white. This theme works best with a dark background. -Recommended fonts for this theme: nexus or vga or similar. If you -don't have any of these, the 8-bit characters will probably look +Recommended fonts for this theme: either UTF-8, or nexus or vga or similar. +If you don't have any of these, the 8-bit characters will probably look stupid. EOH } @@ -27,9 +27,9 @@ prompt_fade_setup () { local userhost=${2:-'white'} local date=${3:-'white'} - for code in 333 262 261 260; do - local char_$code=$(echo -n "\\0$code") - done + local char_333 char_262 char_261 char_260 + autoload -U prompt_special_chars + prompt_special_chars PS1="%{$fg[$fadebar_cwd]$bg[$fadebar_cwd]$bold_color%}$char_333$char_262$char_261$char_260%{$fg[$userhost]$bg[$fadebar_cwd]$bold_color%}%n@%m%{$reset_color$fg[$fadebar_cwd]$bg[grey]%}$char_333$char_262$char_261$char_260%{$fg[$date]$bg[grey]$bold_color%} %D{%a %b %d} %D{%I:%M:%S%P} $prompt_newline%{$fg[$fadebar_cwd]$bg[grey]$bold_color%}%~/%{$reset_color%} " PS2="%{$fg[$fadebar_cwd]$bg[grey]%}$char_333$char_262$char_261$char_260%{$reset_color%}>" diff --git a/Functions/Prompts/prompt_fire_setup b/Functions/Prompts/prompt_fire_setup index 34676d159..039e41e4a 100644 --- a/Functions/Prompts/prompt_fire_setup +++ b/Functions/Prompts/prompt_fire_setup @@ -15,8 +15,9 @@ user@host text, date text, and current working directory respectively. The default colors are yellow, yellow, red, white, white, and yellow. This theme works best with a dark background. -Recommended fonts for this theme: nexus or vga or similar. If you -don't have any of these, the 8-bit characters will probably look stupid. +Recommended fonts for this theme: either UTF-8, or nexus or vga or similar. +If you don't have any of these, the 8-bit characters will probably look +stupid. EOH } @@ -28,9 +29,9 @@ prompt_fire_setup () { local date=${5:-'white'} local cwd=${6:-'yellow'} - for code in 333 262 261 260; do - local char_$code=$(echo -n "\\0$code") - done + local char_333 char_262 char_261 char_260 + autoload -U prompt_special_chars + prompt_special_chars local GRAD1="%{$char_333$char_262$char_261$char_260%}" local GRAD2="%{$char_260$char_261$char_262$char_333%}" diff --git a/Functions/Prompts/prompt_special_chars b/Functions/Prompts/prompt_special_chars new file mode 100644 index 000000000..8be7dc1cf --- /dev/null +++ b/Functions/Prompts/prompt_special_chars @@ -0,0 +1,18 @@ +# Utility function to set up some special characters +# used by prompts. +# +# These used to be defined to characters found in particular +# character sets (e.g. IBM852) which now aren't widely used. +# We still provide them in that form if the current character +# set isn't UTF-8. We could in principle use iconv if available. + +if [[ ${LC_ALL:-${LC_CTYPE:-$LANG}} = *UTF-8* ]]; then + char_333=$'\xe2\x96\x88' + char_262=$'\xe2\x96\x93' + char_261=$'\xe2\x96\x92' + char_260=$'\xe2\x96\x91' +else + for code in 333 262 261 260; do + char_$code=$(echo -n "\\0$code") + done +fi |