1
0
mirror of https://github.com/termux/termux-app synced 2024-06-18 07:07:08 +00:00

Replace CRLF with CR as well.

This should replace both \r\n and \n with \r now.

"\r?\n" matches 0 or 1 \r and one \n, which should capture both
escape sequences.
This commit is contained in:
easyaspi314 (Devin) 2018-06-12 23:49:51 -04:00 committed by Fredrik Fornwall
parent be6a73d862
commit ec1087d56f

View File

@ -2338,8 +2338,8 @@ public final class TerminalEmulator {
public void paste(String text) {
// First: Always remove escape key and C1 control characters [0x80,0x9F]:
text = text.replaceAll("(\u001B|[\u0080-\u009F])", "");
// Second: Replace all newlines (\n) with carriage returns (\r).
text = text.replace('\n', '\r');
// Second: Replace all newlines (\n) or CRLF (\r\n) with carriage returns (\r).
text = text.replaceAll("\r?\n", "\r");
// Then: Implement bracketed paste mode if enabled:
boolean bracketed = isDecsetInternalBitSet(DECSET_BIT_BRACKETED_PASTE_MODE);