Created
March 23, 2012 02:29
-
-
Save waltarix/2166293 to your computer and use it in GitHub Desktop.
konsole: Fix Ambiguous-width CJK treating problem.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/konsole_wcwidth.cpp b/src/konsole_wcwidth.cpp | |
index 8613632..fcb8076 100644 | |
--- a/src/konsole_wcwidth.cpp | |
+++ b/src/konsole_wcwidth.cpp | |
@@ -35,6 +35,12 @@ static int bisearch(quint16 ucs, const struct interval *table, int max) { | |
} | |
+int konsole_wcwidth(quint16 ucs) | |
+{ | |
+ return konsole_wcwidth_cjk(ucs); | |
+} | |
+ | |
+ | |
/* The following functions define the column width of an ISO 10646 | |
* character as follows: | |
* | |
@@ -65,7 +71,7 @@ static int bisearch(quint16 ucs, const struct interval *table, int max) { | |
* in ISO 10646. | |
*/ | |
-int konsole_wcwidth(quint16 ucs) | |
+int konsole_wcwidth_normal(quint16 ucs) | |
{ | |
/* sorted list of non-overlapping intervals of non-spacing characters */ | |
static const struct interval combining[] = { | |
@@ -132,7 +138,6 @@ int konsole_wcwidth(quint16 ucs) | |
(ucs >= 0x20000 && ucs <= 0x2ffff) */)); | |
} | |
-#if 0 | |
/* | |
* The following function is the same as konsole_wcwidth(), except that | |
* spacing characters in the East Asian Ambiguous (A) category as | |
@@ -203,9 +208,8 @@ int konsole_wcwidth_cjk(quint16 ucs) | |
sizeof(ambiguous) / sizeof(struct interval) - 1)) | |
return 2; | |
- return konsole_wcwidth(ucs); | |
+ return konsole_wcwidth_normal(ucs); | |
} | |
-#endif | |
// single byte char: +1, multi byte char: +2 | |
int string_width( const QString &txt ) | |
diff --git a/src/konsole_wcwidth.h b/src/konsole_wcwidth.h | |
index 6b76d55..2c65409 100644 | |
--- a/src/konsole_wcwidth.h | |
+++ b/src/konsole_wcwidth.h | |
@@ -11,9 +11,8 @@ | |
#include <QtCore/QString> | |
int konsole_wcwidth(quint16 ucs); | |
-#if 0 | |
-int konsole_wcwidth_cjk(Q_UINT16 ucs); | |
-#endif | |
+int konsole_wcwidth_normal(quint16 ucs); | |
+int konsole_wcwidth_cjk(quint16 ucs); | |
int string_width( const QString &txt ); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment