From 16c12bf43bab64982b2aa5e328ee30db4c1216e2 Mon Sep 17 00:00:00 2001 From: Pavel Vorobyov Date: Tue, 6 Nov 2018 14:16:27 +0300 Subject: [PATCH] fixed backescape the first word in buffer --- runebuf.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/runebuf.go b/runebuf.go index 81d2da5..9fa655e 100644 --- a/runebuf.go +++ b/runebuf.go @@ -331,8 +331,8 @@ func (r *RuneBuffer) BackEscapeWord() { if r.idx == 0 { return } - for i := r.idx - 1; i > 0; i-- { - if !IsWordBreak(r.buf[i]) && IsWordBreak(r.buf[i-1]) { + for i := r.idx - 1; i >= 0; i-- { + if !IsWordBreak(r.buf[i]) && (i == 0 || IsWordBreak(r.buf[i-1])) { r.pushKill(r.buf[i:r.idx]) r.buf = append(r.buf[:i], r.buf[r.idx:]...) r.idx = i