summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authoraycabta <aycabta@gmail.com>2021-12-24 20:07:55 +0900
committergit <svn-admin@ruby-lang.org>2021-12-25 00:32:58 +0900
commitc815c0be46b83c1c5c50a88cd1452635208fbee4 (patch)
tree4b01a6bb92732274e7dcc2b5f779dbf57370263f /lib
parentb0db420b0e70753986d42579439acdd7ff0d9e95 (diff)
[ruby/reline] Escape newline(s) in dynamic prompt
https://github.com/ruby/reline/commit/9b209ee1ea
Diffstat (limited to 'lib')
-rw-r--r--lib/reline/line_editor.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/reline/line_editor.rb b/lib/reline/line_editor.rb
index 5968af708b..90cc4b2db2 100644
--- a/lib/reline/line_editor.rb
+++ b/lib/reline/line_editor.rb
@@ -121,7 +121,7 @@ class Reline::LineEditor
if use_cached_prompt_list
prompt_list = @cached_prompt_list
else
- prompt_list = @cached_prompt_list = @prompt_proc.(buffer)
+ prompt_list = @cached_prompt_list = @prompt_proc.(buffer).map { |pr| pr.gsub("\n", "\\n") }
@prompt_cache_time = Time.now.to_f
end
prompt_list.map!{ prompt } if @vi_arg or @searching_prompt