Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d1cb9f8044 |
No files matched your search
@@ -465,21 +465,6 @@ 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 {
|
||||||
@@ -585,9 +570,8 @@ func bufferState(ui *UI, name string) (int, int) {
|
|||||||
return lines, unread
|
return lines, unread
|
||||||
}
|
}
|
||||||
|
|
||||||
// statusBarText returns the text the status bar shows.
|
// statusBarText returns the text the status bar shows, without
|
||||||
// GetText(true) leaves out whatever tview reads as a tag, as
|
// its colour tags.
|
||||||
// drawing does.
|
|
||||||
func statusBarText(ui *UI) string {
|
func statusBarText(ui *UI) string {
|
||||||
var text string
|
var text string
|
||||||
|
|
||||||
|
|||||||
+7
-6
@@ -226,10 +226,8 @@ func (ui *UI) initMessages() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (ui *UI) initStatusBar() {
|
func (ui *UI) initStatusBar() {
|
||||||
// Colour tags stay off. With them on, tview reads text in
|
ui.statusBar = tview.NewTextView().
|
||||||
// square brackets, such as "[connected]" or part of a nick,
|
SetDynamicColors(true)
|
||||||
// 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)
|
||||||
}
|
}
|
||||||
@@ -334,10 +332,13 @@ func (ui *UI) renderStatusBar(
|
|||||||
|
|
||||||
ui.statusBar.Clear()
|
ui.statusBar.Clear()
|
||||||
|
|
||||||
_, _ = fmt.Fprintf(ui.statusBar,
|
// 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(
|
||||||
" [%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