summaryrefslogtreecommitdiff
path: root/lib/reline.rb
diff options
context:
space:
mode:
authoraycabta <aycabta@gmail.com>2020-10-20 08:39:12 +0900
committeraycabta <aycabta@gmail.com>2020-12-05 02:58:58 +0900
commit55cc397a87dbfaa5d95168ce05f9a0d20339c657 (patch)
tree3f5fa43ad24e444e52e50fc7e32ae66b9483a3e2 /lib/reline.rb
parent4291ff370f88c9cbb83913b1d18e3f6206758b14 (diff)
[ruby/reline] Suppress callbacks in pasting
IRB uses Reline's 3 dynamic real-time callbacks with calling Ripper; output_modifier_proc, prompt_proc, and auto_indent_proc. These processing times make the paste time too long. https://github.com/ruby/reline/commit/beec3399a8
Diffstat (limited to 'lib/reline.rb')
-rw-r--r--lib/reline.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/reline.rb b/lib/reline.rb
index eb18d0d075..2862f5bc64 100644
--- a/lib/reline.rb
+++ b/lib/reline.rb
@@ -235,13 +235,19 @@ module Reline
line_editor.rerender
begin
+ prev_pasting_state = false
loop do
+ prev_pasting_state = Reline::IOGate.in_pasting?
read_io(config.keyseq_timeout) { |inputs|
inputs.each { |c|
line_editor.input_key(c)
line_editor.rerender
}
}
+ if prev_pasting_state == true and not Reline::IOGate.in_pasting? and not line_editor.finished?
+ prev_pasting_state = false
+ line_editor.rerender_all
+ end
break if line_editor.finished?
end
Reline::IOGate.move_cursor_column(0)