Skip to content

Commit

Permalink
Create windows.rb
Browse files Browse the repository at this point in the history
see issue #317
  • Loading branch information
unak committed Aug 20, 2021
1 parent dfc89ea commit aad164d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/reline/windows.rb
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ def call(*args)

@@GetConsoleMode = Win32API.new('kernel32', 'GetConsoleMode', ['L', 'P'], 'L')
@@SetConsoleMode = Win32API.new('kernel32', 'SetConsoleMode', ['L', 'L'], 'L')
@@WaitForSingleObject = Win32API.new('kernel32', 'WaitForSingleObject', ['L', 'L'], 'L')
ENABLE_VIRTUAL_TERMINAL_PROCESSING = 4

private_class_method def self.getconsolemode
Expand Down Expand Up @@ -218,7 +219,7 @@ def self.process_key_event(repeat_count, virtual_key_code, virtual_scan_code, ch
def self.check_input_event
num_of_events = 0.chr * 8
while @@output_buf.empty? #or true
sleep 0.01
next if @@WaitForSingleObject.(@@hConsoleInputHandle, 100) != 0 # max 0.1 sec
next if @@GetNumberOfConsoleInputEvents.(@@hConsoleInputHandle, num_of_events) == 0 or num_of_events.unpack('L').first == 0
input_record = 0.chr * 18
read_event = 0.chr * 4
Expand Down

0 comments on commit aad164d

Please sign in to comment.