summaryrefslogtreecommitdiff
path: root/client/buffer/buffer.go
diff options
context:
space:
mode:
authorcitrons <citrons@mondecitronne.com>2025-06-01 15:38:17 -0500
committercitrons <citrons@mondecitronne.com>2025-06-01 15:38:17 -0500
commite2dc5b6fbb6adf6f379ef0123c214a196211c305 (patch)
treecc976665dd2e0916af100b5c0f7f629cc1936b01 /client/buffer/buffer.go
parente740e5478a43358fbbd79636483d000e01f88b7e (diff)
joining channels
Diffstat (limited to 'client/buffer/buffer.go')
-rw-r--r--client/buffer/buffer.go31
1 files changed, 23 insertions, 8 deletions
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