mirror of
https://github.com/ruby/ruby.git
synced 2025-08-24 13:34:17 +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)
|
private def vi_histedit(key)
|
||||||
path = Tempfile.open { |fp|
|
path = Tempfile.open { |fp|
|
||||||
fp.write @line
|
if @is_multiline
|
||||||
|
fp.write whole_lines.join("\n")
|
||||||
|
else
|
||||||
|
fp.write @line
|
||||||
|
end
|
||||||
fp.path
|
fp.path
|
||||||
}
|
}
|
||||||
system("#{ENV['EDITOR']} #{path}")
|
system("#{ENV['EDITOR']} #{path}")
|
||||||
@line = File.read(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
|
finish
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue