forked from Mirrors/bubbletea
Clear output and render "nothing" when a view returns the empty string
Closes #100.
This commit is contained in:
parent
1f773e8f20
commit
6547773a3f
|
@ -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)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue