diff options
author | tomoya ishida <tomoyapenguin@gmail.com> | 2024-05-09 01:00:26 +0900 |
---|---|---|
committer | git <svn-admin@ruby-lang.org> | 2024-05-08 16:00:30 +0000 |
commit | 26446cccc9e8c4dfb7655ae686106a1ee200f2ec (patch) | |
tree | 6d0c63b4094564861d1d16c5ca5016e03554dfb6 /lib/reline.rb | |
parent | ad9c89fab8c532b4e5d926962c5d9d5ae5b01de4 (diff) | |
download | ruby-26446cccc9e8c4dfb7655ae686106a1ee200f2ec.tar.gz |
[ruby/reline] Implement bracketed paste insert
(https://github.com/ruby/reline/pull/655)
https://github.com/ruby/reline/commit/e92dcbf514
Diffstat (limited to 'lib/reline.rb')
-rw-r--r-- | lib/reline.rb | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/lib/reline.rb b/lib/reline.rb index d5bf2e363b..fb00b96531 100644 --- a/lib/reline.rb +++ b/lib/reline.rb @@ -312,6 +312,10 @@ module Reline $stderr.sync = true $stderr.puts "Reline is used by #{Process.pid}" end + unless config.test_mode or config.loaded? + config.read + io_gate.set_default_key_bindings(config) + end otio = io_gate.prep may_req_ambiguous_char_width @@ -338,11 +342,6 @@ module Reline end end - unless config.test_mode or config.loaded? - config.read - io_gate.set_default_key_bindings(config) - end - line_editor.print_nomultiline_prompt(prompt) line_editor.update_dialogs line_editor.rerender @@ -352,7 +351,15 @@ module Reline loop do read_io(config.keyseq_timeout) { |inputs| line_editor.set_pasting_state(io_gate.in_pasting?) - inputs.each { |key| line_editor.update(key) } + inputs.each do |key| + if key.char == :bracketed_paste_start + text = io_gate.read_bracketed_paste + line_editor.insert_pasted_text(text) + line_editor.scroll_into_view + else + line_editor.update(key) + end + end } if line_editor.finished? line_editor.render_finished |