From d7749d3f57836f4c45d6e0f1a22987dcedffd399 Mon Sep 17 00:00:00 2001 From: rainbow napkin Date: Sun, 17 May 2026 19:21:54 -0400 Subject: [PATCH] Corrected invisible whitespace on chromium-based browsers for line-breaks in long words. --- www/js/channel/chatPostprocessor.js | 4 ++-- www/js/channel/commandPreprocessor.js | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/www/js/channel/chatPostprocessor.js b/www/js/channel/chatPostprocessor.js index a1b7e43..8dd9c31 100644 --- a/www/js/channel/chatPostprocessor.js +++ b/www/js/channel/chatPostprocessor.js @@ -144,7 +144,7 @@ class chatPostprocessor{ //with negative lookaheads to exclude file seperators so we don't split link placeholders, dashes so we dont split usernames and other things, and accented characters to keep those from splitting boundries too //Also split by any invisble whitespace as a crutch to handle mushed links/emotes //If we can one day figure out how to split non-repeating special chars instead of special chars with whitespace, that would be perf, unfortunately my brain hasn't rotted enough to understand regex like that just yet. - const splitString = utils.unescapeEntities(this.rawData.msg).split(/(? { @@ -474,7 +474,7 @@ class chatPostprocessor{ //After eight characters if(charIndex > 8){ //Push an invisible line-break character between every character - wordArray.push("ㅤ"); + wordArray.push("​"); } }); diff --git a/www/js/channel/commandPreprocessor.js b/www/js/channel/commandPreprocessor.js index 1dbc218..efed2ab 100644 --- a/www/js/channel/commandPreprocessor.js +++ b/www/js/channel/commandPreprocessor.js @@ -116,14 +116,14 @@ class commandPreprocessor{ */ processEmotes(){ //inject invisible whitespace in-between emotes to prevent from mushing links together - this.message = this.message.replaceAll('][',']ㅤ['); + this.message = this.message.replaceAll('][',']​['); //For each list of emotes Object.keys(this.emotes).forEach((key) => { //For each emote in the current list this.emotes[key].forEach((emote) => { //Inject emote links into the message, pad with invisible whitespace to keep link from getting mushed - this.message = this.message.replaceAll(`[${emote.name}]`, `ㅤ${emote.link}ㅤ`); + this.message = this.message.replaceAll(`[${emote.name}]`, `​${emote.link}​`); }); }); } @@ -135,13 +135,13 @@ class commandPreprocessor{ //Strip out file seperators in-case the user is being a smart-ass this.message = this.message.replaceAll('␜',''); //Split message by links - var splitMessage = this.message.split(/(https?:\/\/[^\sㅤ]+)/g); + var splitMessage = this.message.split(/(https?:\/\/[^\s​]+)/g); //Create an empty array to hold links this.links = []; splitMessage.forEach((chunk, chunkIndex) => { //For each chunk that is a link - if(chunk.match(/(https?:\/\/[^\sㅤ]+)/g)){ + if(chunk.match(/(https?:\/\/[^\s​]+)/g)){ //I looked online for obscure characters that no one would use to prevent people from chatting embed placeholders //Then I found this fucker, turns out it's literally made for the job lmao (even if it was originally intended for paper/magnetic tape) //Replace link with indexed placeholder