1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-11-27 11:42:16 -05:00

Fix to preserve spaces

This commit is contained in:
Koji Arai 2013-05-09 23:08:11 +09:00
parent 3c83f7354e
commit 6c4461cd13

View File

@ -218,6 +218,22 @@ public class HtmlConverter {
try {
int c;
while ((c = reader.read()) != -1) {
switch (c) {
case '\n':
case '&':
case '<':
case '\r':
if (isStartOfLine) {
while (spaces-- > 0) {
buff.append(' ');
}
}
else {
spaces = 0;
}
break;
}
switch (c) {
case '\n':
// pine treats <br> as two newlines, but <br/> as one newline. Use <br/> so our messages aren't
@ -225,14 +241,11 @@ public class HtmlConverter {
buff.append(HTML_NEWLINE);
isStartOfLine = true;
quotesThisLine = 0;
spaces = 0;
break;
case '&':
spaces = 0;
buff.append("&amp;");
break;
case '<':
spaces = 0;
buff.append("&lt;");
break;
case '>':
@ -248,12 +261,9 @@ public class HtmlConverter {
}
break;
case '\r':
spaces = 0;
break;
case ' ':
if (isStartOfLine) {
// If we're still in the start of the line and we have spaces, don't output them, since they
// may be collapsed by our div-converting magic.
spaces++;
}
else {