summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/reline/general_io.rb16
-rw-r--r--lib/reline/line_editor.rb2
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