From: H.G.Muller Date: Fri, 6 Feb 2015 12:01:44 +0000 (+0100) Subject: Take heed of mnemonic indicator when clipping menu texts X-Git-Url: http://winboard.nl/cgi-bin?p=xboard.git;a=commitdiff_plain;h=c10e83b937328313e82070f5714eea0337758a1e Take heed of mnemonic indicator when clipping menu texts An underscore in the menu text should not be counted when deciding where to clip the text to make the menu bar fit the window width. If clipping would occur immediately after an underscore, just clip off the first character to get the mnemonic back in view. (This makes _n from the Engine menu.) --- diff --git a/gtk/xoptions.c b/gtk/xoptions.c index 8c5bd26..48da90b 100644 --- a/gtk/xoptions.c +++ b/gtk/xoptions.c @@ -1568,7 +1568,11 @@ if(appData.debugMode) printf("n=%d, h=%d, w=%d\n",n,height,width); top--; msg = _(option[i].name); // write name on the menu button #ifndef OSXAPP - if(tinyLayout) { strcpy(def, msg); def[tinyLayout] = NULLCHAR; msg = def; } // clip menu text to keep menu bar small + if(tinyLayout) { // clip menu text to keep menu bar small + int clip = tinyLayout + 1; + strcpy(def, msg + (msg[clip-1] == '_')); + def[clip] = NULLCHAR; msg = def; + } #endif // XtSetArg(args[j], XtNmenuName, XtNewString(option[i].name)); j++; // XtSetArg(args[j], XtNlabel, msg); j++;