mirror of
https://github.com/jesseduffield/lazygit.git
synced 2024-11-30 09:16:47 +02:00
Added another resizing step
This commit is contained in:
parent
07fec6d00e
commit
6ba05c94ea
@ -344,23 +344,44 @@ func (gui *Gui) layout(g *gocui.Gui) error {
|
||||
}
|
||||
}
|
||||
|
||||
statusFilesBoundary = optionsTop - 12
|
||||
filesBranchesBoundary = optionsTop - 9
|
||||
commitsBranchesBoundary = optionsTop - 6
|
||||
commitsStashBoundary = optionsTop - 3
|
||||
if height < 21 {
|
||||
statusFilesBoundary = optionsTop - 8
|
||||
filesBranchesBoundary = optionsTop - 6
|
||||
commitsBranchesBoundary = optionsTop - 4
|
||||
commitsStashBoundary = optionsTop - 2
|
||||
|
||||
switch currentCyclebleView {
|
||||
case "stash":
|
||||
commitsStashBoundary = 11
|
||||
fallthrough
|
||||
case "commits":
|
||||
commitsBranchesBoundary = 8
|
||||
fallthrough
|
||||
case "branches":
|
||||
filesBranchesBoundary = 5
|
||||
fallthrough
|
||||
case "files":
|
||||
statusFilesBoundary = 2
|
||||
switch currentCyclebleView {
|
||||
case "stash":
|
||||
commitsStashBoundary = 7
|
||||
fallthrough
|
||||
case "commits":
|
||||
commitsBranchesBoundary = 5
|
||||
fallthrough
|
||||
case "branches":
|
||||
filesBranchesBoundary = 3
|
||||
fallthrough
|
||||
case "files":
|
||||
statusFilesBoundary = 1
|
||||
}
|
||||
} else {
|
||||
statusFilesBoundary = optionsTop - 12
|
||||
filesBranchesBoundary = optionsTop - 9
|
||||
commitsBranchesBoundary = optionsTop - 6
|
||||
commitsStashBoundary = optionsTop - 3
|
||||
|
||||
switch currentCyclebleView {
|
||||
case "stash":
|
||||
commitsStashBoundary = 11
|
||||
fallthrough
|
||||
case "commits":
|
||||
commitsBranchesBoundary = 8
|
||||
fallthrough
|
||||
case "branches":
|
||||
filesBranchesBoundary = 5
|
||||
fallthrough
|
||||
case "files":
|
||||
statusFilesBoundary = 2
|
||||
}
|
||||
}
|
||||
} else {
|
||||
statusFilesBoundary = 2
|
||||
|
@ -173,9 +173,7 @@ func (gui *Gui) switchFocus(g *gocui.Gui, oldView, newView *gocui.View) error {
|
||||
}
|
||||
|
||||
func (gui *Gui) resetOrigin(v *gocui.View) error {
|
||||
if err := v.SetCursor(0, 0); err != nil {
|
||||
return err
|
||||
}
|
||||
_ = v.SetCursor(0, 0)
|
||||
return v.SetOrigin(0, 0)
|
||||
}
|
||||
|
||||
@ -186,36 +184,26 @@ func (gui *Gui) focusPoint(cx int, cy int, lineCount int, v *gocui.View) error {
|
||||
}
|
||||
ox, oy := v.Origin()
|
||||
_, height := v.Size()
|
||||
|
||||
ly := height - 1
|
||||
if ly == -1 {
|
||||
ly = 0
|
||||
}
|
||||
|
||||
// if line is above origin, move origin and set cursor to zero
|
||||
// if line is below origin + height, move origin and set cursor to max
|
||||
// otherwise set cursor to value - origin
|
||||
if ly > lineCount {
|
||||
if err := v.SetCursor(cx, cy); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := v.SetOrigin(ox, 0); err != nil {
|
||||
return err
|
||||
}
|
||||
_ = v.SetCursor(cx, cy)
|
||||
_ = v.SetOrigin(ox, 0)
|
||||
} else if cy < oy {
|
||||
if err := v.SetCursor(cx, 0); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := v.SetOrigin(ox, cy); err != nil {
|
||||
return err
|
||||
}
|
||||
_ = v.SetCursor(cx, 0)
|
||||
_ = v.SetOrigin(ox, cy)
|
||||
} else if cy > oy+ly {
|
||||
if err := v.SetCursor(cx, ly); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := v.SetOrigin(ox, cy-ly); err != nil {
|
||||
return err
|
||||
}
|
||||
_ = v.SetCursor(cx, ly)
|
||||
_ = v.SetOrigin(ox, cy-ly)
|
||||
} else {
|
||||
if err := v.SetCursor(cx, cy-oy); err != nil {
|
||||
return err
|
||||
}
|
||||
_ = v.SetCursor(cx, cy-oy)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user