tulir / gomuks

A Matrix client written in Go.
https://maunium.net/go/gomuks
GNU Affero General Public License v3.0
1.37k stars 123 forks source link

Preserve newlines in plain text messages #388

Closed n-peugnet closed 2 years ago

n-peugnet commented 2 years ago

New lines were not displayed in plain text messages. There might be a better way, but I choose to manually convert the newline characters into BreakEntities inside of a ContainerEntity.

I didn't use my new function for the value of a plan text link, as it must not contain any new lines.

Demo

Event

{
  "room_id": "!***:matrix.org",
  "type": "m.room.message",
  "content": {
    "org.matrix.msc1767.text": "Probablement que j'ai pas rĂ©pondu alors đŸ˜…\nMerci pour le partage mais je suis pas chaud pour y aller",
    "body": "Probablement que j'ai pas rĂ©pondu alors đŸ˜…\nMerci pour le partage mais je suis pas chaud pour y aller",
    "msgtype": "m.text"
  }
}

Before

2022-10-10-201655_849x77_scrot

After

2022-10-10-201934_807x92_scrot