Fixed Line breaks in [ICODE] are doubled / rendered twice

Affected version
2.2.2

Steffen

Well-known member
One of our users has the following signature (but the issue exists in regular messages, too):

[ICODE]#MGS .solid_snake {
transform-box: view-box;
visibility: hidden;
}[/ICODE]

Since upgrading to XenForo 2.2, the line breaks are rendered twice as can be seen here:

#MGS .solid_snake { transform-box: view-box; visibility: hidden; }

Screenshot for future reference:
Screenshot from 2020-12-09 11-33-55.png

Can this be fixed without too much effort? :)
 

Chris D

XenForo developer
Staff member
It can be fixed very easily and immediately if they use the appropriate style of code tag. Inline code is for small inline text snippets and even if it wasn’t behaving like this, it would look sub-optimal anyway.

We’ll certainly look into it, though there may be undesirable trade offs in fixing it - this may be related to how we handle line wrapping - but it will still be the wrong BB code to use.

It does seem correct that there is a small behaviour change in XF 2.2 so as long as it's not caused by something fundamental a fix or workaround may be reasonable.

EDIT: The issue has been caused by this recent bug fix:

So unless there's a reasonable workaround we may need to make a decision as to which one is more or less desirable.
 

Steffen

Well-known member
Yeah, I agree that ICODE is used in an unintended way here.

This patch seems to work but I'm not sure whether it has unintended consequences (it does preserve whitespace though :)):

Diff:
--- a/src/XF/BbCode/Renderer/Html.php
+++ b/src/XF/BbCode/Renderer/Html.php
@@ -116,7 +116,8 @@ class Html extends AbstractRenderer
         ]);
 
         $this->addTag('icode', [
-            'callback' => 'renderTagInlineCode'
+            'callback' => 'renderTagInlineCode',
+            'stopBreakConversion' => true
         ]);
 
         $this->addTag('php', [
 

XF Bug Bot

XenForo bug fixer bot
Staff member
Thank you for reporting this issue, it has now been resolved. We are aiming to include any changes that have been made in a future XF release (2.2.3).

Change log:
Ensure that line breaks within inline code blocks are not doubled.
There may be a delay before changes are rolled out to the XenForo Community.
 
Top