mirror of https://github.com/chzyer/readline.git
fixed backescape the first word in buffer
This commit is contained in:
parent
2972be24d4
commit
16c12bf43b
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue