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

update view cursor when selecting new line in patch explorer view

This commit is contained in:
Jesse Duffield
2023-02-16 21:31:10 +11:00
parent 8cad8cda8f
commit c517d1e0a2
8 changed files with 82 additions and 45 deletions

View File

@ -1226,8 +1226,10 @@ func (g *Gui) onKey(ev *GocuiEvent) error {
newCx = lastCharForLine
}
}
if err := v.SetCursor(newCx, newCy); err != nil {
return err
if !IsMouseScrollKey(ev.Key) {
if err := v.SetCursor(newCx, newCy); err != nil {
return err
}
}
if IsMouseKey(ev.Key) {
@ -1289,6 +1291,19 @@ func IsMouseKey(key interface{}) bool {
}
}
func IsMouseScrollKey(key interface{}) bool {
switch key {
case
MouseWheelUp,
MouseWheelDown,
MouseWheelLeft,
MouseWheelRight:
return true
default:
return false
}
}
// execKeybindings executes the keybinding handlers that match the passed view
// and event. The value of matched is true if there is a match and no errors.
func (g *Gui) execKeybindings(v *View, ev *GocuiEvent) (matched bool, err error) {