1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-07-05 00:59:19 +02:00

allow scrolling when staging lines or building patch

This commit is contained in:
Jesse Duffield
2021-04-02 14:33:20 +11:00
parent 5f77ac8d6f
commit 3ea5e4d4b2
7 changed files with 36 additions and 52 deletions

View File

@ -177,6 +177,8 @@ func pollEvent() GocuiEvent {
mouseKey = MouseWheelRight
}
wheeling := mouseKey == MouseWheelUp || mouseKey == MouseWheelDown || mouseKey == MouseWheelLeft || mouseKey == MouseWheelRight
// process button events (not wheel events)
button &= tcell.ButtonMask(0xff)
if button != tcell.ButtonNone && lastMouseKey == tcell.ButtonNone {
@ -210,17 +212,19 @@ func pollEvent() GocuiEvent {
}
}
switch dragState {
case NOT_DRAGGING:
return GocuiEvent{Type: eventNone}
// if we haven't released the left mouse button and we've moved the cursor then we're dragging
case MAYBE_DRAGGING:
if x != lastX || y != lastY {
dragState = DRAGGING
if !wheeling {
switch dragState {
case NOT_DRAGGING:
return GocuiEvent{Type: eventNone}
// if we haven't released the left mouse button and we've moved the cursor then we're dragging
case MAYBE_DRAGGING:
if x != lastX || y != lastY {
dragState = DRAGGING
}
case DRAGGING:
mouseMod = ModMotion
mouseKey = MouseLeft
}
case DRAGGING:
mouseMod = ModMotion
mouseKey = MouseLeft
}
return GocuiEvent{