Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
87d65552e3 |
No files matched your search
@@ -799,31 +799,6 @@ func TestStatusBar(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TestUnreadLine checks that a line added to a window that is not
|
|
||||||
// shown puts that window in the status bar's unread list at once,
|
|
||||||
// and that the status bar keeps the nick, target and connection
|
|
||||||
// state last set.
|
|
||||||
func TestUnreadLine(t *testing.T) {
|
|
||||||
t.Parallel()
|
|
||||||
|
|
||||||
ui := NewUI()
|
|
||||||
runUI(t, ui)
|
|
||||||
|
|
||||||
// Window 1, the one shown, is the channel's. The line goes to
|
|
||||||
// window 2 after SetStatus, so only AddLine can show it in the
|
|
||||||
// status bar.
|
|
||||||
ui.SwitchToBuffer(testChannel)
|
|
||||||
ui.SetStatus(testNick, testChannel, "connected")
|
|
||||||
ui.AddLine(testOtherNick, testText)
|
|
||||||
|
|
||||||
const want = " [connected] erin [1:#chan] #chan [Act: 2:bob(1)]"
|
|
||||||
|
|
||||||
got := statusBarText(ui)
|
|
||||||
if got != want {
|
|
||||||
t.Fatalf("status bar is %q, want %q", got, want)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// TestOwnEventFromOtherClient checks that a message, notice,
|
// TestOwnEventFromOtherClient checks that a message, notice,
|
||||||
// join or part that the user's session makes from another
|
// join or part that the user's session makes from another
|
||||||
// client shows as one line in the buffer it belongs to.
|
// client shows as one line in the buffer it belongs to.
|
||||||
|
|||||||
+2
-14
@@ -30,12 +30,6 @@ type UI struct {
|
|||||||
buffers []*Buffer
|
buffers []*Buffer
|
||||||
currentBuffer int
|
currentBuffer int
|
||||||
|
|
||||||
// The nick, target and connection state last passed to
|
|
||||||
// SetStatus.
|
|
||||||
nick string
|
|
||||||
target string
|
|
||||||
connStatus string
|
|
||||||
|
|
||||||
onInput func(string)
|
onInput func(string)
|
||||||
// inputDone is closed once the line last passed to onInput
|
// inputDone is closed once the line last passed to onInput
|
||||||
// has been handled. Only callOnInput, on the event loop, uses
|
// has been handled. Only callOnInput, on the event loop, uses
|
||||||
@@ -185,11 +179,7 @@ func (ui *UI) SetStatus(
|
|||||||
nick, target, connStatus string,
|
nick, target, connStatus string,
|
||||||
) {
|
) {
|
||||||
ui.app.QueueUpdateDraw(func() {
|
ui.app.QueueUpdateDraw(func() {
|
||||||
ui.nick = nick
|
ui.renderStatusBar(nick, target, connStatus)
|
||||||
ui.target = target
|
|
||||||
ui.connStatus = connStatus
|
|
||||||
|
|
||||||
ui.refreshStatusBar()
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -310,10 +300,8 @@ func (ui *UI) callOnInput(text string) {
|
|||||||
}()
|
}()
|
||||||
}
|
}
|
||||||
|
|
||||||
// refreshStatusBar redraws the status bar with the nick, target
|
|
||||||
// and connection state last passed to SetStatus.
|
|
||||||
func (ui *UI) refreshStatusBar() {
|
func (ui *UI) refreshStatusBar() {
|
||||||
ui.renderStatusBar(ui.nick, ui.target, ui.connStatus)
|
// Placeholder; full refresh needs nick/target context.
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ui *UI) renderStatusBar(
|
func (ui *UI) renderStatusBar(
|
||||||
|
|||||||
Reference in new issue
Block a user