Skip to content

Commit 4a65431

Browse files
committed
add support to mouse scroll
1 parent f04282d commit 4a65431

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

cmd/monitor/monitor.go

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -722,11 +722,14 @@ func renderMonitorUI(ctx context.Context, ec *ethclient.Client, ms *monitorStatu
722722
_, termHeight = termui.TerminalDimensions()
723723
windowSize = termHeight/2 - 4
724724
termui.Clear()
725-
case "<Up>", "<Down>":
725+
case "<Up>", "<Down>", "<MouseWheelUp>", "<MouseWheelDown>":
726+
up := e.ID == "<Up>" || e.ID == "<MouseWheelUp>"
727+
down := e.ID == "<Down>" || e.ID == "<MouseWheelDown>"
728+
726729
if currentMode == monitorModeBlock {
727-
if len(transactionList.Rows) != 0 && e.ID == "<Down>" {
730+
if len(transactionList.Rows) != 0 && down {
728731
transactionList.ScrollDown()
729-
} else if len(transactionList.Rows) != 0 && e.ID == "<Up>" {
732+
} else if len(transactionList.Rows) != 0 && up {
730733
transactionList.ScrollUp()
731734
}
732735
break
@@ -739,7 +742,7 @@ func renderMonitorUI(ctx context.Context, ec *ethclient.Client, ms *monitorStatu
739742
break
740743
}
741744

742-
if e.ID == "<Down>" {
745+
if down {
743746
log.Debug().
744747
Int("blockTable.SelectedRow", blockTable.SelectedRow).
745748
Int("windowSize", windowSize).
@@ -778,7 +781,7 @@ func renderMonitorUI(ctx context.Context, ec *ethclient.Client, ms *monitorStatu
778781
// blockTable.SelectedRow += 1
779782
blockTable.ScrollDown()
780783
setBlock = true
781-
} else if e.ID == "<Up>" {
784+
} else if up {
782785
log.Debug().Int("blockTable.SelectedRow", blockTable.SelectedRow).Int("windowSize", windowSize).Msg("Up")
783786

784787
// the last row of current window size

0 commit comments

Comments
 (0)