aboutsummaryrefslogtreecommitdiff
path: root/ui/messages/parser
diff options
context:
space:
mode:
authorTulir Asokan <tulir@maunium.net>2018-04-24 22:08:57 +0300
committerTulir Asokan <tulir@maunium.net>2018-04-24 22:09:04 +0300
commit49cd74c548e3baf259fce9270af3ecca5bdb625e (patch)
treea3e4e7cad626da1f44915967e26741c14779e11c /ui/messages/parser
parent2a0145db884038342ba00cdb29fc29085e1faace (diff)
Replace tabs with spaces so that they get rendered
Diffstat (limited to 'ui/messages/parser')
-rw-r--r--ui/messages/parser/htmlparser.go1
-rw-r--r--ui/messages/parser/parser.go2
2 files changed, 3 insertions, 0 deletions
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)