diff options
Diffstat (limited to 'lib/highline.rb')
-rwxr-xr-x | lib/highline.rb | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/lib/highline.rb b/lib/highline.rb index 1e195e6..3e60cd3 100755 --- a/lib/highline.rb +++ b/lib/highline.rb @@ -257,7 +257,16 @@ class HighLine return unless selected if menu.shell - selection, details = selected + if menu.gather + selection = [] + details = [] + selected.each do |value| + selection << value[0] + details << value[1] + end + else + selection, details = selected + end else selection = selected end @@ -533,9 +542,11 @@ class HighLine break if ["\n", "\r"].include? character # honor backspace and delete - if character == "\b" + if character == "\b" || character == "\u007F" chopped = line.chop! output_erase_char if chopped && question.echo + elsif character == "\e" + ignore_arrow_key else line << character say_last_char_or_echo_char(line, question) @@ -561,6 +572,12 @@ class HighLine end end + def ignore_arrow_key + 2.times do + terminal.get_character + end + end + def say_last_char_or_echo_char(line, question) @output.print(line[-1]) if question.echo == true @output.print(question.echo) if question.echo && question.echo != true |