Otávio Schwanck dos Santos 2024-02-11 10:03:47 +00:00 коммит произвёл Hiroshi SHIBATA
Родитель 01d4d5b8b3
Коммит e848848b58
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: F9CF13417264FAC2
2 изменённых файлов: 17 добавлений и 0 удалений

Просмотреть файл

@ -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)