Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: PATCH: prompt adam2 does not check for all spellings of language files




On Fri, Jun 13, 2025 at 1:46 AM Jim <linux.tech.guy@xxxxxxxxx> wrote:

Following the example in "prompt_special_chars" I'm submitting the attached
patch that checks for the additional spelling.


As an afterthought, why not make the spelling check case insensitive? That would
eliminate having to make any future changes if different case spellings were to be
used for "utf". As an alternative to my previous patch, I offer the following attached
patch. This changes both prompt_adam2_setup and prompt_special_chars.

Regards,

Jim Murphy  
diff --git a/Functions/Prompts/prompt_adam2_setup b/Functions/Prompts/prompt_adam2_setup
index b9445116b..41bf56fa1 100644
--- a/Functions/Prompts/prompt_adam2_setup
+++ b/Functions/Prompts/prompt_adam2_setup
@@ -25,7 +25,7 @@ prompt_adam2_setup () {
 
   if [[ $1 == '8bit' ]]; then
     shift
-    if [[ ${LC_ALL:-${LC_CTYPE:-$LANG}} = *UTF-8* ]]; then
+    if [[ ${${LC_ALL:-${LC_CTYPE:-$LANG}}:u} = *(UTF-8|UTF8)* ]]; then
       prompt_gfx_tlc=$'\xe2\x94\x8c'
       prompt_gfx_mlc=$'\xe2\x94\x9c'
       prompt_gfx_blc=$'\xe2\x94\x94'
diff --git a/Functions/Prompts/prompt_special_chars b/Functions/Prompts/prompt_special_chars
index 82a1f2d96..0586f69d7 100644
--- a/Functions/Prompts/prompt_special_chars
+++ b/Functions/Prompts/prompt_special_chars
@@ -8,7 +8,7 @@
 
 typeset -gA schars
 
-if [[ ${LC_ALL:-${LC_CTYPE:-$LANG}} = *(UTF-8|utf8)* ]]; then
+if [[ ${${LC_ALL:-${LC_CTYPE:-$LANG}}:u} = *(UTF-8|UTF8)* ]]; then
   schars[300]=$'\xe2\x94\x94'
   schars[304]=$'\xe2\x94\x8c'
   schars[332]=$'\xe2\x94\x8c'


Messages sorted by: Reverse Date, Date, Thread, Author