Keep the connection state in the status bar on /window (closes #225)
check / check (push) Waiting to run
check / check (push) Waiting to run
/window set the status bar to [connected] whatever the connection state, and Alt and a digit runs /window. Before /connect, both made the status bar say [connected] while the client had no session. /window now reads the connection state with the nick and shows [connected] only while the client is connected, [disconnected] otherwise. TestWindowConnectionState types /window 0 and presses Alt and 0, connected and not, and checks the status bar. Model: opus-5-5
This commit was merged in pull request #234.
This commit is contained in:
+8
-2
@@ -626,8 +626,14 @@ func (a *App) cmdWindow(args string) {
|
||||
|
||||
a.mu.Lock()
|
||||
nick := a.nick
|
||||
connected := a.connected
|
||||
a.mu.Unlock()
|
||||
|
||||
connStatus := "disconnected"
|
||||
if connected {
|
||||
connStatus = "connected"
|
||||
}
|
||||
|
||||
// Read the name before switching. A message from the server can
|
||||
// add a buffer at any time, but only at the end, so bufIndex
|
||||
// still names this buffer when SwitchBuffer runs.
|
||||
@@ -641,14 +647,14 @@ func (a *App) cmdWindow(args string) {
|
||||
a.mu.Unlock()
|
||||
|
||||
a.ui.SetStatus(
|
||||
nick, name, "connected",
|
||||
nick, name, connStatus,
|
||||
)
|
||||
} else {
|
||||
a.mu.Lock()
|
||||
a.target = ""
|
||||
a.mu.Unlock()
|
||||
|
||||
a.ui.SetStatus(nick, "", "connected")
|
||||
a.ui.SetStatus(nick, "", connStatus)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user