[前][次][番号順一覧][スレッド一覧]

ruby-changes:63934

From: aycabta <ko1@a...>
Date: Sat, 5 Dec 2020 03:09:32 +0900 (JST)
Subject: [ruby-changes:63934] dbfc1f30d5 (master): [ruby/reline] Add alias vi-movement-mode to vi-command-mode for compatibility

https://git.ruby-lang.org/ruby.git/commit/?id=dbfc1f30d5

From dbfc1f30d59e595793aaf19fe2b774c103def087 Mon Sep 17 00:00:00 2001
From: aycabta <aycabta@g...>
Date: Mon, 9 Nov 2020 15:59:52 +0900
Subject: [ruby/reline] Add alias vi-movement-mode to vi-command-mode for
 compatibility

https://github.com/ruby/reline/commit/a79c297567

diff --git a/lib/reline/line_editor.rb b/lib/reline/line_editor.rb
index a6424ef..ea1c913 100644
--- a/lib/reline/line_editor.rb
+++ b/lib/reline/line_editor.rb
@@ -1957,6 +1957,7 @@ class Reline::LineEditor https://github.com/ruby/ruby/blob/trunk/lib/reline/line_editor.rb#L1957
     ed_prev_char(key)
     @config.editing_mode = :vi_command
   end
+  alias_method :vi_movement_mode, :vi_command_mode
 
   private def vi_next_word(key, arg: 1)
     if @line.bytesize > @byte_pointer
diff --git a/test/reline/yamatanooroti/test_rendering.rb b/test/reline/yamatanooroti/test_rendering.rb
index 8bd72db..dea3e7f 100644
--- a/test/reline/yamatanooroti/test_rendering.rb
+++ b/test/reline/yamatanooroti/test_rendering.rb
@@ -384,6 +384,20 @@ begin https://github.com/ruby/ruby/blob/trunk/test/reline/yamatanooroti/test_rendering.rb#L384
       EOC
     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)
       File.open(@inputrc_file, 'w') do |f|
         f.write content
-- 
cgit v0.10.2


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]