From e2dc5b6fbb6adf6f379ef0123c214a196211c305 Mon Sep 17 00:00:00 2001 From: citrons Date: Sun, 1 Jun 2025 15:38:17 -0500 Subject: joining channels --- client/buffer/buffer.go | 31 +++++++++++++++++++++++-------- 1 file changed, 23 insertions(+), 8 deletions(-) (limited to 'client/buffer/buffer.go') diff --git a/client/buffer/buffer.go b/client/buffer/buffer.go index 230fba9..fea88a9 100644 --- a/client/buffer/buffer.go +++ b/client/buffer/buffer.go @@ -5,10 +5,9 @@ import ( ) type Buffer struct { - top *bufList - bottom *bufList + top *List + bottom *List scroll tui.ScrollState - TextInput tui.TextInput Closed bool } @@ -17,15 +16,31 @@ type Message interface { Show(odd bool) } -type bufList struct { +type List struct { msg Message odd bool - prev *bufList - next *bufList + prev *List + next *List +} + +func (l List) Prev() *List { + return l.prev +} + +func (l List) Next() *List { + return l.next +} + +func (b *Buffer) Top() *List { + return b.top +} + +func (b *Buffer) Bottom() *List { + return b.bottom } func (b *Buffer) Add(msg Message) { - l := &bufList {msg: msg} + l := &List {msg: msg} if b.bottom != nil { b.bottom.next = l l.prev = b.bottom @@ -38,7 +53,7 @@ func (b *Buffer) Add(msg Message) { } func (b *Buffer) AddTop(msg Message) { - l := bufList {msg: msg} + l := List {msg: msg} if b.top != nil { b.top.prev = &l l.next = b.top -- cgit v1.2.3