1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-07-30 03:23:08 +03:00

lots of changes

This commit is contained in:
Jesse Duffield
2023-03-23 18:47:29 +11:00
parent 711674f6cd
commit db12853bbe
63 changed files with 1024 additions and 943 deletions

View File

@ -3,15 +3,14 @@ package gui
import (
"fmt"
"github.com/jesseduffield/generics/slices"
"github.com/jesseduffield/lazygit/pkg/constants"
"github.com/jesseduffield/lazygit/pkg/gui/style"
"github.com/mattn/go-runewidth"
)
func (gui *Gui) informationStr() string {
if activeMode, ok := gui.getActiveMode(); ok {
return activeMode.description()
if activeMode, ok := gui.helpers.Mode.GetActiveMode(); ok {
return activeMode.Description()
}
if gui.g.Mouse {
@ -23,18 +22,6 @@ func (gui *Gui) informationStr() string {
}
}
func (gui *Gui) getActiveMode() (modeStatus, bool) {
return slices.Find(gui.modeStatuses(), func(mode modeStatus) bool {
return mode.isActive()
})
}
func (gui *Gui) isAnyModeActive() bool {
return slices.Some(gui.modeStatuses(), func(mode modeStatus) bool {
return mode.isActive()
})
}
func (gui *Gui) handleInfoClick() error {
if !gui.g.Mouse {
return nil
@ -45,11 +32,11 @@ func (gui *Gui) handleInfoClick() error {
cx, _ := view.Cursor()
width, _ := view.Size()
if activeMode, ok := gui.getActiveMode(); ok {
if activeMode, ok := gui.helpers.Mode.GetActiveMode(); ok {
if width-cx > runewidth.StringWidth(gui.c.Tr.ResetInParentheses) {
return nil
}
return activeMode.reset()
return activeMode.Reset()
}
// if we're not in an active mode we show the donate button