Rename KeyBindingView's Draw() receiver variable name

This commit is contained in:
Adriano Caloiaro 2020-03-23 19:21:52 -04:00
parent 6ea08cd730
commit 08bb6d0a25
No known key found for this signature in database
GPG key ID: 9FFD0E7601F166AB

View file

@ -57,27 +57,6 @@ func CreateViewContext() *ViewContext {
} }
} }
// Draw draws the key bindings view on to the screen
func (n *KeybindingView) Draw(screen tcell.Screen) {
n.Box.Draw(screen)
x, y, width, _ := n.GetInnerRect()
previousWidth := 0
for j, bnd := range n.Bindings {
line := fmt.Sprintf("(%s)[white] %s", bnd.Shortcut, bnd.Description)
tview.Print(screen, line, x+previousWidth, y, width, tview.AlignLeft, tcell.ColorBlue)
previousWidth += len(bnd.Shortcut) + len(bnd.Description) + 4
// virtically separate playback controls from ui controls
// yes, this is hacky, but there's a comment, so it's ok, right?
// TODO clean up this mess
if j == 4 {
y = y + 1
previousWidth = 0
}
}
}
// Draw draws a NowPlayingView onto the scren // Draw draws a NowPlayingView onto the scren
func (n *NowPlayingView) Draw(screen tcell.Screen) { func (n *NowPlayingView) Draw(screen tcell.Screen) {
n.Box.Draw(screen) n.Box.Draw(screen)
@ -107,11 +86,30 @@ func (s *StatusView) Draw(screen tcell.Screen) {
s.Box.Draw(screen) s.Box.Draw(screen)
x, y, width, _ := s.GetInnerRect() x, y, width, _ := s.GetInnerRect()
line := fmt.Sprintf("%s[white] %s", "Message:", s.Message) line := fmt.Sprintf("%s[white] %s", "Message:", s.Message)
tview.Print(screen, line, x, y, width, tview.AlignLeft, tcell.ColorBlue) tview.Print(screen, line, x, y, width, tview.AlignLeft, tcell.ColorBlue)
} }
// Draw draws the key bindings view on to the screen
func (k *KeybindingView) Draw(screen tcell.Screen) {
k.Box.Draw(screen)
x, y, width, _ := k.GetInnerRect()
previousWidth := 0
for j, bnd := range k.Bindings {
line := fmt.Sprintf("(%s)[white] %s", bnd.Shortcut, bnd.Description)
tview.Print(screen, line, x+previousWidth, y, width, tview.AlignLeft, tcell.ColorBlue)
previousWidth += len(bnd.Shortcut) + len(bnd.Description) + 4
// virtically separate playback controls from ui controls
// yes, this is hacky, but there's a comment, so it's ok, right?
if j == 4 {
y = y + 1
previousWidth = 0
}
}
}
func createChannelList() *tview.List { func createChannelList() *tview.List {
list := tview.NewList() list := tview.NewList()
list. list.