summaryrefslogtreecommitdiff
path: root/lib/reline/windows.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/reline/windows.rb')
-rw-r--r--lib/reline/windows.rb12
1 files changed, 9 insertions, 3 deletions
diff --git a/lib/reline/windows.rb b/lib/reline/windows.rb
index b952329911..ee3f73e383 100644
--- a/lib/reline/windows.rb
+++ b/lib/reline/windows.rb
@@ -1,6 +1,8 @@
require 'fiddle/import'
class Reline::Windows
+ RESET_COLOR = "\e[0m"
+
def self.encoding
Encoding::UTF_8
end
@@ -85,7 +87,7 @@ class Reline::Windows
def call(*args)
import = @proto.split("")
args.each_with_index do |x, i|
- args[i], = [x == 0 ? nil : x].pack("p").unpack(POINTER_TYPE) if import[i] == "S"
+ args[i], = [x == 0 ? nil : +x].pack("p").unpack(POINTER_TYPE) if import[i] == "S"
args[i], = [x].pack("I").unpack("i") if import[i] == "I"
end
ret, = @func.call(*args)
@@ -257,7 +259,7 @@ class Reline::Windows
def self.check_input_event
num_of_events = 0.chr * 8
while @@output_buf.empty?
- Reline.core.line_editor.resize
+ Reline.core.line_editor.handle_signal
if @@WaitForSingleObject.(@@hConsoleInputHandle, 100) != 0 # max 0.1 sec
# prevent for background consolemode change
@@legacy_console = (getconsolemode() & ENABLE_VIRTUAL_TERMINAL_PROCESSING == 0)
@@ -291,7 +293,11 @@ class Reline::Windows
end
end
- def self.getc
+ def self.with_raw_input
+ yield
+ end
+
+ def self.getc(_timeout_second)
check_input_event
@@output_buf.shift
end