mirror of
https://github.com/ruby/ruby.git
synced 2025-08-24 21:44:30 +02:00
[ruby/reline] The vi_histedit supports multiline
This closes ruby/reline#253.
f131f86d71
This commit is contained in:
parent
a608bb3e9b
commit
a19ed1623f
1 changed files with 14 additions and 2 deletions
|
@ -2462,11 +2462,23 @@ class Reline::LineEditor
|
|||
|
||||
private def vi_histedit(key)
|
||||
path = Tempfile.open { |fp|
|
||||
if @is_multiline
|
||||
fp.write whole_lines.join("\n")
|
||||
else
|
||||
fp.write @line
|
||||
end
|
||||
fp.path
|
||||
}
|
||||
system("#{ENV['EDITOR']} #{path}")
|
||||
if @is_multiline
|
||||
@buffer_of_lines = File.read(path).split("\n")
|
||||
@buffer_of_lines = [String.new(encoding: @encoding)] if @buffer_of_lines.empty?
|
||||
@line_index = 0
|
||||
@line = @buffer_of_lines[@line_index]
|
||||
@rerender_all = true
|
||||
else
|
||||
@line = File.read(path)
|
||||
end
|
||||
finish
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue