diff options
Diffstat (limited to 'lib/reline/ansi.rb')
-rw-r--r-- | lib/reline/ansi.rb | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/reline/ansi.rb b/lib/reline/ansi.rb index 80fccd74f9..f11dbb80f4 100644 --- a/lib/reline/ansi.rb +++ b/lib/reline/ansi.rb @@ -80,6 +80,22 @@ class Reline::ANSI nil end + def self.in_pasting? + not Reline::IOGate.empty_buffer? + end + + def self.empty_buffer? + unless @@buf.empty? + return false + end + rs, = IO.select([@@input], [], [], 0.00001) + if rs and rs[0] + false + else + true + end + end + def self.ungetc(c) @@buf.unshift(c) end |