From 695e720c1ca8274f40cfdc72f49a3a516530a811 Mon Sep 17 00:00:00 2001
From: Misa <infoteddyatgitgud@cock.li>
Date: Sun, 27 Sep 2020 15:14:42 -0700
Subject: [PATCH] Prevent typing pipes in the script editor

This prevents users from being confused whenever they type a pipe in the
script editor, then save the level and load it again and see their
script lines unexpectedly splitting in two. Now if you attempt to type a
pipe, it simply won't happen at all.

Fixes #379.
---
 desktop_version/src/editor.cpp | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/desktop_version/src/editor.cpp b/desktop_version/src/editor.cpp
index f965adcd..6ce4c54f 100644
--- a/desktop_version/src/editor.cpp
+++ b/desktop_version/src/editor.cpp
@@ -4186,6 +4186,9 @@ void editorinput()
                 ed.keydelay=6;
             }
 
+            // Remove all pipes, they are the line separator in the XML
+            key.keybuffer.erase(std::remove(key.keybuffer.begin(), key.keybuffer.end(), '|'), key.keybuffer.end());
+
             ed.sb[ed.pagey+ed.sby]=key.keybuffer;
             ed.sbx = utf8::unchecked::distance(ed.sb[ed.pagey+ed.sby].begin(), ed.sb[ed.pagey+ed.sby].end());