fix issule #169 for single line case

This commit is contained in:
Satoshi Kinoshita 2019-03-13 15:40:38 +09:00
parent 2972be24d4
commit 30ec85bccf
1 changed files with 2 additions and 2 deletions

View File

@ -597,8 +597,8 @@ func (r *RuneBuffer) cleanOutput(w io.Writer, idxLine int) {
} else { } else {
buf.Write([]byte("\033[J")) // just like ^k :) buf.Write([]byte("\033[J")) // just like ^k :)
if idxLine == 0 { if idxLine == 0 {
buf.WriteString("\033[2K") buf.WriteString(strings.Repeat("\033[D", r.idx + r.promptLen()))
buf.WriteString("\r") buf.Write([]byte("\033[J"))
} else { } else {
for i := 0; i < idxLine; i++ { for i := 0; i < idxLine; i++ {
io.WriteString(buf, "\033[2K\r\033[A") io.WriteString(buf, "\033[2K\r\033[A")