diff options
author | aycabta <aycabta@gmail.com> | 2019-05-27 08:13:48 +0900 |
---|---|---|
committer | aycabta <aycabta@gmail.com> | 2019-05-27 08:13:48 +0900 |
commit | 4e2c7783e364f37a748fe0d3a3cd9f96e58287c0 (patch) | |
tree | d2556f13544ef07ba709a35888599664fd2e80c4 /lib | |
parent | 2805c55aa39bf6127e1e684deb0d5a0291cb6479 (diff) | |
download | ruby-4e2c7783e364f37a748fe0d3a3cd9f96e58287c0.tar.gz |
Check blank history
Diffstat (limited to 'lib')
-rw-r--r-- | lib/reline/line_editor.rb | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/reline/line_editor.rb b/lib/reline/line_editor.rb index 7c9eb065b5..32b49dbb7d 100644 --- a/lib/reline/line_editor.rb +++ b/lib/reline/line_editor.rb @@ -1037,6 +1037,7 @@ class Reline::LineEditor if @is_multiline @line_backup_in_history = whole_buffer @buffer_of_lines = Reline::HISTORY[@history_pointer].split("\n") + @buffer_of_lines = [String.new(encoding: @encoding)] if @buffer_of_lines.empty? @line_index = @buffer_of_lines.size - 1 @line = @buffer_of_lines.last @rerender_all = true @@ -1051,6 +1052,7 @@ class Reline::LineEditor Reline::HISTORY[@history_pointer] = whole_buffer @history_pointer -= 1 @buffer_of_lines = Reline::HISTORY[@history_pointer].split("\n") + @buffer_of_lines = [String.new(encoding: @encoding)] if @buffer_of_lines.empty? @line_index = @buffer_of_lines.size - 1 @line = @buffer_of_lines.last @rerender_all = true @@ -1096,6 +1098,7 @@ class Reline::LineEditor Reline::HISTORY[@history_pointer] = whole_buffer @history_pointer += 1 @buffer_of_lines = Reline::HISTORY[@history_pointer].split("\n") + @buffer_of_lines = [String.new(encoding: @encoding)] if @buffer_of_lines.empty? @line_index = 0 @line = @buffer_of_lines.first @rerender_all = true |