mirror of https://github.com/M66B/FairEmail.git
Replace single CR by LF
This commit is contained in:
parent
0f4bfbfc04
commit
3c9b00daa8
|
@ -33,7 +33,6 @@ import android.os.Parcelable;
|
||||||
import android.text.Html;
|
import android.text.Html;
|
||||||
import android.text.SpannableStringBuilder;
|
import android.text.SpannableStringBuilder;
|
||||||
import android.text.Spanned;
|
import android.text.Spanned;
|
||||||
import android.text.style.ImageSpan;
|
|
||||||
import android.text.style.QuoteSpan;
|
import android.text.style.QuoteSpan;
|
||||||
import android.text.style.StyleSpan;
|
import android.text.style.StyleSpan;
|
||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
||||||
|
@ -228,7 +227,7 @@ public class EditTextCompose extends FixedEditText {
|
||||||
if (raw)
|
if (raw)
|
||||||
html = text.toString();
|
html = text.toString();
|
||||||
else
|
else
|
||||||
html = "<div>" + HtmlHelper.formatPre(text.toString(), false) + "</div>";
|
html = "<div>" + HtmlHelper.formatPlainText(text.toString(), false) + "</div>";
|
||||||
} else
|
} else
|
||||||
html = h;
|
html = h;
|
||||||
|
|
||||||
|
|
|
@ -35,7 +35,6 @@ import static me.everything.android.ui.overscroll.OverScrollBounceEffectDecorato
|
||||||
import static me.everything.android.ui.overscroll.OverScrollBounceEffectDecoratorBase.DEFAULT_TOUCH_DRAG_MOVE_RATIO_FWD;
|
import static me.everything.android.ui.overscroll.OverScrollBounceEffectDecoratorBase.DEFAULT_TOUCH_DRAG_MOVE_RATIO_FWD;
|
||||||
|
|
||||||
import android.animation.ObjectAnimator;
|
import android.animation.ObjectAnimator;
|
||||||
import android.animation.ValueAnimator;
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.app.Dialog;
|
import android.app.Dialog;
|
||||||
import android.app.NotificationManager;
|
import android.app.NotificationManager;
|
||||||
|
@ -184,7 +183,6 @@ import org.openintents.openpgp.AutocryptPeerUpdate;
|
||||||
import org.openintents.openpgp.OpenPgpError;
|
import org.openintents.openpgp.OpenPgpError;
|
||||||
import org.openintents.openpgp.OpenPgpSignatureResult;
|
import org.openintents.openpgp.OpenPgpSignatureResult;
|
||||||
import org.openintents.openpgp.util.OpenPgpApi;
|
import org.openintents.openpgp.util.OpenPgpApi;
|
||||||
import org.openintents.openpgp.util.OpenPgpServiceConnection;
|
|
||||||
|
|
||||||
import java.io.ByteArrayInputStream;
|
import java.io.ByteArrayInputStream;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
@ -240,7 +238,6 @@ import javax.mail.MessageRemovedException;
|
||||||
import javax.mail.MessagingException;
|
import javax.mail.MessagingException;
|
||||||
import javax.mail.Part;
|
import javax.mail.Part;
|
||||||
import javax.mail.Session;
|
import javax.mail.Session;
|
||||||
import javax.mail.internet.AddressException;
|
|
||||||
import javax.mail.internet.InternetAddress;
|
import javax.mail.internet.InternetAddress;
|
||||||
import javax.mail.internet.MimeMessage;
|
import javax.mail.internet.MimeMessage;
|
||||||
|
|
||||||
|
@ -7248,7 +7245,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
|
||||||
|
|
||||||
// Write decrypted body
|
// Write decrypted body
|
||||||
String text = Helper.readText(plain);
|
String text = Helper.readText(plain);
|
||||||
String html = "<div x-plain=\"true\">" + HtmlHelper.formatPre(text) + "</div>";
|
String html = "<div x-plain=\"true\">" + HtmlHelper.formatPlainText(text) + "</div>";
|
||||||
Helper.writeText(message.getFile(context), html);
|
Helper.writeText(message.getFile(context), html);
|
||||||
db.message().setMessageStored(message.id, new Date().getTime());
|
db.message().setMessageStored(message.id, new Date().getTime());
|
||||||
db.message().setMessageFts(message.id, false);
|
db.message().setMessageFts(message.id, false);
|
||||||
|
|
|
@ -1880,14 +1880,16 @@ public class HtmlHelper {
|
||||||
return flowed.toString();
|
return flowed.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
static String formatPre(String text) {
|
static String formatPlainText(String text) {
|
||||||
return formatPre(text, true);
|
return formatPlainText(text, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
static String formatPre(String text, boolean view) {
|
static String formatPlainText(String text, boolean view) {
|
||||||
int level = 0;
|
int level = 0;
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
String[] lines = text.split("\\r?\\n");
|
String[] lines = text
|
||||||
|
.replaceAll("\\r(?!\\n)", "\n")
|
||||||
|
.split("\\r?\\n");
|
||||||
for (int l = 0; l < lines.length; l++) {
|
for (int l = 0; l < lines.length; l++) {
|
||||||
String line = lines[l];
|
String line = lines[l];
|
||||||
lines[l] = null;
|
lines[l] = null;
|
||||||
|
|
|
@ -24,7 +24,6 @@ import static android.system.OsConstants.ENOSPC;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.SystemClock;
|
|
||||||
import android.system.ErrnoException;
|
import android.system.ErrnoException;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
|
|
||||||
|
@ -2834,7 +2833,7 @@ public class MessageHelper {
|
||||||
result.substring(e - HTML_END.length(), e).equalsIgnoreCase(HTML_END))
|
result.substring(e - HTML_END.length(), e).equalsIgnoreCase(HTML_END))
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
result = "<div x-plain=\"true\">" + HtmlHelper.formatPre(result) + "</div>";
|
result = "<div x-plain=\"true\">" + HtmlHelper.formatPlainText(result) + "</div>";
|
||||||
} else if (h.isHtml()) {
|
} else if (h.isHtml()) {
|
||||||
// Conditionally upgrade to UTF8
|
// Conditionally upgrade to UTF8
|
||||||
if ((cs == null ||
|
if ((cs == null ||
|
||||||
|
|
Loading…
Reference in New Issue