From 21e49dc3b7528ac3678f5550d07f98b4aca98c74 Mon Sep 17 00:00:00 2001 From: Stefan Haller Date: Mon, 6 Apr 2026 20:07:24 +0200 Subject: [PATCH] Remove unused View.HasLoader functionality --- pkg/gocui/gui.go | 7 ------- pkg/gocui/loader.go | 31 ------------------------------- pkg/gocui/view.go | 10 +--------- 3 files changed, 1 insertion(+), 47 deletions(-) delete mode 100644 pkg/gocui/loader.go diff --git a/pkg/gocui/gui.go b/pkg/gocui/gui.go index 81ddd4ce3..646efc88a 100644 --- a/pkg/gocui/gui.go +++ b/pkg/gocui/gui.go @@ -1609,13 +1609,6 @@ func (g *Gui) StartTicking(ctx context.Context) { if g.suspended { continue outer } - - for _, view := range g.Views() { - if view.HasLoader { - g.UpdateAsync(func(g *Gui) error { return nil }) - continue outer - } - } return case <-ctx.Done(): return diff --git a/pkg/gocui/loader.go b/pkg/gocui/loader.go deleted file mode 100644 index 5f76db7ba..000000000 --- a/pkg/gocui/loader.go +++ /dev/null @@ -1,31 +0,0 @@ -package gocui - -import "time" - -func (v *View) loaderLines() [][]cell { - duplicate := make([][]cell, len(v.lines)) - for i := range v.lines { - if i < len(v.lines)-1 { - duplicate[i] = make([]cell, len(v.lines[i])) - copy(duplicate[i], v.lines[i]) - } else { - duplicate[i] = make([]cell, len(v.lines[i])+2) - copy(duplicate[i], v.lines[i]) - duplicate[i][len(duplicate[i])-2] = cell{chr: " "} - duplicate[i][len(duplicate[i])-1] = Loader() - } - } - - return duplicate -} - -// Loader can show a loading animation -func Loader() cell { - frames := []string{"|", "/", "-", "\\"} - now := time.Now() - nanos := now.UnixNano() - index := nanos / 50000000 % int64(len(frames)) - return cell{ - chr: frames[index], - } -} diff --git a/pkg/gocui/view.go b/pkg/gocui/view.go index 1ef40e569..697ca2029 100644 --- a/pkg/gocui/view.go +++ b/pkg/gocui/view.go @@ -164,9 +164,6 @@ type View struct { // Overlaps describes which edges are overlapping with another view's edges Overlaps byte - // If HasLoader is true, the message will be appended with a spinning loader animation - HasLoader bool - // ParentView is the view which catches events bubbled up from the given view if there's no matching handler ParentView *View @@ -1315,9 +1312,6 @@ func (v *View) refreshViewLinesIfNeeded() { maxX := v.InnerWidth() lineIdx := 0 lines := v.lines - if v.HasLoader { - lines = v.loaderLines() - } for i, line := range lines { wrap := 0 if v.Wrap { @@ -1336,9 +1330,7 @@ func (v *View) refreshViewLinesIfNeeded() { lineIdx++ } } - if !v.HasLoader { - v.tainted = false - } + v.tainted = false } }