Skip to content
Closed
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
13 changes: 13 additions & 0 deletions lib/debug/console.rb
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ def readline_setup prompt
end

def readline prompt
clear_stdin
readline_setup prompt do
Reline.readmultiline(prompt, true){ true }
end
Expand Down Expand Up @@ -132,6 +133,7 @@ def readline_setup
end

def readline prompt
clear_stdin
readline_setup
Readline.readline(prompt, true)
end
Expand All @@ -142,6 +144,7 @@ def history

rescue LoadError
def readline prompt
clear_stdin
print prompt
$stdin.gets
end
Expand All @@ -152,6 +155,16 @@ def history
end
end

def clear_stdin
# consume all STDIN input just before prompt
loop do
case $stdin.read_nonblock(1024, exception: false)
when nil, :wait_readable
break
end
end
end

def history_file
path =
if !CONFIG[:history_file].empty? && File.exist?(File.expand_path(CONFIG[:history_file]))
Expand Down
Loading