mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-01-24 05:36:19 +02:00
refactor
This commit is contained in:
parent
9a9e3d506d
commit
1d40d03bb2
@ -2,6 +2,8 @@ package gui
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
|
"github.com/jesseduffield/gocui"
|
||||||
)
|
)
|
||||||
|
|
||||||
type ListContext struct {
|
type ListContext struct {
|
||||||
@ -160,22 +162,14 @@ func (self *ListContext) handleNextLine() error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (self *ListContext) handleScrollLeft() error {
|
func (self *ListContext) handleScrollLeft() error {
|
||||||
if self.ignoreKeybinding() {
|
return self.scroll(self.Gui.scrollLeft)
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// get the view, move the origin
|
|
||||||
view, err := self.Gui.g.View(self.ViewName)
|
|
||||||
if err != nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
self.Gui.scrollLeft(view)
|
|
||||||
|
|
||||||
return self.HandleFocus()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (self *ListContext) handleScrollRight() error {
|
func (self *ListContext) handleScrollRight() error {
|
||||||
|
return self.scroll(self.Gui.scrollRight)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (self *ListContext) scroll(scrollFunc func(*gocui.View)) error {
|
||||||
if self.ignoreKeybinding() {
|
if self.ignoreKeybinding() {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@ -186,7 +180,7 @@ func (self *ListContext) handleScrollRight() error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
self.Gui.scrollRight(view)
|
scrollFunc(view)
|
||||||
|
|
||||||
return self.HandleFocus()
|
return self.HandleFocus()
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user