diff options
| author | tomoya ishida <tomoyapenguin@gmail.com> | 2024-05-02 15:06:27 +0900 |
|---|---|---|
| committer | git <svn-admin@ruby-lang.org> | 2024-05-02 06:06:31 +0000 |
| commit | eb82ea62186fb9c9b2941b04ee12d0dcba112607 (patch) | |
| tree | 3b2aff48267c164f09278d6a3957e0ec51c29278 /lib | |
| parent | ed5a7a59c0e909b4c77548fea06f1fd676e48a92 (diff) | |
[ruby/reline] Fix prompt width calculation bug. Test with colored
prompt
(https://github.com/ruby/reline/pull/695)
https://github.com/ruby/reline/commit/24aab01cbc
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/reline/line_editor.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/reline/line_editor.rb b/lib/reline/line_editor.rb index 123dca0aac..07a9cc6af0 100644 --- a/lib/reline/line_editor.rb +++ b/lib/reline/line_editor.rb @@ -387,7 +387,7 @@ class Reline::LineEditor next cached end *wrapped_prompts, code_line_prompt = split_by_width(prompt, width).first.compact - wrapped_lines = split_by_width(line, width, offset: calculate_width(code_line_prompt)).first.compact + wrapped_lines = split_by_width(line, width, offset: calculate_width(code_line_prompt, true)).first.compact wrapped_prompts.map { |p| [p, ''] } + [[code_line_prompt, wrapped_lines.first]] + wrapped_lines.drop(1).map { |c| ['', c] } end end |
