summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Evans <code@jeremyevans.net>2021-10-06 10:38:21 -0700
committergit <svn-admin@ruby-lang.org>2021-10-08 10:38:43 +0900
commiteb4682b3c6dd703b073614fa10dec9f968e98df3 (patch)
treec9713e02406c99550b30c85f28b73d3618886431
parent1251edd1db3fe89b5198422949af4595192113db (diff)
[ruby/reline] Only show dialogs if default external encoding is UTF-8
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) https://github.com/ruby/reline/commit/f570525ecd
-rw-r--r--lib/reline/line_editor.rb1
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/reline/line_editor.rb b/lib/reline/line_editor.rb
index 292a161a85..5991ab2301 100644
--- a/lib/reline/line_editor.rb
+++ b/lib/reline/line_editor.rb
@@ -624,6 +624,7 @@ class Reline::LineEditor
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