Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add strikethrough formatting #1809

Merged
merged 2 commits into from
Sep 2, 2024

Conversation

thomwiggers
Copy link
Contributor

No description provided.

@tadzik
Copy link
Contributor

tadzik commented Aug 1, 2024

With this applied, ircToHtml() works as well and I can see it working Hexchat -> Matrix:

diff --git a/src/irc/formatting.ts b/src/irc/formatting.ts
index 136b7f18..e3d4d2e6 100644
--- a/src/irc/formatting.ts
+++ b/src/irc/formatting.ts
@@ -262,13 +262,13 @@ export function ircToHtml(text: string): string {
     // Replace all mIRC formatting characters.
     // The color character can have arguments.
     // The regex matches:
-    // - Any single 'simple' formatting character: \x02, \x11, \x1d, \x1f, \x0f and
-    //   \x16 for bold, italics, underline, reset and reverse respectively.
+    // - Any single 'simple' formatting character: \x02, \x11, \x1d, \x1e, \x1f, \x0f and
+    //   \x16 for bold, italics, underline, strikethrough, reset and reverse respectively.
     // - The colour formatting character (\x03) followed by 0 to 2 digits for
     //   the foreground colour and (optionally) a comma and 1-2 digits for the
     //   background colour.
     // eslint-disable-next-line no-control-regex
-    const colorRegex = /[\x02\x11\x1d\x1f\x0f\x16]|\x03(\d{0,2})(?:,(\d{1,2}))?/g;
+    const colorRegex = /[\x02\x11\x1d\x1e\x1f\x0f\x16]|\x03(\d{0,2})(?:,(\d{1,2}))?/g;
 
     // Maintain a small state machine of which tags are open so we can close the right
     // ones on RESET codes and toggle appropriately if they do the same code again.

It doesn't seem to work for me from Matrix to Hexchat though; what did you test this on?

@thomwiggers
Copy link
Contributor Author

The change seemed so simple that I hoped that the unit tests would be more than sufficient.

@tadzik
Copy link
Contributor

tadzik commented Aug 1, 2024

Fixed it up in thomwiggers#1

@thomwiggers
Copy link
Contributor Author

@tadzik thanks!

@tadzik
Copy link
Contributor

tadzik commented Aug 6, 2024

Looks good, but we'll need a signoff and a changelog entry: see https://github.com/matrix-org/matrix-appservice-bridge/blob/develop/CONTRIBUTING.md#%EF%B8%8F-pull-requests

@thomwiggers
Copy link
Contributor Author

I've rebased, squashed, signed off and fixed the name of the changelog file.

@thomwiggers
Copy link
Contributor Author

The failing changelog test seems due to a .gitkeep file in changelog.d that the tool is not set up to ignore.

Thanks to Tadeusz Sośnierz (@tadzik) for contributions integrated in this
squashed commit.

Signed-off-by: Thom Wiggers <[email protected]>
@thomwiggers
Copy link
Contributor Author

Rebased on #1813

@tadzik tadzik merged commit 2924a5f into matrix-org:develop Sep 2, 2024
10 of 11 checks passed
@thomwiggers thomwiggers deleted the add-strike-support branch September 2, 2024 11:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants