Skip to content

Commit 16c12bf

Browse files
author
Pavel Vorobyov
committed
fixed backescape the first word in buffer
1 parent 2972be2 commit 16c12bf

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

runebuf.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -331,8 +331,8 @@ func (r *RuneBuffer) BackEscapeWord() {
331331
if r.idx == 0 {
332332
return
333333
}
334-
for i := r.idx - 1; i > 0; i-- {
335-
if !IsWordBreak(r.buf[i]) && IsWordBreak(r.buf[i-1]) {
334+
for i := r.idx - 1; i >= 0; i-- {
335+
if !IsWordBreak(r.buf[i]) && (i == 0 || IsWordBreak(r.buf[i-1])) {
336336
r.pushKill(r.buf[i:r.idx])
337337
r.buf = append(r.buf[:i], r.buf[r.idx:]...)
338338
r.idx = i

0 commit comments

Comments
 (0)