Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e9badcd41c |
No files matched your search
@@ -465,6 +465,21 @@ func TestStatusBar(t *testing.T) {
|
|||||||
unread: "dave[afk]",
|
unread: "dave[afk]",
|
||||||
want: " [connected] erin[away] [1:bob[m]] bob[m] [Act: 2:dave[afk](1)]",
|
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 {
|
for _, test := range tests {
|
||||||
@@ -570,8 +585,9 @@ func bufferState(ui *UI, name string) (int, int) {
|
|||||||
return lines, unread
|
return lines, unread
|
||||||
}
|
}
|
||||||
|
|
||||||
// statusBarText returns the text the status bar shows, without
|
// statusBarText returns the text the status bar shows.
|
||||||
// its colour tags.
|
// GetText(true) leaves out whatever tview reads as a tag, as
|
||||||
|
// drawing does.
|
||||||
func statusBarText(ui *UI) string {
|
func statusBarText(ui *UI) string {
|
||||||
var text string
|
var text string
|
||||||
|
|
||||||
|
|||||||
+6
-7
@@ -226,8 +226,10 @@ func (ui *UI) initMessages() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (ui *UI) initStatusBar() {
|
func (ui *UI) initStatusBar() {
|
||||||
ui.statusBar = tview.NewTextView().
|
// Colour tags stay off. With them on, tview reads text in
|
||||||
SetDynamicColors(true)
|
// 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.SetBackgroundColor(tcell.ColorNavy)
|
||||||
ui.statusBar.SetTextColor(tcell.ColorWhite)
|
ui.statusBar.SetTextColor(tcell.ColorWhite)
|
||||||
}
|
}
|
||||||
@@ -332,13 +334,10 @@ func (ui *UI) renderStatusBar(
|
|||||||
|
|
||||||
ui.statusBar.Clear()
|
ui.statusBar.Clear()
|
||||||
|
|
||||||
// The status bar has colour tags turned on, so tview would read
|
_, _ = fmt.Fprintf(ui.statusBar,
|
||||||
// "[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(
|
|
||||||
" [%s] %s %s %s%s",
|
" [%s] %s %s %s%s",
|
||||||
connStatus, nick, bufInfo, target, unread,
|
connStatus, nick, bufInfo, target, unread,
|
||||||
)))
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ui *UI) getOrCreateBuffer(name string) *Buffer {
|
func (ui *UI) getOrCreateBuffer(name string) *Buffer {
|
||||||
|
|||||||
Reference in new issue
Block a user