зеркало из https://github.com/github/ruby.git
[ruby/reline] C for vi mode
(https://github.com/ruby/reline/pull/472) https://github.com/ruby/reline/commit/d197be7c44
This commit is contained in:
Родитель
01d4d5b8b3
Коммит
e848848b58
|
@ -2563,6 +2563,13 @@ class Reline::LineEditor
|
||||||
end
|
end
|
||||||
alias_method :kill_line, :ed_kill_line
|
alias_method :kill_line, :ed_kill_line
|
||||||
|
|
||||||
|
# Editline:: +vi_change_to_eol+ (vi command: +C+) + Kill and change from the cursor to the end of the line.
|
||||||
|
private def vi_change_to_eol(key)
|
||||||
|
ed_kill_line(key)
|
||||||
|
|
||||||
|
@config.editing_mode = :vi_insert
|
||||||
|
end
|
||||||
|
|
||||||
# Editline:: +vi-kill-line-prev+ (vi: +Ctrl-U+) Delete the string from the
|
# Editline:: +vi-kill-line-prev+ (vi: +Ctrl-U+) Delete the string from the
|
||||||
# beginning of the edit buffer to the cursor and save it to the
|
# beginning of the edit buffer to the cursor and save it to the
|
||||||
# cut buffer.
|
# cut buffer.
|
||||||
|
|
|
@ -1455,6 +1455,16 @@ class Reline::KeyActor::ViInsert::Test < Reline::TestCase
|
||||||
assert_line('c')
|
assert_line('c')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_vi_change_to_eol
|
||||||
|
input_keys("abcdef\C-[2hC")
|
||||||
|
assert_line("abc")
|
||||||
|
input_keys("\C-[0C")
|
||||||
|
assert_line("")
|
||||||
|
assert_cursor(0)
|
||||||
|
assert_cursor_max(0)
|
||||||
|
assert_instance_of(Reline::KeyActor::ViInsert, @config.editing_mode)
|
||||||
|
end
|
||||||
|
|
||||||
def test_vi_motion_operators
|
def test_vi_motion_operators
|
||||||
assert_instance_of(Reline::KeyActor::ViInsert, @config.editing_mode)
|
assert_instance_of(Reline::KeyActor::ViInsert, @config.editing_mode)
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче