Add flush
This commit is contained in:
parent
aa686033e9
commit
4c3cbd3c3c
@ -22,6 +22,7 @@ func (c *CompletionManager) GetSelectedSuggestion() (s Suggest, ok bool) {
|
||||
return Suggest{}, false
|
||||
} else if c.selected < -1 {
|
||||
log.Printf("[ERROR] shoud be reached here, selected=%d", c.selected)
|
||||
c.selected = -1
|
||||
return Suggest{}, false
|
||||
}
|
||||
return c.tmp[c.selected], true
|
||||
|
@ -1,9 +1,5 @@
|
||||
package prompt
|
||||
|
||||
import (
|
||||
"log"
|
||||
)
|
||||
|
||||
const (
|
||||
leftPrefix = " "
|
||||
leftSuffix = " "
|
||||
@ -98,7 +94,6 @@ func (r *Render) renderCompletion(buf *Buffer, completions *CompletionManager) {
|
||||
suggestions,
|
||||
int(r.col)-len(r.prefix),
|
||||
)
|
||||
log.Printf("[INFO] formatted: %#v\n", formatted)
|
||||
l := len(formatted)
|
||||
r.prepareArea(l)
|
||||
|
||||
|
@ -12,6 +12,8 @@ type VT100Writer struct {
|
||||
|
||||
func (w *VT100Writer) WriteRaw(data []byte) {
|
||||
w.buffer = append(w.buffer, data...)
|
||||
// Flush because sometimes the render is broken when a large amount data in buffer.
|
||||
w.Flush()
|
||||
return
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user