Skip to content
Myr

Move last render height info to the program level

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Christian Rocha · committed by Christian Rocha · parent b72cce8 · Browse files · 1 file+4 added−6 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+4 added−6 removed

  • other:+4 added−6 removed

1 file+4 added−6 removed

modified:tea.go+4 added-6 removed
8 unmodified lines
910 "github.com/pkg/term"11)1213// The number of lines we last rendered14var linesRendered = 01513// Msg represents an action. It's used by Update to update the UI.14type Msg interface{}1516// Model contains the updatable data for an application
18 unmodified lines
35 update Update36 view View37 subscriptions []Sub38 rw io.ReadWriter39 linesRendered int40}4142// ErrMsg is just a regular message containing an error. We handle it in Update43// just like a regular message by case switching. Of course, the developer
118 unmodified lines
162 // We need to add carriage returns to ensure that the cursor travels to the163 // start of a column after a newline164 view = strings.Replace(view, "\n", "\r\n", -1)165168 if linesRendered > 0 {169 clearLines(linesRendered)166 if p.linesRendered > 0 {167 clearLines(p.linesRendered)168 }169 io.WriteString(p.rw, view)172 linesRendered = strings.Count(view, "\r\n")170 p.linesRendered = strings.Count(view, "\r\n")171}172173// UseSysLog sets up logging to log the system log. This becomes helpful when174// debugging since we can't easily print to the terminal since our TUI is
11 unmodified lines