From 6e119123be4cf0ac4b922318e8855ee9c71743cd Mon Sep 17 00:00:00 2001 From: H.G.Muller Date: Thu, 17 Mar 2016 22:13:28 +0100 Subject: [PATCH] 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. --- dialogs.c | 13 +++++++++++++ 1 files changed, 13 insertions(+), 0 deletions(-) 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++; } -- 1.7.0.4