From 45cb5208e8ff42601523ad6ac0ae3408801dcf8d Mon Sep 17 00:00:00 2001 From: Satoshi Kinoshita Date: Thu, 14 Mar 2019 16:47:47 +0900 Subject: [PATCH] use shorter escape sequence --- runebuf.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/runebuf.go b/runebuf.go index 6059b22..432ab59 100644 --- a/runebuf.go +++ b/runebuf.go @@ -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++ {