summaryrefslogtreecommitdiffstats
path: root/generic/tkEntry.c
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2016-09-16 07:49:21 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2016-09-16 07:49:21 (GMT)
commit3c2139408891a7cf7678b88d372ac122aa79f65d (patch)
tree0c7c6348e421d05be040ec77ef8a7200c85c391d /generic/tkEntry.c
parent97a56e265e68f569c3e39c1e3c7f07d6c395f45f (diff)
downloadtk-3c2139408891a7cf7678b88d372ac122aa79f65d.zip
tk-3c2139408891a7cf7678b88d372ac122aa79f65d.tar.gz
tk-3c2139408891a7cf7678b88d372ac122aa79f65d.tar.bz2
Patch from Christian Werner, for evaluation
Diffstat (limited to 'generic/tkEntry.c')
-rw-r--r--generic/tkEntry.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/generic/tkEntry.c b/generic/tkEntry.c
index a66cf18..5faf4ef 100644
--- a/generic/tkEntry.c
+++ b/generic/tkEntry.c
@@ -1926,7 +1926,6 @@ EntryComputeGeometry(
*/
if (entryPtr->showChar != NULL) {
- Tcl_UniChar ch;
char buf[4];
int size;
@@ -1936,8 +1935,15 @@ EntryComputeGeometry(
* characters might end up looking like one valid UTF character in the
* resulting string.
*/
+#if TCL_UTF_MAX == 4
+ int ch;
+
+ TkUtfToUniChar32(entryPtr->showChar, &ch);
+#else
+ Tcl_UniChar ch;
Tcl_UtfToUniChar(entryPtr->showChar, &ch);
+#endif
size = Tcl_UniCharToUtf(ch, buf);
entryPtr->numDisplayBytes = entryPtr->numChars * size;
@@ -3414,7 +3420,11 @@ ExpandPercents(
* list element. */
int number, length;
register const char *string;
+#if TCL_UTF_MAX == 4
+ int ch;
+#else
Tcl_UniChar ch;
+#endif
char numStorage[2*TCL_INTEGER_SPACE];
while (1) {
@@ -3447,7 +3457,11 @@ ExpandPercents(
before++; /* skip over % */
if (*before != '\0') {
+#if TCL_UTF_MAX == 4
+ before += TkUtfToUniChar32(before, &ch);
+#else
before += Tcl_UtfToUniChar(before, &ch);
+#endif
} else {
ch = '%';
}