diff options
author | aycabta <aycabta@gmail.com> | 2020-11-08 21:56:27 +0900 |
---|---|---|
committer | aycabta <aycabta@gmail.com> | 2020-12-05 02:58:58 +0900 |
commit | 9750c27afc99034960b74e8951718ca07cc353a8 (patch) | |
tree | ae96e40e00356d2c0f459e9aace599fe5be63996 /lib | |
parent | ba8e5f77eb2562cc0605f1414426a34c7e844964 (diff) | |
download | ruby-9750c27afc99034960b74e8951718ca07cc353a8.tar.gz |
[ruby/reline] Call process_insert when the end of pasting plural fullwidth chars
https://github.com/ruby/reline/commit/594484d9f9
Diffstat (limited to 'lib')
-rw-r--r-- | lib/reline/general_io.rb | 16 | ||||
-rw-r--r-- | lib/reline/line_editor.rb | 2 |
2 files changed, 17 insertions, 1 deletions
diff --git a/lib/reline/general_io.rb b/lib/reline/general_io.rb index 3b40888bed..01a592e038 100644 --- a/lib/reline/general_io.rb +++ b/lib/reline/general_io.rb @@ -1,6 +1,10 @@ require 'timeout' class Reline::GeneralIO + def self.reset + @@pasting = false + end + def self.encoding RUBY_PLATFORM =~ /mswin|mingw/ ? Encoding::UTF_8 : Encoding::default_external end @@ -67,8 +71,18 @@ class Reline::GeneralIO def self.set_winch_handler(&handler) end + @@pasting = false + def self.in_pasting? - false + @@pasting + end + + def self.start_pasting + @@pasting = true + end + + def self.finish_pasting + @@pasting = false end def self.prep diff --git a/lib/reline/line_editor.rb b/lib/reline/line_editor.rb index f9ef980cf4..10ce208e93 100644 --- a/lib/reline/line_editor.rb +++ b/lib/reline/line_editor.rb @@ -1161,6 +1161,8 @@ class Reline::LineEditor if Reline::IOGate.in_pasting? @continuous_insertion_buffer << str return + elsif not @continuous_insertion_buffer.empty? + process_insert end width = Reline::Unicode.get_mbchar_width(str) if @cursor == @cursor_max |