Fix extra newline in plaintext body when sending code block. Fixes #216

This commit is contained in:
Tulir Asokan 2020-09-04 18:19:55 +03:00
parent 56256b8937
commit bda603eca7
3 changed files with 4 additions and 3 deletions

2
go.mod
View File

@ -23,7 +23,7 @@ require (
gopkg.in/toast.v1 v1.0.0-20180812000517-0a84660828b2
gopkg.in/vansante/go-ffprobe.v2 v2.0.2
gopkg.in/yaml.v2 v2.3.0
maunium.net/go/mautrix v0.7.5
maunium.net/go/mautrix v0.7.6
maunium.net/go/mauview v0.1.1
maunium.net/go/tcell v0.2.0
)

4
go.sum
View File

@ -117,8 +117,8 @@ gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
maunium.net/go/maulogger/v2 v2.1.1/go.mod h1:TYWy7wKwz/tIXTpsx8G3mZseIRiC5DoMxSZazOHy68A=
maunium.net/go/mautrix v0.7.5 h1:3MFayZGekrPVL0xogwqeX50UdQnKqGkd9w1c1HQoyYo=
maunium.net/go/mautrix v0.7.5/go.mod h1:Va/74MijqaS0DQ3aUqxmFO54/PMfr1LVsCOcGRHbYmo=
maunium.net/go/mautrix v0.7.6 h1:jB9oCimPq0mVyolwQBC/9N1fu21AU+Ryq837cLf4gOo=
maunium.net/go/mautrix v0.7.6/go.mod h1:Va/74MijqaS0DQ3aUqxmFO54/PMfr1LVsCOcGRHbYmo=
maunium.net/go/mauview v0.1.1 h1:wfTXyPx3LGAGpTskh+UbBv/QItUWnEpaneHmywoYnfY=
maunium.net/go/mauview v0.1.1/go.mod h1:3QBUiuLct9moP1LgDhCGIg0Ovxn38Bd2sGndnUOuj4o=
maunium.net/go/tcell v0.2.0 h1:1Q0kN3wCOGAIGu1r3QHADsjSUOPDylKREvCv3EzJpVg=

View File

@ -440,6 +440,7 @@ func (view *RoomView) SetEditing(evt *muksevt.Event) {
// This feels kind of dangerous, but I think it works
msgContent = view.editing.Gomuks.Edits[len(view.editing.Gomuks.Edits)-1].Content.AsMessage().NewContent
}
// TODO this should parse HTML instead of just using the plaintext body
text := msgContent.Body
if msgContent.MsgType == event.MsgEmote {
text = "/me " + text