Skip to content

Commit

Permalink
support log scrolling
Browse files Browse the repository at this point in the history
  • Loading branch information
MahdiAw committed Apr 12, 2023
1 parent 64ebf40 commit 820039a
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
10 changes: 9 additions & 1 deletion client/leaderView.go
Expand Up @@ -86,7 +86,7 @@ func newLeaderView() *leaderView {
v.Logs.PaddingTop = 1
v.Logs.PaddingLeft = 2
v.Logs.TextStyle = ui.NewStyle(ui.ColorRed)
v.Logs.SelectedRowStyle = ui.NewStyle(ui.ColorRed)
v.Logs.SelectedRowStyle = ui.NewStyle(ui.ColorBlack, ui.ColorRed)
v.Logs.BorderStyle.Fg = ui.ColorMagenta
v.Logs.TitleStyle.Fg = ui.ColorBlue
v.TotalSpeed = widgets.NewPlot()
Expand Down Expand Up @@ -194,6 +194,14 @@ func (l *Leader) StartLeaderView(changedDataChan chan CampAPI, logChan chan stri
case "<Down>", "j":
v.ControlDash.ScrollDown()
v.Render()
//if mouse scroll down
case "<MouseWheelDown>", "h":
v.Logs.ScrollDown()
v.Render()

case "<MouseWheelUp>", "l":
v.Logs.ScrollUp()
v.Render()

case "<Enter>", "<Space>":
switch v.ControlDash.SelectedRow {
Expand Down
10 changes: 9 additions & 1 deletion client/soldierView.go
Expand Up @@ -80,7 +80,7 @@ func newSoldierView() *soldierView {
v.Logs.PaddingTop = 1
v.Logs.PaddingLeft = 2
v.Logs.TextStyle = ui.NewStyle(ui.ColorRed)
v.Logs.SelectedRowStyle = ui.NewStyle(ui.ColorRed)
v.Logs.SelectedRowStyle = ui.NewStyle(ui.ColorBlack, ui.ColorRed)
v.Logs.BorderStyle.Fg = ui.ColorMagenta
v.Logs.TitleStyle.Fg = ui.ColorBlue
v.TotalSpeed = widgets.NewPlot()
Expand Down Expand Up @@ -180,6 +180,14 @@ func StartSoldierView(changedDataChan chan CampAPI, logChan chan string) {
v.ControlDash.ScrollUp()
case "<Down>", "j":
v.ControlDash.ScrollDown()

case "<MouseWheelDown>", "h":
v.Logs.ScrollDown()
v.Render()

case "<MouseWheelUp>", "l":
v.Logs.ScrollUp()
v.Render()
}

case data := <-changedDataChan:
Expand Down

0 comments on commit 820039a

Please sign in to comment.