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

ruby-changes:66521

From: aycabta <ko1@a...>
Date: Mon, 21 Jun 2021 18:44:34 +0900 (JST)
Subject: [ruby-changes:66521] 5e09da2f7a (master): [ruby/reline] Terminfo.tigetstr and tiparm should return String object

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

From 5e09da2f7a29d076ffefb8585758fc1fbee2ac08 Mon Sep 17 00:00:00 2001
From: aycabta <aycabta@g...>
Date: Wed, 19 May 2021 17:53:17 +0900
Subject: [ruby/reline] Terminfo.tigetstr and tiparm should return String
 object

https://github.com/ruby/reline/commit/1e287d10cc
---
 lib/reline/ansi.rb     | 20 ++++++++++----------
 lib/reline/terminfo.rb |  4 ++--
 2 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/lib/reline/ansi.rb b/lib/reline/ansi.rb
index 5e8fd0f..e37d617 100644
--- a/lib/reline/ansi.rb
+++ b/lib/reline/ansi.rb
@@ -41,18 +41,18 @@ class Reline::ANSI https://github.com/ruby/ruby/blob/trunk/lib/reline/ansi.rb#L41
 
   def self.set_default_key_bindings_terminfo(config)
     {
-      Reline::Terminfo.tigetstr('khome').to_s.bytes => :ed_move_to_beg,
-      Reline::Terminfo.tigetstr('kend').to_s.bytes => :ed_move_to_end,
-      Reline::Terminfo.tigetstr('kcuu1').to_s.bytes => :ed_prev_history,
-      Reline::Terminfo.tigetstr('kcud1').to_s.bytes => :ed_next_history,
-      Reline::Terminfo.tigetstr('kcuf1').to_s.bytes => :ed_next_char,
-      Reline::Terminfo.tigetstr('kcub1').to_s.bytes => :ed_prev_char,
+      Reline::Terminfo.tigetstr('khome').bytes => :ed_move_to_beg,
+      Reline::Terminfo.tigetstr('kend').bytes => :ed_move_to_end,
+      Reline::Terminfo.tigetstr('kcuu1').bytes => :ed_prev_history,
+      Reline::Terminfo.tigetstr('kcud1').bytes => :ed_next_history,
+      Reline::Terminfo.tigetstr('kcuf1').bytes => :ed_next_char,
+      Reline::Terminfo.tigetstr('kcub1').bytes => :ed_prev_char,
       # Escape sequences that omit the move distance and are set to defaults
       # value 1 may be sometimes sent by pressing the arrow-key.
-      Reline::Terminfo.tigetstr('cuu').to_s.sub(/%p1%d/, '').bytes => :ed_prev_history,
-      Reline::Terminfo.tigetstr('cud').to_s.sub(/%p1%d/, '').bytes => :ed_next_history,
-      Reline::Terminfo.tigetstr('cuf').to_s.sub(/%p1%d/, '').bytes => :ed_next_char,
-      Reline::Terminfo.tigetstr('cub').to_s.sub(/%p1%d/, '').bytes => :ed_prev_char,
+      Reline::Terminfo.tigetstr('cuu').sub(/%p1%d/, '').bytes => :ed_prev_history,
+      Reline::Terminfo.tigetstr('cud').sub(/%p1%d/, '').bytes => :ed_next_history,
+      Reline::Terminfo.tigetstr('cuf').sub(/%p1%d/, '').bytes => :ed_next_char,
+      Reline::Terminfo.tigetstr('cub').sub(/%p1%d/, '').bytes => :ed_prev_char,
     }.each_pair do |key, func|
       config.add_default_key_binding_by_keymap(:emacs, key, func)
       config.add_default_key_binding_by_keymap(:vi_insert, key, func)
diff --git a/lib/reline/terminfo.rb b/lib/reline/terminfo.rb
index 9c1615c..92c6ffc 100644
--- a/lib/reline/terminfo.rb
+++ b/lib/reline/terminfo.rb
@@ -57,7 +57,7 @@ module Reline::Terminfo https://github.com/ruby/ruby/blob/trunk/lib/reline/terminfo.rb#L57
   end
 
   def self.tigetstr(capname)
-    @tigetstr.(capname)
+    @tigetstr.(capname).to_s
   end
 
   def self.tiparm(str, *args)
@@ -65,7 +65,7 @@ module Reline::Terminfo https://github.com/ruby/ruby/blob/trunk/lib/reline/terminfo.rb#L65
     args.each do |a|
       new_args << Fiddle::TYPE_INT << a
     end
-    @tiparm.(str, *new_args)
+    @tiparm.(str, *new_args).to_s
   end
 
   def self.enabled?
-- 
cgit v1.1


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

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