Improve specifying custom digraphs.
authorSadrul Habib Chowdhury <sadrul@users.sourceforge.net>
Fri, 15 May 2009 19:57:12 +0000 (15 15:57 -0400)
committerSadrul Habib Chowdhury <sadrul@users.sourceforge.net>
Fri, 15 May 2009 19:57:12 +0000 (15 15:57 -0400)
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

index 8fd2fa7..eb4eeb5 100644 (file)
@@ -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);