aboutsummaryrefslogtreecommitdiff
path: root/src/html.cc
diff options
context:
space:
mode:
authorcorvid <corvid@lavabit.com>2009-08-02 03:59:14 +0000
committercorvid <corvid@lavabit.com>2009-08-02 03:59:14 +0000
commit9208c861e0b2c2772f2291376f5632a4d5de6c02 (patch)
tree35261ff2cc862f8bc77501c8a828bc245a0c09dc /src/html.cc
parent1ee0cb3aca76ca7661f5498ea0a73ff3e71ec569 (diff)
treat ideographic characters (Chinese/Japanese) as words
Diffstat (limited to 'src/html.cc')
-rw-r--r--src/html.cc17
1 files changed, 15 insertions, 2 deletions
diff --git a/src/html.cc b/src/html.cc
index e5dde22f..8e85a0e0 100644
--- a/src/html.cc
+++ b/src/html.cc
@@ -1189,17 +1189,30 @@ static void Html_process_word(DilloHtml *html, char *word, int size)
}
}
for (start = i = 0; Pword[i]; start = i) {
+ int len;
+
if (isspace(Pword[i])) {
while (Pword[++i] && isspace(Pword[i])) ;
Html_process_space(html, Pword + start, i - start);
- } else {
- while (Pword[++i] && !isspace(Pword[i])) ;
+ } else if (a_Utf8_ideographic(Pword+i, Pword_end, &len)) {
+ i += len;
ch = Pword[i];
Pword[i] = '\0';
HT2TB(html)->addText(Pword + start,
html->styleEngine->wordStyle ());
Pword[i] = ch;
html->PrevWasSPC = false;
+ } else {
+ do {
+ i += len;
+ } while (Pword[i] && !isspace(Pword[i]) &&
+ (!a_Utf8_ideographic(Pword+i, Pword_end, &len)));
+ ch = Pword[i];
+ Pword[i] = 0;
+ HT2TB(html)->addText(Pword + start,
+ html->styleEngine->wordStyle ());
+ Pword[i] = ch;
+ html->PrevWasSPC = false;
}
}
if (word != Pword)