mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
[ruby/reline] Add alias vi-movement-mode to vi-command-mode for compatibility
a79c297567
This commit is contained in:
parent
48742614df
commit
dbfc1f30d5
2 changed files with 15 additions and 0 deletions
|
@ -1957,6 +1957,7 @@ class Reline::LineEditor
|
||||||
ed_prev_char(key)
|
ed_prev_char(key)
|
||||||
@config.editing_mode = :vi_command
|
@config.editing_mode = :vi_command
|
||||||
end
|
end
|
||||||
|
alias_method :vi_movement_mode, :vi_command_mode
|
||||||
|
|
||||||
private def vi_next_word(key, arg: 1)
|
private def vi_next_word(key, arg: 1)
|
||||||
if @line.bytesize > @byte_pointer
|
if @line.bytesize > @byte_pointer
|
||||||
|
|
|
@ -384,6 +384,20 @@ begin
|
||||||
EOC
|
EOC
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_binding_for_vi_movement_mode
|
||||||
|
write_inputrc <<~LINES
|
||||||
|
set editing-mode vi
|
||||||
|
"\\C-j": vi-movement-mode
|
||||||
|
LINES
|
||||||
|
start_terminal(5, 30, %W{ruby -I#{@pwd}/lib #{@pwd}/bin/multiline_repl}, startup_message: 'Multiline REPL.')
|
||||||
|
write(":1234\C-jhhhi0")
|
||||||
|
close
|
||||||
|
assert_screen(<<~EOC)
|
||||||
|
Multiline REPL.
|
||||||
|
prompt> :01234
|
||||||
|
EOC
|
||||||
|
end
|
||||||
|
|
||||||
private def write_inputrc(content)
|
private def write_inputrc(content)
|
||||||
File.open(@inputrc_file, 'w') do |f|
|
File.open(@inputrc_file, 'w') do |f|
|
||||||
f.write content
|
f.write content
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue