From: H.G.Muller Date: Thu, 17 Mar 2016 21:13:28 +0000 (+0100) Subject: Cleanse help texts of some common TeX escape codes X-Git-Url: http://winboard.nl/cgi-bin?a=commitdiff_plain;h=6e119123be4cf0ac4b922318e8855ee9c71743cd;p=xboard.git Cleanse help texts of some common TeX escape codes The TeX escapes \s-1, \s0 around all-capital words, \*(L, \*(R for distinguishing left/right quoting, a mysterious \& and a \ in general (e.g. for \- as forced hyphen) occur quite often in the man-page text. They now no longer clutter the help popups. --- diff --git a/dialogs.c b/dialogs.c index e9a1718..6db9c6e 100644 --- a/dialogs.c +++ b/dialogs.c @@ -2447,6 +2447,7 @@ DisplayTitle (char *text) } char *textPtr; +char *texEscapes[] = { "s-1", "s0", "&", "*(L", "*(R", NULL }; int GetNext(FILE *f) @@ -2485,6 +2486,18 @@ GetHelpText (FILE *f, char *name) *p++ = ' '; cnt++; while(*line) { if(*line < ' ') { line++; continue;} + if(*line == '\\') { + char **esc; + line++; + for(esc = texEscapes; *esc; esc++) { + len = strlen(*esc); + if(!strncmp(*esc, line, len)) { + line += len; + break; + } + } + continue; + } if(*line == ' ' && p - q > 80) *line = '\n', q = p; *p++ = *line++; }