aboutsummaryrefslogtreecommitdiff
path: root/ui/widget
diff options
context:
space:
mode:
authorTulir Asokan <tulir@maunium.net>2018-03-22 23:40:26 +0200
committerTulir Asokan <tulir@maunium.net>2018-03-22 23:40:26 +0200
commita9c899f0d5e816efc0d5d98c59320c59e2fbff39 (patch)
treee29f6cd2af1e838ff9d224cf50f56794e75ae972 /ui/widget
parent497ae566c0fdc3583272a49798d190ebca99e02b (diff)
Refactoring and documentation
Diffstat (limited to 'ui/widget')
-rw-r--r--ui/widget/message-view.go6
1 files changed, 4 insertions, 2 deletions
diff --git a/ui/widget/message-view.go b/ui/widget/message-view.go
index a4ba236..444aa03 100644
--- a/ui/widget/message-view.go
+++ b/ui/widget/message-view.go
@@ -315,7 +315,6 @@ func (view *MessageView) Draw(screen tcell.Screen) {
screen.SetContent(separatorX, separatorY, view.Separator, nil, tcell.StyleDefault)
}
- var prevMeta types.MessageMeta
indexOffset := len(view.textBuffer) - view.ScrollOffset - height
if indexOffset <= -PaddingAtTop {
message := "Scroll up to load more messages."
@@ -324,10 +323,13 @@ func (view *MessageView) Draw(screen tcell.Screen) {
}
view.writeLine(screen, message, x+messageOffsetX, y, tcell.ColorGreen)
}
+
if len(view.textBuffer) != len(view.metaBuffer) {
debug.ExtPrintf("Unexpected text/meta buffer length mismatch: %d != %d.", len(view.textBuffer), len(view.metaBuffer))
return
}
+
+ var prevMeta types.MessageMeta
for line := 0; line < height; line++ {
index := indexOffset + line
if index < 0 {
@@ -342,7 +344,7 @@ func (view *MessageView) Draw(screen tcell.Screen) {
}
if prevMeta == nil || meta.GetSender() != prevMeta.GetSender() {
view.writeLineRight(
- screen, meta.GetDisplaySender(),
+ screen, meta.GetSender(),
x+usernameOffsetX, y+line,
view.widestSender, meta.GetSenderColor())
}