diff options
author | tomoya ishida <tomoyapenguin@gmail.com> | 2023-01-12 09:14:48 +0900 |
---|---|---|
committer | git <svn-admin@ruby-lang.org> | 2023-01-12 00:14:53 +0000 |
commit | 0abb4b6348f00b03736b198b26e58b08cefc3303 (patch) | |
tree | 3273ee905e1f75cd66e4b4a806d753d63de8ff76 /lib/reline | |
parent | 048751dd73f45ba02c8be80092a38fd47e56a925 (diff) | |
download | ruby-0abb4b6348f00b03736b198b26e58b08cefc3303.tar.gz |
[ruby/reline] Pass unmodifined lines(that does not include escape
sequence) to check_multiline_prompt
(https://github.com/ruby/reline/pull/458)
* pass unmodified lines to check_multiline_prompt
* Add test to check that output modified by output_modifier_proc is not passed to prompt_proc
Diffstat (limited to 'lib/reline')
-rw-r--r-- | lib/reline/line_editor.rb | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/reline/line_editor.rb b/lib/reline/line_editor.rb index 8153aaba05..28daae8884 100644 --- a/lib/reline/line_editor.rb +++ b/lib/reline/line_editor.rb @@ -671,8 +671,10 @@ class Reline::LineEditor dialog.set_cursor_pos(cursor_column, @first_line_started_from + @started_from) dialog_render_info = dialog.call(@last_key) if dialog_render_info.nil? or dialog_render_info.contents.nil? or dialog_render_info.contents.empty? + lines = whole_lines dialog.lines_backup = { - lines: modify_lines(whole_lines), + unmodified_lines: lines, + lines: modify_lines(lines), line_index: @line_index, first_line_started_from: @first_line_started_from, started_from: @started_from, @@ -774,8 +776,10 @@ class Reline::LineEditor Reline::IOGate.move_cursor_column(cursor_column) move_cursor_up(dialog.vertical_offset + dialog.contents.size - 1) Reline::IOGate.show_cursor + lines = whole_lines dialog.lines_backup = { - lines: modify_lines(whole_lines), + unmodified_lines: lines, + lines: modify_lines(lines), line_index: @line_index, first_line_started_from: @first_line_started_from, started_from: @started_from, @@ -785,7 +789,7 @@ class Reline::LineEditor private def reset_dialog(dialog, old_dialog) return if dialog.lines_backup.nil? or old_dialog.contents.nil? - prompt, prompt_width, prompt_list = check_multiline_prompt(dialog.lines_backup[:lines]) + prompt, prompt_width, prompt_list = check_multiline_prompt(dialog.lines_backup[:unmodified_lines]) visual_lines = [] visual_start = nil dialog.lines_backup[:lines].each_with_index { |l, i| @@ -896,7 +900,7 @@ class Reline::LineEditor private def clear_each_dialog(dialog) dialog.trap_key = nil return unless dialog.contents - prompt, prompt_width, prompt_list = check_multiline_prompt(dialog.lines_backup[:lines]) + prompt, prompt_width, prompt_list = check_multiline_prompt(dialog.lines_backup[:unmodified_lines]) visual_lines = [] visual_lines_under_dialog = [] visual_start = nil |