Module: Irb::Autosuggestions::LineEditorPatch
- Defined in:
- lib/irb/autosuggestions/line_editor_patch.rb
Overview
Patches Reline::LineEditor to display fish-like autosuggestions from history.
Constant Summary collapse
- GRAY =
"\e[90m"- RESET =
"\e[0m"- CONFIG_KEY =
:USE_AUTOSUGGESTIONS- ENV_KEY =
'IRB_AUTOSUGGESTIONS'
Instance Method Summary collapse
-
#input_key(key) ⇒ Object
Intercepts key input to accept autosuggestions on right arrow.
Instance Method Details
#input_key(key) ⇒ Object
Intercepts key input to accept autosuggestions on right arrow.
16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/irb/autosuggestions/line_editor_patch.rb', line 16 def input_key(key) if enabled? && right_arrow?(key) buffer = whole_buffer suggestion = find_suggestion(buffer) if suggestion && suggestion != buffer accept_suggestion(suggestion) return end end super end |