summaryrefslogtreecommitdiffstats
path: root/unix
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2020-06-12 11:50:53 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2020-06-12 11:50:53 (GMT)
commitbdbec5671088fa3f28bd273e5987fc7a7aa5af29 (patch)
treec7b8fd27a7c5f7151157355cf8993e9b7d898c22 /unix
parentb1e5b2f35860988dd0aad0342fdf06272864e30d (diff)
downloadtk-bdbec5671088fa3f28bd273e5987fc7a7aa5af29.zip
tk-bdbec5671088fa3f28bd273e5987fc7a7aa5af29.tar.gz
tk-bdbec5671088fa3f28bd273e5987fc7a7aa5af29.tar.bz2
More progress, implementing enhanced "-underline"
Diffstat (limited to 'unix')
-rw-r--r--unix/tkUnixMenu.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/unix/tkUnixMenu.c b/unix/tkUnixMenu.c
index 7c7ed26..e60c007 100644
--- a/unix/tkUnixMenu.c
+++ b/unix/tkUnixMenu.c
@@ -875,16 +875,16 @@ DrawMenuUnderline(
{
(void)width;
- if ((mePtr->underline >= 0) && (mePtr->labelPtr != NULL)) {
+ if (mePtr->labelPtr != NULL) {
int len;
len = Tcl_GetCharLength(mePtr->labelPtr);
- if (mePtr->underline < len) {
+ if (mePtr->underline < -len || mePtr->underline >= len) {
int activeBorderWidth, leftEdge, ch;
const char *label, *start, *end;
label = Tcl_GetString(mePtr->labelPtr);
- start = Tcl_UtfAtIndex(label, mePtr->underline);
+ start = Tcl_UtfAtIndex(label, (mePtr->underline < 0) ? mePtr->underline + len : mePtr->underline);
end = start + TkUtfToUniChar(start, &ch);
Tk_GetPixelsFromObj(NULL, menuPtr->tkwin,