Skip to content

Commit 7f93d88

Browse files
committed
fixing deadloop when input is filtered
1 parent 8e4bd41 commit 7f93d88

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

operation.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,10 +109,12 @@ func (o *Operation) ioloop() {
109109
keepInSearchMode := false
110110
keepInCompleteMode := false
111111
r := o.t.ReadRune()
112+
112113
if o.GetConfig().FuncFilterInputRune != nil {
113114
var process bool
114115
r, process = o.GetConfig().FuncFilterInputRune(r)
115116
if !process {
117+
o.t.KickRead()
116118
o.buf.Refresh(nil) // to refresh the line
117119
continue // ignore this rune
118120
}

runebuf.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ type RuneBuffer struct {
3535
sync.Mutex
3636
}
3737

38-
func (r* RuneBuffer) pushKill(text []rune) {
38+
func (r *RuneBuffer) pushKill(text []rune) {
3939
r.lastKill = append([]rune{}, text...)
4040
}
4141

@@ -221,7 +221,7 @@ func (r *RuneBuffer) DeleteWord() {
221221
}
222222
for i := init + 1; i < len(r.buf); i++ {
223223
if !IsWordBreak(r.buf[i]) && IsWordBreak(r.buf[i-1]) {
224-
r.pushKill(r.buf[r.idx:i-1])
224+
r.pushKill(r.buf[r.idx : i-1])
225225
r.Refresh(func() {
226226
r.buf = append(r.buf[:r.idx], r.buf[i-1:]...)
227227
})
@@ -350,7 +350,7 @@ func (r *RuneBuffer) Yank() {
350350
return
351351
}
352352
r.Refresh(func() {
353-
buf := make([]rune, 0, len(r.buf) + len(r.lastKill))
353+
buf := make([]rune, 0, len(r.buf)+len(r.lastKill))
354354
buf = append(buf, r.buf[:r.idx]...)
355355
buf = append(buf, r.lastKill...)
356356
buf = append(buf, r.buf[r.idx:]...)

0 commit comments

Comments
 (0)