diff options
author | Johannes Hofmann <Johannes.Hofmann@gmx.de> | 2009-01-26 21:01:21 +0100 |
---|---|---|
committer | Johannes Hofmann <Johannes.Hofmann@gmx.de> | 2009-01-26 21:01:21 +0100 |
commit | 954f1b5dea7b6dbdf8208b0ce6576228d121656c (patch) | |
tree | f00659e3a768d3391ec93fe353effb100e352c0c | |
parent | 7c77d3deb9349a9a92526620670e666b6200d6de (diff) | |
parent | 6f5ae101392241af40ad8081bc59050c8db1800a (diff) |
merge
-rw-r--r-- | src/html.cc | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/src/html.cc b/src/html.cc index 35648634..a371c621 100644 --- a/src/html.cc +++ b/src/html.cc @@ -1149,7 +1149,8 @@ static void Html_process_word(DilloHtml *html, const char *word, int size) while (Pword[++i] && !isspace(Pword[i])) ; ch = Pword[i]; Pword[i] = 0; - DW2TB(html->dw)->addText(Pword, html->styleEngine->wordStyle ()); + DW2TB(html->dw)->addText(Pword + start, + html->styleEngine->wordStyle ()); Pword[i] = ch; html->pre_column += i - start; html->PreFirstChar = false; @@ -1163,10 +1164,15 @@ static void Html_process_word(DilloHtml *html, const char *word, int size) } else { /* Collapse white-space entities inside the word (except ) */ Pword = a_Html_parse_entities(html, word, size); - for (i = 0; Pword[i]; ++i) - if (strchr("\t\f\n\r", Pword[i])) - for (j = i; (Pword[j] = Pword[j+1]); ++j) ; - + /* Collapse adjacent "\t\f\n\r" characters into a single space */ + for (i = j = 0; (Pword[i] = Pword[j]); ++i, ++j) { + if (strchr("\t\f\n\r", Pword[i])) { + if (i == 0 || (i > 0 && Pword[i-1] != ' ')) + Pword[i] = ' '; + else + for (--i; strchr("\t\f\n\r", Pword[j+1]); ++j) ; + } + } DW2TB(html->dw)->addText(Pword, html->styleEngine->wordStyle ()); dFree(Pword); } |