summaryrefslogtreecommitdiffstats
path: root/win/tkWinMenu.c
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2020-05-14 19:11:57 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2020-05-14 19:11:57 (GMT)
commit6fa16c680c6af311355e3c43f9123007c5fa565b (patch)
tree5bc839e36bb43119086558688dba279495a8d4f3 /win/tkWinMenu.c
parent62a467f50761835b22b455d6ff0105b2e4bbe4dd (diff)
parentfe4022603129271b3e6e9f98136265c7982938dc (diff)
downloadtk-6fa16c680c6af311355e3c43f9123007c5fa565b.zip
tk-6fa16c680c6af311355e3c43f9123007c5fa565b.tar.gz
tk-6fa16c680c6af311355e3c43f9123007c5fa565b.tar.bz2
More improvements handling characters > U+FFFF as surrogates. Add internal TkUtfPrev(), which handles jumping back over surrogate pairs.
Diffstat (limited to 'win/tkWinMenu.c')
-rw-r--r--win/tkWinMenu.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/win/tkWinMenu.c b/win/tkWinMenu.c
index daf32ec..8bcc826 100644
--- a/win/tkWinMenu.c
+++ b/win/tkWinMenu.c
@@ -511,6 +511,7 @@ GetEntryText(
: Tcl_GetString(mePtr->accelPtr);
const char *p, *next;
Tcl_DString itemString;
+ int ch;
/*
* We have to construct the string with an ampersand preceeding the
@@ -527,7 +528,7 @@ GetEntryText(
if (*p == '&') {
Tcl_DStringAppend(&itemString, "&", 1);
}
- next = Tcl_UtfNext(p);
+ next = p + TkUtfToUniChar(p, &ch);
Tcl_DStringAppend(&itemString, p, (int) (next - p));
}
if (mePtr->accelLength > 0) {
@@ -536,7 +537,7 @@ GetEntryText(
if (*p == '&') {
Tcl_DStringAppend(&itemString, "&", 1);
}
- next = Tcl_UtfNext(p);
+ next = p + TkUtfToUniChar(p, &ch);
Tcl_DStringAppend(&itemString, p, (int) (next - p));
}
}
@@ -2134,10 +2135,11 @@ DrawMenuUnderline(
len = Tcl_GetCharLength(mePtr->labelPtr);
if (mePtr->underline < len) {
const char *label, *start, *end;
+ int ch;
label = Tcl_GetString(mePtr->labelPtr);
start = Tcl_UtfAtIndex(label, mePtr->underline);
- end = Tcl_UtfNext(start);
+ end = start + TkUtfToUniChar(start, &ch);
Tk_UnderlineChars(menuPtr->display, d,
gc, tkfont, label, x + mePtr->indicatorSpace,
y + (height + fmPtr->ascent - fmPtr->descent) / 2,