Allow pasting words

This commit is contained in:
M66B 2021-05-23 20:07:10 +02:00
parent 5039a68ac6
commit 9f1e835759
1 changed files with 5 additions and 3 deletions

View File

@ -1571,7 +1571,7 @@ public class HtmlHelper {
return formatPre(text, true); return formatPre(text, true);
} }
static String formatPre(String text, boolean quote) { static String formatPre(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.split("\\r?\\n");
@ -1581,7 +1581,7 @@ public class HtmlHelper {
// Opening quotes // Opening quotes
// https://tools.ietf.org/html/rfc3676#section-4.5 // https://tools.ietf.org/html/rfc3676#section-4.5
if (quote) { if (view) {
int tlevel = 0; int tlevel = 0;
while (line.startsWith(">")) { while (line.startsWith(">")) {
tlevel++; tlevel++;
@ -1621,7 +1621,9 @@ public class HtmlHelper {
line = Html.escapeHtml(line); line = Html.escapeHtml(line);
sb.append(line); sb.append(line);
sb.append("<br>"); if (view ||
(l + 1 == lines.length && text.endsWith("\n")))
sb.append("<br>");
} }
// Closing quotes // Closing quotes