use shorter escape sequence

This commit is contained in:
Satoshi Kinoshita 2019-03-14 16:47:47 +09:00
parent 779fc2ceca
commit 45cb5208e8
1 changed files with 2 additions and 1 deletions

View File

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