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

Move Loader to presentation package

It is very gui specific and shouldn't be in a low-level utils package.
This commit is contained in:
Stefan Haller
2025-05-06 09:52:53 +02:00
parent a6a68778ea
commit 252dda5220
6 changed files with 19 additions and 16 deletions

View File

@ -8,10 +8,8 @@ import (
"runtime"
"strconv"
"strings"
"time"
"github.com/jesseduffield/gocui"
"github.com/jesseduffield/lazygit/pkg/config"
)
// GetProjectRoot returns the path to the root of the project. Only to be used
@ -25,13 +23,6 @@ func GetProjectRoot() string {
return strings.Split(dir, "lazygit")[0] + "lazygit"
}
// Loader dumps a string to be displayed as a loader
func Loader(now time.Time, config config.SpinnerConfig) string {
milliseconds := now.UnixMilli()
index := milliseconds / int64(config.Rate) % int64(len(config.Frames))
return config.Frames[index]
}
func SortRange(x int, y int) (int, int) {
if x < y {
return x, y