Replace single CR by LF

This commit is contained in:
M66B 2022-01-09 19:09:55 +01:00
parent 0f4bfbfc04
commit 3c9b00daa8
4 changed files with 9 additions and 12 deletions

View File

@ -33,7 +33,6 @@ import android.os.Parcelable;
import android.text.Html;
import android.text.SpannableStringBuilder;
import android.text.Spanned;
import android.text.style.ImageSpan;
import android.text.style.QuoteSpan;
import android.text.style.StyleSpan;
import android.util.AttributeSet;
@ -228,7 +227,7 @@ public class EditTextCompose extends FixedEditText {
if (raw)
html = text.toString();
else
html = "<div>" + HtmlHelper.formatPre(text.toString(), false) + "</div>";
html = "<div>" + HtmlHelper.formatPlainText(text.toString(), false) + "</div>";
} else
html = h;

View File

@ -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 android.animation.ObjectAnimator;
import android.animation.ValueAnimator;
import android.app.Activity;
import android.app.Dialog;
import android.app.NotificationManager;
@ -184,7 +183,6 @@ import org.openintents.openpgp.AutocryptPeerUpdate;
import org.openintents.openpgp.OpenPgpError;
import org.openintents.openpgp.OpenPgpSignatureResult;
import org.openintents.openpgp.util.OpenPgpApi;
import org.openintents.openpgp.util.OpenPgpServiceConnection;
import java.io.ByteArrayInputStream;
import java.io.File;
@ -240,7 +238,6 @@ import javax.mail.MessageRemovedException;
import javax.mail.MessagingException;
import javax.mail.Part;
import javax.mail.Session;
import javax.mail.internet.AddressException;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeMessage;
@ -7248,7 +7245,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
// Write decrypted body
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);
db.message().setMessageStored(message.id, new Date().getTime());
db.message().setMessageFts(message.id, false);

View File

@ -1880,14 +1880,16 @@ public class HtmlHelper {
return flowed.toString();
}
static String formatPre(String text) {
return formatPre(text, true);
static String formatPlainText(String text) {
return formatPlainText(text, true);
}
static String formatPre(String text, boolean view) {
static String formatPlainText(String text, boolean view) {
int level = 0;
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++) {
String line = lines[l];
lines[l] = null;

View File

@ -24,7 +24,6 @@ import static android.system.OsConstants.ENOSPC;
import android.content.Context;
import android.content.SharedPreferences;
import android.net.Uri;
import android.os.SystemClock;
import android.system.ErrnoException;
import android.text.TextUtils;
@ -2834,7 +2833,7 @@ public class MessageHelper {
result.substring(e - HTML_END.length(), e).equalsIgnoreCase(HTML_END))
return result;
result = "<div x-plain=\"true\">" + HtmlHelper.formatPre(result) + "</div>";
result = "<div x-plain=\"true\">" + HtmlHelper.formatPlainText(result) + "</div>";
} else if (h.isHtml()) {
// Conditionally upgrade to UTF8
if ((cs == null ||