Skip to content

Commit 0341998

Browse files
committed
Fix text editor prepending ascii 10
1 parent fe536e8 commit 0341998

1 file changed

Lines changed: 12 additions & 8 deletions

File tree

Source/Pd/Instance.cpp

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -512,13 +512,15 @@ void Instance::initialisePd(String& pdlua_version)
512512
pd_typedmess(reinterpret_cast<t_pd*>(ptr), gensym("clear"), 0, nullptr);
513513

514514
// remove repeating spaces
515-
text = text.replace("\r ", "\r");
516-
text = text.replace(";\r", ";");
517-
text = text.replace("\r;", ";");
515+
text = text.replace("\r\n", "\n");
516+
text = text.replace("\r", "\n");
517+
text = text.replace("\n ", "\n");
518+
text = text.replace(";\n", ";");
519+
text = text.replace("\n;", ";");
518520
text = text.replace(" ;", ";");
519521
text = text.replace("; ", ";");
520522
text = text.replace(",", " , ");
521-
text = text.replaceCharacters("\r", " ");
523+
text = text.replaceCharacters("\n", " ");
522524

523525
while (text.contains(" ")) {
524526
text = text.replace(" ", " ");
@@ -598,13 +600,15 @@ void Instance::initialisePd(String& pdlua_version)
598600
pd_typedmess(reinterpret_cast<t_pd*>(ptr), gensym("clear"), 0, nullptr);
599601

600602
// remove repeating spaces
601-
text = text.replace("\r ", "\r");
602-
text = text.replace(";\r", ";");
603-
text = text.replace("\r;", ";");
603+
text = text.replace("\r\n", "\n");
604+
text = text.replace("\r", "\n");
605+
text = text.replace("\n ", "\n");
606+
text = text.replace(";\n", ";");
607+
text = text.replace("\n;", ";");
604608
text = text.replace(" ;", ";");
605609
text = text.replace("; ", ";");
606610
text = text.replace(",", " , ");
607-
text = text.replaceCharacters("\r", " ");
611+
text = text.replaceCharacters("\n", " ");
608612

609613
while (text.contains(" ")) {
610614
text = text.replace(" ", " ");

0 commit comments

Comments
 (0)