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

ruby-changes:73380

From: Hiroshi <ko1@a...>
Date: Fri, 2 Sep 2022 16:10:03 +0900 (JST)
Subject: [ruby-changes:73380] 0d2422cf63 (master): [ruby/reline] Workaround for padding width with Aracritty on macOS

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

From 0d2422cf63ff330e372613894995e762d122e6b7 Mon Sep 17 00:00:00 2001
From: Hiroshi SHIBATA <hsbt@r...>
Date: Fri, 2 Sep 2022 14:26:17 +0900
Subject: [ruby/reline] Workaround for padding width with Aracritty on macOS

https://github.com/ruby/reline/commit/fb4136c8a7
---
 lib/reline/line_editor.rb | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/lib/reline/line_editor.rb b/lib/reline/line_editor.rb
index af5240547a..ff48e44d51 100644
--- a/lib/reline/line_editor.rb
+++ b/lib/reline/line_editor.rb
@@ -655,7 +655,10 @@ class Reline::LineEditor https://github.com/ruby/ruby/blob/trunk/lib/reline/line_editor.rb#L655
   end
 
   private def padding_space_with_escape_sequences(str, width)
-    str + (' ' * (width - calculate_width(str, true)))
+    padding_width = width - calculate_width(str, true)
+    # padding_width should be only positive value. But macOS and Aracritty returns negative value.
+    padding_width = 0 if padding_width < 0
+    str + (' ' * padding_width)
   end
 
   private def render_each_dialog(dialog, cursor_column)
-- 
cgit v1.2.1


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

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