diff --git a/client/js/helpers/ircmessageparser/parseStyle.js b/client/js/helpers/ircmessageparser/parseStyle.js
index e1671332..ccf5293a 100644
--- a/client/js/helpers/ircmessageparser/parseStyle.js
+++ b/client/js/helpers/ircmessageparser/parseStyle.js
@@ -67,7 +67,7 @@ function parseStyle(text) {
const textPart = text.slice(start, position);
// Filters out all non-style related control codes present in this text
- const processedText = textPart.replace(controlCodesRx, "");
+ const processedText = textPart.replace(controlCodesRx, " ");
if (processedText.length) {
// Current fragment starts where the previous one ends, or at 0 if none
diff --git a/test/client/js/helpers/ircmessageparser/parseStyle.js b/test/client/js/helpers/ircmessageparser/parseStyle.js
index fed71455..45d75c5c 100644
--- a/test/client/js/helpers/ircmessageparser/parseStyle.js
+++ b/test/client/js/helpers/ircmessageparser/parseStyle.js
@@ -4,7 +4,7 @@ const expect = require("chai").expect;
const parseStyle = require("../../../../../client/js/helpers/ircmessageparser/parseStyle").default;
describe("parseStyle", () => {
- it("should skip control codes", () => {
+ it("should replace control codes", () => {
const input = "text\x01with\x04control\x05codes";
const expected = [
{
@@ -17,10 +17,10 @@ describe("parseStyle", () => {
underline: false,
strikethrough: false,
monospace: false,
- text: "textwithcontrolcodes",
+ text: "text withcontrol codes",
start: 0,
- end: 20,
+ end: 22,
},
];
diff --git a/test/client/js/helpers/parse.js b/test/client/js/helpers/parse.js
index 84ae096f..f4902abe 100644
--- a/test/client/js/helpers/parse.js
+++ b/test/client/js/helpers/parse.js
@@ -48,7 +48,7 @@ describe("IRC formatted message parser", () => {
input:
"\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0B\x0C\x0D\x0E\x0F\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1A\x1B\x1C\x1B\x1D\x1D\x1E\x1Ftext\x0Awithcontrolcodestest",
expected:
- 'text\nwithcontrolcodestest',
+ ' text\nwithcontrolcodestest',
},
];
@@ -606,4 +606,14 @@ describe("IRC formatted message parser", () => {
""
);
});
+
+ it("should find links separated by tab character", async () => {
+ const input = "example.com\texample.org";
+ const actual = await getParsedMessageContents(input);
+
+ expect(actual).to.equal(
+ 'example.com' +
+ ' example.org'
+ );
+ });
});