1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-08-24 19:39:16 +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{

4
vendor/modules.txt vendored
View File

@@ -149,7 +149,7 @@ github.com/jesseduffield/go-git/v5/utils/merkletrie/filesystem
github.com/jesseduffield/go-git/v5/utils/merkletrie/index
github.com/jesseduffield/go-git/v5/utils/merkletrie/internal/frame
github.com/jesseduffield/go-git/v5/utils/merkletrie/noder
# github.com/jesseduffield/gocui v0.3.1-0.20210329131148-bcc4dcd991ff
# github.com/jesseduffield/gocui v0.3.1-0.20210402033412-1238f910f001
## explicit
github.com/jesseduffield/gocui
# github.com/jesseduffield/termbox-go v0.0.0-20200823212418-a2289ed6aafe
@@ -245,7 +245,7 @@ golang.org/x/sys/windows
# golang.org/x/term v0.0.0-20210317153231-de623e64d2a6
## explicit
golang.org/x/term
# golang.org/x/text v0.3.5
# golang.org/x/text v0.3.6
## explicit
golang.org/x/text/encoding
golang.org/x/text/encoding/internal/identifier