[vte] Bug 572230 – text mode program rendering is strange in cjk locale.



commit 3eaca3e36fb806608c961ef594baf99cecf9fdfa
Author: Behdad Esfahbod <behdad behdad org>
Date:   Wed Aug 5 21:26:05 2009 -0400

    Bug 572230 â?? text mode program rendering is strange in cjk locale.
    
    Under UTF-8 encoding, always use width=1 for ambiguous-width chars,
    only allow override using VTE_CJK_WIDTH=1.  Preivously we were using
    width=2 for CJKS locales.  That's against Unicode recommendations,
    and breaks a bunch of programs.

 src/iso2022.c |   36 +-----------------------------------
 1 files changed, 1 insertions(+), 35 deletions(-)
---
diff --git a/src/iso2022.c b/src/iso2022.c
index d727cb4..27dc2c9 100644
--- a/src/iso2022.c
+++ b/src/iso2022.c
@@ -284,36 +284,6 @@ _vte_direct_compare(gconstpointer a, gconstpointer b)
 	return GPOINTER_TO_INT(a) - GPOINTER_TO_INT(b);
 }
 
-/* If we only have a codepoint, guess what the ambiguous width should be based
- * on the default region.  Just hope we don't do this too often. */
-static int
-_vte_iso2022_ambiguous_width_guess(void)
-{
-	static int guess;
-	if (G_UNLIKELY (guess == 0)) {
-		const char *lang = NULL;
-		guess = 1;
-		if (lang == NULL)
-			lang = g_getenv("LC_ALL");
-		if (lang == NULL)
-			lang = g_getenv("LC_CTYPE");
-		if (lang == NULL)
-			lang = g_getenv("LANG");
-		if (lang) {
-			if (g_ascii_strncasecmp(lang, "ja", 2) == 0 ||
-			    g_ascii_strncasecmp(lang, "ko", 2) == 0 ||
-			    g_ascii_strncasecmp(lang, "vi", 2) == 0 ||
-			    g_ascii_strncasecmp(lang, "zh", 2) == 0) {
-				guess = 2;
-			}
-		}
-		_vte_debug_print(VTE_DEBUG_SUBSTITUTION,
-				"Ambiguous characters will have width = %d.\n",
-				guess);
-	}
-	return guess;
-}
-
 /* If we have the encoding, decide how wide an ambiguously-wide character is
  * based on the encoding.  This is basically what GNU libc does, and it agrees
  * with my reading of Unicode UAX 11, so.... */
@@ -360,17 +330,13 @@ _vte_iso2022_ambiguous_width(struct _vte_iso2022_state *state)
 	}
 
 	/*
-	 * Decide the ambiguous width according to the default region if 
+	 * Decide the ambiguous width according to user preference if
 	 * current locale is UTF-8.
 	 */
 	if (strcmp (codeset, "utf8") == 0) {
 	  const char *env = g_getenv ("VTE_CJK_WIDTH");
-	  if (env && (g_ascii_strcasecmp (env, "narrow")==0 || g_ascii_strcasecmp (env, "0")==0))
-	    return 1;
 	  if (env && (g_ascii_strcasecmp (env, "wide")==0 || g_ascii_strcasecmp (env, "1")==0))
 	    return 2;
-	  else
-	    return _vte_iso2022_ambiguous_width_guess ();
 	}
 
 	/* Not in the list => not wide. */



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]