add Wrap setting to views, add local addr to peer details

Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
Jakub Sokołowski 2019-06-26 22:48:21 -04:00 committed by Jakub
parent f2a7540bb8
commit fce1049354
3 changed files with 7 additions and 3 deletions

View File

@ -57,6 +57,7 @@ func main() {
Name: "info",
Title: "Details",
Placeholder: "Loading details...",
Wrap: true,
// corner positions
TopLeft: func(mx, my int) (int, int) {
return 0, my/2 + 1

View File

@ -70,11 +70,12 @@ func writePeerDetails(g *gocui.Gui, peer *Peer) {
return err
}
v.Clear()
fmt.Fprintf(v, strings.Repeat("%-8s: %s\n", 5),
fmt.Fprintf(v, strings.Repeat("%-8s: %s\n", 6),
"Name", peer.Name,
"ID", string(peer.Id),
"Enode", peer.Enode,
"Address", peer.Network.RemoteAddress,
"Local", peer.Network.LocalAddress,
"Remote", peer.Network.RemoteAddress,
"Caps", strings.Join(peer.Caps, ", "))
return nil
})

View File

@ -10,6 +10,7 @@ type ViewController struct {
Name string
Title string
Placeholder string
Wrap bool
Cursor bool
Current bool
Highlight bool
@ -38,9 +39,10 @@ func (m *ViewManager) Layout(g *gocui.Gui) error {
if err == nil && err != gocui.ErrUnknownView {
return err
}
v.Title = cfg.Title
v.Wrap = cfg.Wrap
v.SelFgColor = cfg.SelFgColor
v.SelBgColor = cfg.SelBgColor
v.Title = cfg.Title
v.Highlight = cfg.Highlight
if cfg.Cursor {