ref: fb17e06606cc8a8e9615d5155843203ef81d06c3
parent: 1c6ab0f6ebf582dd22f9057662e8ac366b7e5c25
author: Ali Gholami Rudi <[email protected]>
date: Sat Sep 24 19:18:10 EDT 2016
hyph: match hyphenation exceptions when prefixed with punctuations Suggested and tested by aksr <[email protected]>.
--- a/hyph.c
+++ b/hyph.c
@@ -90,15 +90,18 @@
char word2[WORDLEN] = {0};
char *hyph2;
int map[WORDLEN] = {0};
+ int off = 0;
int i, j, idx = -1;
hcode_strcpy(word2, word, map, 0);
- i = dict_prefix(hwdict, word2, &idx);
+ while (word2[off] == '.') /* skip unknown characters at the front */
+ off++;
+ i = dict_prefix(hwdict, word2 + off, &idx);
if (i < 0)
return 1;
hyph2 = hwhyph + hwoff[i];
- for (j = 0; word2[j]; j++)
+ for (j = 0; word2[j + off]; j++)
if (hyph2[j])
- hyph[map[j]] = hyph2[j];
+ hyph[map[j + off]] = hyph2[j];
return 0;
}