From e668c71600235301a633f4a44e80144c83b145c4 Mon Sep 17 00:00:00 2001 From: silentttxo <8359251@qq.com> Date: Wed, 17 Jul 2019 19:18:41 +0800 Subject: [PATCH] fix: when input contains character where width > 1, such like chinese, cursor will in a wrong place, and never can back to the sentence`s head --- runebuf.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/runebuf.go b/runebuf.go index 81d2da5..442a3b5 100644 --- a/runebuf.go +++ b/runebuf.go @@ -527,8 +527,10 @@ func (r *RuneBuffer) getBackspaceSequence() []byte { } var buf []byte for i := len(r.buf); i > r.idx; i-- { - // move input to the left of one - buf = append(buf, '\b') + // move input to the left of one, fix character where width > 1, such like chinese + for j:=0;j