element-hq/element-android

Text messages using the rich text editor creates an extra new line '\n'

sufyan-amoodi opened this issue · 0 comments

Steps to reproduce

Sending a text message that contains two or multiple new lines (with the use of 'enter' key to create a new line each) for the same message that is to be sent, it creates an extra blank new line (even shows an extra '\n' during the debug). The new line is always created after the first line and not for any of the other new lines. A solution for such an issue exists in the "EventHtmlRenderer.kt" file under the "removeLeadingNewlineForInlineElement" function but focuses only on the formatted text lines. After making changes to the same function, we were able to resolve for the normal text lines as well.

The issue is only while viewing through an android device, it doesn't display with an extra line space on iOS or web-client.

Outcome

We expected to have continuous lines with no extra line space as it should be while sending a message with multiple new lines.

Instead, it added an extra line space after the first line.
This doesn't happen when the first line contains formatted text.

In the below screenshot, "How are you? and "What's up" are part of the same message and did not contain any extra line space in between them while sending, but after the message got sent it did add an extra space. On the other hand, "Startup" and "Not yet" are part of another message sent later and yet they do not seem to be having the issue since the first line of this message "Startup" is formatted text.

Screenshot_20240220_125700_Element

Your phone model

Samsung Galaxy A51

Operating system version

Android 13

Application version and app store

Element version 1.6.10, Rust SDK 0.6.0, Vodozemac 0.4.0

Homeserver

No response

Will you send logs?

No

Are you willing to provide a PR?

Yes