From 9278e0038366aab29f7c7352f606073756d5b750 Mon Sep 17 00:00:00 2001 From: Přemysl Eric Janouch
Date: Sat, 9 Nov 2024 11:23:15 +0100
Subject: WIP: xA: add prompt and status
---
xA/xA.go | 47 +++++++++++++++++++++++++++++++++++++++++------
1 file changed, 41 insertions(+), 6 deletions(-)
diff --git a/xA/xA.go b/xA/xA.go
index b9f79ec..147ee74 100644
--- a/xA/xA.go
+++ b/xA/xA.go
@@ -141,7 +141,6 @@ type buffer struct {
kind RelayBufferKind
serverName string
lines []bufferLine
- // TODO(p): Server by name or by pointer?
// Channel:
@@ -189,6 +188,8 @@ var (
wTopic *widget.RichText
wRichText *widget.RichText
wRichScroll *container.Scroll
+ wPrompt *widget.Label
+ wStatus *widget.Label
wEntry *widget.Entry
)
@@ -332,11 +333,38 @@ func refreshBufferList() {
}
func refreshPrompt() {
- // TODO(p): First off, add a prompt, second, refresh it.
+ var prompt string
+ if b := bufferByName(bufferCurrent); b == nil {
+ prompt = "Synchronizing..."
+ } else if server, ok := servers[b.serverName]; ok {
+ prompt = server.user
+ if server.userModes != "" {
+ prompt += "(" + server.userModes + ")"
+ }
+ if prompt == "" {
+ prompt = "(" + server.state.String() + ")"
+ }
+ }
+ wPrompt.SetText(prompt)
}
func refreshStatus() {
- // TODO(p): First off, add a status, second, refresh it.
+ var status string
+ if !bufferAtBottom() {
+ status += "🡇 "
+ }
+
+ status += bufferCurrent
+ if b := bufferByName(bufferCurrent); b != nil {
+ if b.modes != "" {
+ status += "(+" + b.modes + ")"
+ }
+ if b.hideUnimportant {
+ status += "