From 51fa2400c1b18ea444d443cecc1ce227c4640ed2 Mon Sep 17 00:00:00 2001
From: Janne Koschinski <janne@kuschku.de>
Date: Sat, 14 Oct 2017 03:46:51 +0200
Subject: [PATCH] Improved splitting behaviour for complex regexps

---
 res/js/util/statehandler.js | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/res/js/util/statehandler.js b/res/js/util/statehandler.js
index fff95e2..2304fa5 100644
--- a/res/js/util/statehandler.js
+++ b/res/js/util/statehandler.js
@@ -33,11 +33,24 @@ class StateHandler extends Component {
     }
 
     parse(options = {}) {
+        function split(str, sep, n) {
+            const out = [];
+            let lastIndex = 0;
+            let index;
+            while (n-- > 1 && (index = str.indexOf(sep, lastIndex)) >= 0) {
+                out.push(str.slice(lastIndex, index));
+                lastIndex = index + sep.length;
+            }
+            out.push(str.slice(lastIndex));
+            return out;
+        }
+
         let query = [];
         const words = this.state.split(" ");
         words.forEach((word) => {
-            const parts = word.split(":");
-            if (parts.length === 2 && [
+            const parts = split(word, ":", 2);
+            console.log(parts);
+            if ([
                     "sender",
                     "buffer",
                     "network",
-- 
GitLab