diff options
author | aycabta <aycabta@gmail.com> | 2020-02-23 12:35:24 +0900 |
---|---|---|
committer | aycabta <aycabta@gmail.com> | 2020-03-26 17:41:21 +0900 |
commit | f245fb1ab8d893a89c8749a703efea0b16353028 (patch) | |
tree | bcdb35d97c228f6616a290284b7e492e4f8d4b2e /lib | |
parent | 22477128cd77e0d0dce7e78bc12f9cc8cccc1cb4 (diff) | |
download | ruby-f245fb1ab8d893a89c8749a703efea0b16353028.tar.gz |
[ruby/reline] Work with wrong $/ value correctly
https://github.com/ruby/reline/commit/962ebf5a1b
Diffstat (limited to 'lib')
-rw-r--r-- | lib/reline.rb | 6 | ||||
-rw-r--r-- | lib/reline/line_editor.rb | 2 |
2 files changed, 4 insertions, 4 deletions
diff --git a/lib/reline.rb b/lib/reline.rb index 3303fb4dd4..2708cd91b5 100644 --- a/lib/reline.rb +++ b/lib/reline.rb @@ -175,7 +175,7 @@ module Reline whole_buffer = line_editor.whole_buffer.dup whole_buffer.taint if RUBY_VERSION < '2.7' - if add_hist and whole_buffer and whole_buffer.chomp.size > 0 + if add_hist and whole_buffer and whole_buffer.chomp("\n").size > 0 Reline::HISTORY << whole_buffer end @@ -188,8 +188,8 @@ module Reline line = line_editor.line.dup line.taint if RUBY_VERSION < '2.7' - if add_hist and line and line.chomp.size > 0 - Reline::HISTORY << line.chomp + if add_hist and line and line.chomp("\n").size > 0 + Reline::HISTORY << line.chomp("\n") end line_editor.reset_line if line_editor.line.nil? diff --git a/lib/reline/line_editor.rb b/lib/reline/line_editor.rb index 478d1d73f3..095a7b5a09 100644 --- a/lib/reline/line_editor.rb +++ b/lib/reline/line_editor.rb @@ -543,7 +543,7 @@ class Reline::LineEditor return before if before.nil? || before.empty? if after = @output_modifier_proc&.call("#{before.join("\n")}\n", complete: finished?) - after.lines(chomp: true) + after.lines("\n", chomp: true) else before end |