diff options
author | Tulir Asokan <tulir@maunium.net> | 2019-04-13 00:51:58 +0300 |
---|---|---|
committer | Tulir Asokan <tulir@maunium.net> | 2019-04-13 00:51:58 +0300 |
commit | 43a7bdab7262c015b50e3e673e80389f9514f9ca (patch) | |
tree | 0efd957e49ebe6c6350a3b9067e3068b24b2448c /ui/messages/htmlmessage.go | |
parent | abd21affc42ad65968c946c3bbd6c63eba342981 (diff) |
Add better stringification for UI message types for debugging
Diffstat (limited to 'ui/messages/htmlmessage.go')
-rw-r--r-- | ui/messages/htmlmessage.go | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/ui/messages/htmlmessage.go b/ui/messages/htmlmessage.go index 9ee1eab..9777303 100644 --- a/ui/messages/htmlmessage.go +++ b/ui/messages/htmlmessage.go @@ -17,6 +17,9 @@ package messages import ( + "fmt" + "strings" + "maunium.net/go/mautrix" "maunium.net/go/mauview" "maunium.net/go/tcell" @@ -98,3 +101,10 @@ func (hw *HTMLMessage) PlainText() string { func (hw *HTMLMessage) NotificationContent() string { return hw.Root.PlainText() } + +func (hw *HTMLMessage) String() string { + return fmt.Sprintf("&messages.HTMLMessage{\n" + + " Base=%s,\n" + + " Root=||\n%s\n" + + "}", strings.ReplaceAll(hw.BaseMessage.String(), "\n", "\n "), hw.Root.String()) +} |