From f3ad7a92a603cad87c4e1da352f6aac99770d269 Mon Sep 17 00:00:00 2001 From: Jordan Bracco Date: Sat, 31 Dec 2022 19:16:14 +0100 Subject: feat(ui): Only show nickname once for multiple consecutive messages --- ui/buffers.go | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/ui/buffers.go b/ui/buffers.go index b11e734..3a17b18 100644 --- a/ui/buffers.go +++ b/ui/buffers.go @@ -42,6 +42,8 @@ type Line struct { splitPoints []point width int newLines []int + + HeadTag string } func (l *Line) IsZero() bool { @@ -388,6 +390,13 @@ func (bs *BufferList) AddLine(netID, title string, line Line) { } // TODO change b.scrollAmt if it's not 0 and bs.current is idx. } else { + if n != 0 { + l := &b.lines[n-1] + if l.Head == line.Head || l.HeadTag == line.Head { + line.HeadTag = line.Head + line.Head = "" + } + } line.computeSplitPoints() b.lines = append(b.lines, line) if b == current && 0 < b.scrollAmt { @@ -424,6 +433,13 @@ func (bs *BufferList) AddLines(netID, title string, before, after []Line) { } line.computeSplitPoints() } + if len(lines) > 0 { + l := &lines[len(lines)-1] + if l.Head == line.Head || l.HeadTag == line.Head { + line.HeadTag = line.Head + line.Head = "" + } + } lines = append(lines, line) } } -- cgit v1.2.3