From 94252e446dba38b92e26605fe62bd74fbcc6482b Mon Sep 17 00:00:00 2001 From: NorbiPeti Date: Tue, 27 Dec 2016 22:42:21 +0100 Subject: [PATCH] Progressing... Slowly... --- .../buttondevteam/chat/formatting/ChatFormatter.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/main/java/buttondevteam/chat/formatting/ChatFormatter.java b/src/main/java/buttondevteam/chat/formatting/ChatFormatter.java index 37d2196..6c50f77 100644 --- a/src/main/java/buttondevteam/chat/formatting/ChatFormatter.java +++ b/src/main/java/buttondevteam/chat/formatting/ChatFormatter.java @@ -64,7 +64,7 @@ public final class ChatFormatter { else return Integer.compare(s1.Start, s2.Start); }); - List combined = new ArrayList<>(); + ArrayList combined = new ArrayList<>(); Map nextSection = new HashMap<>(); boolean escaped = false; for (int i = 0; i < sections.size(); i++) { @@ -72,14 +72,20 @@ public final class ChatFormatter { final FormattedSection section = sections.get(i); if (!section.IsRange) { escaped = section.Formatters.contains(ChatProcessing.ESCAPE_FORMATTER); + combined.add(section); continue; // TODO: Escape \ and check and fix escape logic - } + } // TODO: Actually combine overlapping sections if (nextSection.containsKey(section.Formatters.get(0)) && !escaped) { FormattedSection s = nextSection.remove(section.Formatters.get(0)); + DebugCommand.SendDebugMessage("Finishing section: " + s); s.End = section.Start; combined.add(s); + } else { + DebugCommand.SendDebugMessage("Adding next section: " + section); + nextSection.put(section.Formatters.get(0), section); } } + sections = combined; for (int i = 0; i < sections.size(); i++) { FormattedSection section = sections.get(i); DebugCommand.SendDebugMessage("Applying section: " + section);