[前][次][番号順一覧][スレッド一覧]

ruby-changes:68310

From: Jeremy <ko1@a...>
Date: Fri, 8 Oct 2021 10:38:52 +0900 (JST)
Subject: [ruby-changes:68310] eb4682b3c6 (master): [ruby/reline] Only show dialogs if default external encoding is UTF-8

https://git.ruby-lang.org/ruby.git/commit/?id=eb4682b3c6

From eb4682b3c6dd703b073614fa10dec9f968e98df3 Mon Sep 17 00:00:00 2001
From: Jeremy Evans <code@j...>
Date: Wed, 6 Oct 2021 10:38:21 -0700
Subject: [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
---
 lib/reline/line_editor.rb | 1 +
 1 file changed, 1 insertion(+)

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 https://github.com/ruby/ruby/blob/trunk/lib/reline/line_editor.rb#L624
 
   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
-- 
cgit v1.2.1


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]