SUMMARY NeoChat is now duplicating newlines. STEPS TO REPRODUCE 1. Send something like the ``` A newline ``` OBSERVED RESULT formatted_body will have duplicate newlines: `neochat<br />\nnewline` EXPECTED RESULT formatted_body should have only one newline: `neochat\nnewline` SOFTWARE/OS VERSIONS Linux: Arch Linux KDE Frameworks Version: 5.95.0 Qt Version: 5.15.5 NeoChat: 22.06
Actually this is correct behaviour. As mentioned on matrix \n in the formatted body represents a newline in the html not the message and a <br> tag represents a newline in the message. Now what we have could be simplified to 'neochat<br>newline' but what is currently being sent is technically correct and will be rendered correctly, this is just how the library we use for markdown to html outputs a hard break. I don't think we should mess around and potentially break thing just to prettify the source.
Hm, I initially encountered it, because I chat on a matrix<->discord bridge from neochat, and whenever I used newlines, they showed up as double newlines on discord. That led me to check Element and noticed that it doesn't generate <br> and \n . I would find it nice if we'd prettify the source, because the \n don't really give any meaningful input in formatted_body, although this does seem like an issue on the bridge software for not ignoring the \n to begin with.
(In reply to Jan Bidler from comment #2) > Hm, I initially encountered it, because I chat on a matrix<->discord bridge > from neochat, and whenever I used newlines, they showed up as double > newlines on discord. That led me to check Element and noticed that it > doesn't generate <br> and \n . > I would find it nice if we'd prettify the source, because the \n don't > really give any meaningful input in formatted_body, although this does seem > like an issue on the bridge software for not ignoring the \n to begin with. It would be interesting to know if that is the bridge or discord that treats the /n as newlines in the formatted body. However if it's causing an actual issue we can put in a fix I don't see that as prettification. We shouldn't break compatibility where it isn't necessary. It shouldn't be too hard to write a string replace to specifically target <br />/n and replace with <br>. We need to keep it specific though as when I used to replace all /n in the formatted body I broke quotes.
A possibly relevant merge request was started @ https://invent.kde.org/network/neochat/-/merge_requests/492
This seems to have been fixed