Skip to content

Commit

Permalink
[ruby/reline] Only show dialogs if default external encoding is UTF-8
Browse files Browse the repository at this point in the history
Fixes a crash in IRB if a dialog is displayed and the default
external encoding is not UTF-8:

/home/jeremy/tmp/reline/lib/reline/line_editor.rb:731:in `write': U+2588 from UTF-8 to US-ASCII (Encoding::UndefinedConversionError)

ruby/reline@f570525ecd
  • Loading branch information
jeremyevans authored and matzbot committed Oct 8, 2021
1 parent 1251edd commit eb4682b
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions lib/reline/line_editor.rb
Expand Up @@ -624,6 +624,7 @@ def add_dialog_proc(name, p, context = nil)

DIALOG_DEFAULT_HEIGHT = 20
private def render_dialog(cursor_column)
return unless Encoding.default_external == Encoding::UTF_8
@dialogs.each do |dialog|
render_each_dialog(dialog, cursor_column)
end
Expand Down

0 comments on commit eb4682b

Please sign in to comment.