aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ui/message-view.go8
-rw-r--r--ui/messages/textbase.go12
2 files changed, 15 insertions, 5 deletions
diff --git a/ui/message-view.go b/ui/message-view.go
index de8e412..9bd1795 100644
--- a/ui/message-view.go
+++ b/ui/message-view.go
@@ -469,7 +469,13 @@ func (view *MessageView) CapturePlaintext(height int) string {
meta := view.metaBuffer[index]
message, ok := meta.(messages.UIMessage)
if ok && message != prevMessage {
- fmt.Fprintf(&buf, "%s <%s> %s\n", message.FormatTime(), message.Sender(), message.PlainText())
+ var sender string
+ if len(message.Sender()) > 0 {
+ sender = fmt.Sprintf(" <%s>", message.Sender())
+ } else if message.Type() == "m.emote" {
+ sender = fmt.Sprintf(" * %s", message.RealSender())
+ }
+ fmt.Fprintf(&buf, "%s%s %s\n", message.FormatTime(), sender, message.PlainText())
prevMessage = message
}
}
diff --git a/ui/messages/textbase.go b/ui/messages/textbase.go
index faf53e6..9f34683 100644
--- a/ui/messages/textbase.go
+++ b/ui/messages/textbase.go
@@ -58,10 +58,14 @@ func (msg *BaseMessage) calculateBufferWithText(bare bool, text tstring.TString,
msg.buffer = []tstring.TString{}
if bare {
- text = tstring.
- NewTString(msg.FormatTime()).
- AppendTString(tstring.NewColorTString(fmt.Sprintf(" <%s> ", msg.Sender()), msg.SenderColor())).
- AppendTString(text)
+ newText := tstring.NewTString(msg.FormatTime())
+ if len(msg.Sender()) > 0 {
+ newText = newText.AppendTString(tstring.NewColorTString(fmt.Sprintf(" <%s> ", msg.Sender()), msg.SenderColor()))
+ } else {
+ newText = newText.Append(" ")
+ }
+ newText = newText.AppendTString(text)
+ text = newText
}
forcedLinebreaks := text.Split('\n')