From 49cd74c548e3baf259fce9270af3ecca5bdb625e Mon Sep 17 00:00:00 2001 From: Tulir Asokan Date: Tue, 24 Apr 2018 22:08:57 +0300 Subject: Replace tabs with spaces so that they get rendered --- ui/messages/parser/htmlparser.go | 1 + ui/messages/parser/parser.go | 2 ++ 2 files changed, 3 insertions(+) (limited to 'ui/messages') diff --git a/ui/messages/parser/htmlparser.go b/ui/messages/parser/htmlparser.go index 8577ee7..cd268a5 100644 --- a/ui/messages/parser/htmlparser.go +++ b/ui/messages/parser/htmlparser.go @@ -180,6 +180,7 @@ func (parser *MatrixHTMLProcessor) Postprocess() { // ParseHTMLMessage parses a HTML-formatted Matrix event into a UIMessage. func ParseHTMLMessage(room *rooms.Room, evt *gomatrix.Event, senderDisplayname string) tstring.TString { htmlData, _ := evt.Content["formatted_body"].(string) + htmlData = strings.Replace(htmlData, "\t", " ", -1) msgtype, _ := evt.Content["msgtype"].(string) processor := &MatrixHTMLProcessor{ diff --git a/ui/messages/parser/parser.go b/ui/messages/parser/parser.go index b114d98..eef91a2 100644 --- a/ui/messages/parser/parser.go +++ b/ui/messages/parser/parser.go @@ -18,6 +18,7 @@ package parser import ( "fmt" + "strings" "time" "maunium.net/go/gomatrix" @@ -64,6 +65,7 @@ func ParseMessage(matrix ifc.MatrixContainer, room *rooms.Room, evt *gomatrix.Ev return messages.NewExpandedTextMessage(evt.ID, evt.Sender, displayname, msgtype, text, ts) } text, _ := evt.Content["body"].(string) + text = strings.Replace(text, "\t", " ", -1) return messages.NewTextMessage(evt.ID, evt.Sender, displayname, msgtype, text, ts) case "m.image": url, _ := evt.Content["url"].(string) -- cgit v1.2.3