Send newlines instead of cursor-downs in performance viewport

This commit is contained in:
Christian Rocha 2020-06-18 18:31:30 -04:00
parent d095a6554c
commit b82cf5071d
No known key found for this signature in database
GPG Key ID: D6CC7A16E5878018

View File

@ -1,11 +1,9 @@
package viewport package viewport
import ( import (
"fmt"
"strings" "strings"
tea "github.com/charmbracelet/bubbletea" tea "github.com/charmbracelet/bubbletea"
te "github.com/muesli/termenv"
) )
// MODEL // MODEL
@ -324,8 +322,10 @@ func Update(msg tea.Msg, m Model) (Model, tea.Cmd) {
func View(m Model) string { func View(m Model) string {
if m.HighPerformanceRendering { if m.HighPerformanceRendering {
// Skip over the area that would normally be rendered // Just send newlines since we're doing to be rendering the actual
return fmt.Sprintf(te.CSI+te.CursorDownSeq, m.Height) // content seprately. We do need to send something so that the Bubble
// Tea standard renderer can push everything else down.
return strings.Repeat("\n", m.Height-1)
} }
if m.Err != nil { if m.Err != nil {