From 9cdf8e20a271dea2c86d571d8ed457ecebbac14c Mon Sep 17 00:00:00 2001 From: Sadrul Habib Chowdhury Date: Fri, 15 May 2009 15:57:12 -0400 Subject: [PATCH] Improve specifying custom digraphs. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit With this change, instead of using the unicode value to create a custom digraph, it will be possible to use the unicode character itself. For example, digraph >= ≥ instead of digraph >= U+2265 --- src/process.c | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/src/process.c b/src/process.c index 8fd2fa7..eb4eeb5 100644 --- a/src/process.c +++ b/src/process.c @@ -3694,7 +3694,32 @@ int key; digraphs[i].d[0] = args[0][0]; digraphs[i].d[1] = args[0][1]; if (!parse_input_int(args[1], argl[1], &digraphs[i].value)) - digraphs[i].value = atoi(args[1]); + { + if (!(digraphs[i].value = atoi(args[1]))) + { + if (!args[1][1]) + digraphs[i].value = (int)args[1][0]; +#ifdef UTF8 + else + { + int t; + unsigned char *s = args[1]; + digraphs[i].value = 0; + while (*s) + { + t = FromUtf8(*s++, &digraphs[i].value); + if (t == -1) + continue; + if (t == -2) + digraphs[i].value = 0; + else + digraphs[i].value = t; + break; + } + } +#endif + } + } break; } Input("Enter digraph: ", 10, INP_EVERY, digraph_fn, NULL, 0); -- 2.11.4.GIT