Little more debugging for ZWS

This commit is contained in:
cnaude 2019-02-25 22:01:22 -07:00
parent 015870f3c7
commit c2fd0dded0
2 changed files with 6 additions and 2 deletions

View File

@ -118,7 +118,6 @@ public class IRCMessageQueueWatcher {
"(?i)" + user.getNick(),
Matcher.quoteReplacement(plugin.tokenizer.addZeroWidthSpace(user.getNick()))
);
plugin.logDebug("Adding ZWS to " + user.getNick());
}
}
}

View File

@ -1229,13 +1229,18 @@ public class ChatTokenizer {
public String addZeroWidthSpace(String s) {
if (s.contains("\u200B")) {
plugin.logDebug("Nick already contains ZWS: " + s);
return s;
}
if (s.length() > 1) {
String a = s.substring(0, 1);
String b = s.substring(1);
return a + "\u200B" + b;
String n = a + "\u200B" + b;
plugin.logDebug("Adding ZWS: " + s + " -> " + n);
return n;
}
plugin.logDebug("Nick too short for ZWS: " + s);
return s;
}