element-hq / element-hq/element-android

Unnecessary blank line after linebreak when using formatted_body

Open
#9,019 0 comments 0 reactions 0 assignees View on GitHub
T-Defect
Dominant language
Kotlin
Stars
3.7k
Forks
917
PR merge metrics
No merged PRs in 30d

Description

### Steps to reproduce

1. Where are you starting? What can you see?
I write a text message in a room with the text editor activated on my Android phone with an explicit line break.
For example I write:

hello nice
world.

### Outcome

#### What did you expect?
I expect this text to appear exactly like that in the chat window, both on my own device and on the other user's Android device, i.e. only with simple line break but no blank line between "hello nice" and "world.".

On the Web browser interface (app.element.io) it gets displayed correctly as expected. But:

#### What happened instead?
But on all Android phones it appears as:

hello nice

world.

I.e. with an extra blank line between "hello nice" and "world.".

#### Technical background / root cause
The problem occurs when the raw data (as seen in app.element.io browser web interface) is like this:

"m.new_content": {
"body": "hello nice\nworld.",
"format": "org.matrix.custom.html",
"formatted_body": "hello nice
world.",
"msgtype": "m.text"
},

Wheres there's no problem for raw data like this:

"m.new_content": {
"msgtype": "m.text",
"body": "hello nice\nworld.",
"m.mentions": {}
},

So the problem occurs in the rendering of formatted text, when the HTML tag


of "formatted_body" creates not only the desired line break but additionally a wrong extra blank line in the Android app (but not in the web browser app).

### Your phone model

Shiftphone and Samsung

### Operating system version

Android 10 and 14 likewise

### Application version and app store

1.6.36 from Google Play

### Homeserver

_No response_

### Will you send logs?

No

### Are you willing to provide a PR?

No

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.