mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-07-31 14:24:25 +03:00
Pass "now" into utils.Loader
This makes it possible to write deterministic tests for views that use it.
This commit is contained in:
@ -28,9 +28,8 @@ func GetProjectRoot() string {
|
||||
const LoaderAnimationInterval = 50
|
||||
|
||||
// Loader dumps a string to be displayed as a loader
|
||||
func Loader() string {
|
||||
func Loader(now time.Time) string {
|
||||
characters := "|/-\\"
|
||||
now := time.Now()
|
||||
milliseconds := now.UnixMilli()
|
||||
index := milliseconds / LoaderAnimationInterval % int64(len(characters))
|
||||
return characters[index : index+1]
|
||||
|
Reference in New Issue
Block a user