Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e9badcd41c |
@@ -465,6 +465,21 @@ func TestStatusBar(t *testing.T) {
|
||||
unread: "dave[afk]",
|
||||
want: " [connected] erin[away] [1:bob[m]] bob[m] [Act: 2:dave[afk](1)]",
|
||||
},
|
||||
{
|
||||
name: "nicks with brackets and symbols",
|
||||
nick: "bob[|[]",
|
||||
target: "x[^[]",
|
||||
unread: testOtherNick,
|
||||
want: " [connected] bob[|[] [1:x[^[]] x[^[] [Act: 2:bob(1)]",
|
||||
},
|
||||
{
|
||||
// /query takes any text as the target.
|
||||
name: "query target with brackets",
|
||||
nick: testNick,
|
||||
target: "[:::y|z]",
|
||||
unread: testOtherNick,
|
||||
want: " [connected] erin [1:[:::y|z]] [:::y|z] [Act: 2:bob(1)]",
|
||||
},
|
||||
}
|
||||
|
||||
for _, test := range tests {
|
||||
@@ -570,8 +585,9 @@ func bufferState(ui *UI, name string) (int, int) {
|
||||
return lines, unread
|
||||
}
|
||||
|
||||
// statusBarText returns the text the status bar shows, without
|
||||
// its colour tags.
|
||||
// statusBarText returns the text the status bar shows.
|
||||
// GetText(true) leaves out whatever tview reads as a tag, as
|
||||
// drawing does.
|
||||
func statusBarText(ui *UI) string {
|
||||
var text string
|
||||
|
||||
|
||||
+6
-7
@@ -226,8 +226,10 @@ func (ui *UI) initMessages() {
|
||||
}
|
||||
|
||||
func (ui *UI) initStatusBar() {
|
||||
ui.statusBar = tview.NewTextView().
|
||||
SetDynamicColors(true)
|
||||
// Colour tags stay off. With them on, tview reads text in
|
||||
// square brackets, such as "[connected]" or part of a nick,
|
||||
// as a tag and drops it.
|
||||
ui.statusBar = tview.NewTextView()
|
||||
ui.statusBar.SetBackgroundColor(tcell.ColorNavy)
|
||||
ui.statusBar.SetTextColor(tcell.ColorWhite)
|
||||
}
|
||||
@@ -332,13 +334,10 @@ func (ui *UI) renderStatusBar(
|
||||
|
||||
ui.statusBar.Clear()
|
||||
|
||||
// The status bar has colour tags turned on, so tview would read
|
||||
// "[connected]", or a name in square brackets, as a colour tag
|
||||
// and drop it. Escape makes it show every bracket as it is.
|
||||
_, _ = fmt.Fprint(ui.statusBar, tview.Escape(fmt.Sprintf(
|
||||
_, _ = fmt.Fprintf(ui.statusBar,
|
||||
" [%s] %s %s %s%s",
|
||||
connStatus, nick, bufInfo, target, unread,
|
||||
)))
|
||||
)
|
||||
}
|
||||
|
||||
func (ui *UI) getOrCreateBuffer(name string) *Buffer {
|
||||
|
||||
Reference in New Issue
Block a user