diff options
| author | citrons <citrons@mondecitronne.com> | 2025-06-01 15:38:17 -0500 |
|---|---|---|
| committer | citrons <citrons@mondecitronne.com> | 2025-06-01 15:38:17 -0500 |
| commit | e2dc5b6fbb6adf6f379ef0123c214a196211c305 (patch) | |
| tree | cc976665dd2e0916af100b5c0f7f629cc1936b01 /client/window | |
| parent | e740e5478a43358fbbd79636483d000e01f88b7e (diff) | |
joining channels
Diffstat (limited to 'client/window')
| -rw-r--r-- | client/window/window.go | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/client/window/window.go b/client/window/window.go new file mode 100644 index 0000000..a877f7b --- /dev/null +++ b/client/window/window.go @@ -0,0 +1,38 @@ +package window + +import ( + "citrons.xyz/talk/client/buffer" + "citrons.xyz/talk/tui" +) + +type Location interface { + CreateWindow() Window +} + +type Window interface { + Location() Location + Kill() + Buffer() *buffer.Buffer + Input() *tui.TextInput + Send(text string) + ShowStatusLine() +} + +type WindowCache struct { + windows map[Location]Window +} + +func NewCache() WindowCache { + return WindowCache {make(map[Location]Window)} +} + +func (wc *WindowCache) Open(l Location) Window { + if wc.windows[l] == nil { + wc.windows[l] = l.CreateWindow() + } + return wc.windows[l] +} + +func (wc *WindowCache) Get(l Location) Window { + return wc.windows[l] +} |
