Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions lib/reline/io/ansi.rb
Original file line number Diff line number Diff line change
Expand Up @@ -114,13 +114,15 @@ def with_raw_input
end

def inner_getc(timeout_second)
unless @buf.empty?
return @buf.shift
end
until @input.wait_readable(0.01)
while true
# @buf may change while handling signal, so we need to check it in each loop iteration.
return @buf.shift unless @buf.empty?
break if @input.wait_readable(0.01)

timeout_second -= 0.01
return nil if timeout_second <= 0

# handle_signal may call cursor_pos which modifies @buf
Reline.core.line_editor.handle_signal
end
c = @input.getbyte
Expand Down