diff options
author | Hiroshi SHIBATA <[email protected]> | 2022-09-02 14:26:17 +0900 |
---|---|---|
committer | git <[email protected]> | 2022-09-02 16:09:51 +0900 |
commit | 0d2422cf63ff330e372613894995e762d122e6b7 (patch) | |
tree | af085cba0c1484efadfeca964f8b4ed857723e17 /lib/reline/line_editor.rb | |
parent | 7ff50ee35c01dbd8d21e395261290890a669de82 (diff) |
[ruby/reline] Workaround for padding width with Aracritty on macOS
https://github.com/ruby/reline/commit/fb4136c8a7
Diffstat (limited to 'lib/reline/line_editor.rb')
-rw-r--r-- | lib/reline/line_editor.rb | 5 |
1 files changed, 4 insertions, 1 deletions
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 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) |