ruby / reline

The compatible library with the API of Ruby's stdlib 'readline'

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Reline calls completion_proc too many times

tompng opened this issue · comments

Reline calls Reline.completion_proc too many times. The recalculated result is not used at all.

require 'reline'
Reline.completion_proc = ->(target) {
  $> << "\a" # Too many beep sound
  rand(4..10).times.map { target + rand(1000).to_s(36) } # The recalculated result is completely ignored
}
Reline.autocompletion = true
Reline.readmultiline('> '){false}

# > type `a` and press TAB key many times

This behavior might be a potential performance issue.
This is causing dialog disappear when completing xxx= method in IRB.
It is also making IRB's new TypeCompletion showing document dialog hard. IRB fails to show document just after completing keywords like and alias. (Type a and press TAB key 4 times in IRB)