summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJordan Bracco <href@random.sh>2022-12-31 19:16:14 +0100
committerJordan Bracco <href@random.sh>2022-12-31 19:16:14 +0100
commitf3ad7a92a603cad87c4e1da352f6aac99770d269 (patch)
tree8e27a569a1f8c601272f465ec26b6eb772fed556
parentOnly show one connected message per reconnection (diff)
feat(ui): Only show nickname once for multiple consecutive messagesfeat/hrefhref/multiline-hide-nick
-rw-r--r--ui/buffers.go16
1 files changed, 16 insertions, 0 deletions
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)
}
}