|
@@ -49,10 +49,10 @@ func (m md) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
|
|
switch msg := msg.(type) {
|
|
switch msg := msg.(type) {
|
|
|
case tea.WindowSizeMsg:
|
|
case tea.WindowSizeMsg:
|
|
|
m.p.Width = msg.Width
|
|
m.p.Width = msg.Width
|
|
|
- m.p.Height = msg.Height
|
|
|
|
|
|
|
+ m.p.Height = msg.Height - m.getVerticalMargin() - 1
|
|
|
if m.viewport.Width() == 0 && m.viewport.Height() == 0 {
|
|
if m.viewport.Width() == 0 && m.viewport.Height() == 0 {
|
|
|
m.viewport = viewport.New(
|
|
m.viewport = viewport.New(
|
|
|
- viewport.WithHeight(msg.Height),
|
|
|
|
|
|
|
+ viewport.WithHeight(msg.Height-m.getVerticalMargin()),
|
|
|
viewport.WithWidth(msg.Width),
|
|
viewport.WithWidth(msg.Width),
|
|
|
)
|
|
)
|
|
|
}
|
|
}
|
|
@@ -73,7 +73,8 @@ func (m md) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
|
|
m.viewport, cmd = m.viewport.Update(msg)
|
|
m.viewport, cmd = m.viewport.Update(msg)
|
|
|
cmds = append(cmds, cmd)
|
|
cmds = append(cmds, cmd)
|
|
|
|
|
|
|
|
- m.p, cmd = m.p.Update(msg)
|
|
|
|
|
|
|
+ model, cmd := m.p.Update(msg)
|
|
|
|
|
+ m.p = model.(pingo.Model)
|
|
|
cmds = append(cmds, cmd)
|
|
cmds = append(cmds, cmd)
|
|
|
|
|
|
|
|
return m, tea.Batch(cmds...)
|
|
return m, tea.Batch(cmds...)
|
|
@@ -109,7 +110,7 @@ func main() {
|
|
|
return
|
|
return
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- p := tea.NewProgram(md{p: pingo.InitialModel([]string{"google.ca", "asdf"}, 20, 10, *chartHeight)})
|
|
|
|
|
|
|
+ p := tea.NewProgram(md{p: pingo.InitialModel(hosts, 20, 10, *chartHeight)})
|
|
|
|
|
|
|
|
if _, err := p.Run(); err != nil {
|
|
if _, err := p.Run(); err != nil {
|
|
|
fmt.Printf("Alas, there's been an error: %v", err)
|
|
fmt.Printf("Alas, there's been an error: %v", err)
|