mirror of
https://github.com/taigrr/bubbletea.git
synced 2026-04-02 02:59:09 -07:00
Clear output and render "nothing" when a view returns the empty string
Closes #100.
This commit is contained in:
@@ -205,6 +205,15 @@ func (r *standardRenderer) write(s string) {
|
||||
r.mtx.Lock()
|
||||
defer r.mtx.Unlock()
|
||||
r.buf.Reset()
|
||||
|
||||
// If an empty string was passed we should clear existing output and
|
||||
// rendering nothing. Rather than introduce additional state to manage
|
||||
// this, we render a single space as a simple (albeit less correct)
|
||||
// solution.
|
||||
if s == "" {
|
||||
s = " "
|
||||
}
|
||||
|
||||
_, _ = r.buf.WriteString(s)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user