lib/reline/config.rb in reline-0.2.6 vs lib/reline/config.rb in reline-0.2.7
- old
+ new
@@ -72,10 +72,11 @@
@editing_mode_label = :vi_insert
end
@additional_key_bindings.keys.each do |key|
@additional_key_bindings[key].clear
end
+ reset_default_key_bindings
end
def editing_mode
@key_actors[@editing_mode_label]
end
@@ -155,11 +156,18 @@
ka.reset_default_key_bindings
end
end
def read_lines(lines, file = nil)
- if lines.first.encoding != Reline.encoding_system_needs
- lines = lines.map { |l| l.encode(Reline.encoding_system_needs) }
+ if not lines.empty? and lines.first.encoding != Reline.encoding_system_needs
+ begin
+ lines = lines.map do |l|
+ l.encode(Reline.encoding_system_needs)
+ rescue Encoding::UndefinedConversionError
+ mes = "The inputrc encoded in #{lines.first.encoding.name} can't be converted to the locale #{Reline.encoding_system_needs.name}."
+ raise Reline::ConfigEncodingConversionError.new(mes)
+ end
+ end
end
conditions = [@skip_section, @if_stack]
@skip_section = nil
@if_stack = []