From 5e09da2f7a29d076ffefb8585758fc1fbee2ac08 Mon Sep 17 00:00:00 2001 From: aycabta 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(-) (limited to 'lib/reline') diff --git a/lib/reline/ansi.rb b/lib/reline/ansi.rb index 5e8fd0fd28..e37d617247 100644 --- a/lib/reline/ansi.rb +++ b/lib/reline/ansi.rb @@ -41,18 +41,18 @@ class Reline::ANSI 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 9c1615cc2b..92c6ffc9e5 100644 --- a/lib/reline/terminfo.rb +++ b/lib/reline/terminfo.rb @@ -57,7 +57,7 @@ module Reline::Terminfo end def self.tigetstr(capname) - @tigetstr.(capname) + @tigetstr.(capname).to_s end def self.tiparm(str, *args) @@ -65,7 +65,7 @@ module Reline::Terminfo 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.2.3