fixed backescape the first word in buffer

This commit is contained in:
Pavel Vorobyov 2018-11-06 14:16:27 +03:00
parent 2972be24d4
commit 16c12bf43b
1 changed files with 2 additions and 2 deletions

View File

@ -331,8 +331,8 @@ func (r *RuneBuffer) BackEscapeWord() {
if r.idx == 0 { if r.idx == 0 {
return return
} }
for i := r.idx - 1; i > 0; i-- { for i := r.idx - 1; i >= 0; i-- {
if !IsWordBreak(r.buf[i]) && IsWordBreak(r.buf[i-1]) { if !IsWordBreak(r.buf[i]) && (i == 0 || IsWordBreak(r.buf[i-1])) {
r.pushKill(r.buf[i:r.idx]) r.pushKill(r.buf[i:r.idx])
r.buf = append(r.buf[:i], r.buf[r.idx:]...) r.buf = append(r.buf[:i], r.buf[r.idx:]...)
r.idx = i r.idx = i