fix: renderer: remove unused repaint functionality

This commit is contained in:
Ayman Bagabas 2025-10-14 13:54:37 -04:00
parent 1f4de36e76
commit e9e4d1d87b
No known key found for this signature in database
GPG key ID: C8D51D2157C919AC
3 changed files with 0 additions and 27 deletions

View file

@ -69,9 +69,6 @@ func (s *cursedRenderer) start() {
s.mu.Lock()
defer s.mu.Unlock()
// Force a full repaint to ensure the screen is in a consistent state.
repaint(s)
if s.lastView == nil {
return
}
@ -529,7 +526,6 @@ func (s *cursedRenderer) resize(w, h int) {
s.scr.Resize(s.width, s.height)
s.width, s.height = w, h
repaint(s)
s.mu.Unlock()
}
@ -540,15 +536,11 @@ func (s *cursedRenderer) clearScreen() {
// screen redraw.
_, _ = s.scr.WriteString(ansi.CursorHomePosition)
s.scr.Redraw(s.buf.Buffer) // force redraw
repaint(s)
s.mu.Unlock()
}
// enableAltScreen sets the alt screen mode.
func enableAltScreen(s *cursedRenderer, enable bool) {
if enable != s.scr.AltScreen() {
repaint(s)
}
if enable {
s.scr.EnterAltScreen()
} else {
@ -609,16 +601,6 @@ func (s *cursedRenderer) insertAbove(lines string) {
s.mu.Unlock()
}
func (s *cursedRenderer) repaint() {
s.mu.Lock()
repaint(s)
s.mu.Unlock()
}
func repaint(s *cursedRenderer) {
s.scr.Erase()
}
func setProgressBar(s *cursedRenderer, pb *ProgressBar) {
if pb == nil {
_, _ = s.scr.WriteString(ansi.ResetProgressBar)

View file

@ -57,15 +57,9 @@ type renderer interface {
// clearScreen clears the screen.
clearScreen()
// repaint forces a full repaint.
repaint()
writeString(string) (int, error)
}
// repaintMsg forces a full repaint.
type repaintMsg struct{}
type printLineMessage struct {
messageBody string
}

3
tea.go
View file

@ -772,9 +772,6 @@ func (p *Program) eventLoop(model Model, cmds chan Cmd) (Model, error) {
case printLineMessage:
p.renderer.insertAbove(msg.messageBody)
case repaintMsg:
p.renderer.repaint()
case clearScreenMsg:
p.renderer.clearScreen()