зеркало из https://github.com/github/ruby.git
[ruby/reline] unleash real pasting speed
2700msec -> 410msec read 80 console inputs at once https://github.com/ruby/reline/commit/eb3ef7af98
This commit is contained in:
Родитель
74765a5a36
Коммит
3a2ae5bb19
|
@ -262,9 +262,12 @@ class Reline::Windows
|
|||
next
|
||||
end
|
||||
next if @@GetNumberOfConsoleInputEvents.(@@hConsoleInputHandle, num_of_events) == 0 or num_of_events.unpack1('L') == 0
|
||||
input_record = 0.chr * 18
|
||||
input_records = 0.chr * 20 * 80
|
||||
read_event = 0.chr * 4
|
||||
if @@ReadConsoleInputW.(@@hConsoleInputHandle, input_record, 1, read_event) != 0
|
||||
if @@ReadConsoleInputW.(@@hConsoleInputHandle, input_records, 80, read_event) != 0
|
||||
read_events = read_event.unpack1('L')
|
||||
0.upto(read_events) do |idx|
|
||||
input_record = input_records[idx * 20, 20]
|
||||
event = input_record[0, 2].unpack1('s*')
|
||||
case event
|
||||
when WINDOW_BUFFER_SIZE_EVENT
|
||||
|
@ -284,6 +287,7 @@ class Reline::Windows
|
|||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def self.getc
|
||||
check_input_event
|
||||
|
|
Загрузка…
Ссылка в новой задаче