From fb17e06606cc8a8e9615d5155843203ef81d06c3 Mon Sep 17 00:00:00 2001 From: Ali Gholami Rudi Date: Sat, 24 Sep 2016 23:18:10 +0330 Subject: [PATCH] hyph: match hyphenation exceptions when prefixed with punctuations Suggested and tested by aksr . --- hyph.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/hyph.c b/hyph.c index 8670992..4d5e1f1 100644 --- a/hyph.c +++ b/hyph.c @@ -90,15 +90,18 @@ static int hw_lookup(char *word, char *hyph) 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; } -- 2.11.4.GIT