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

ruby-changes:63935

From: aycabta <ko1@a...>
Date: Sat, 5 Dec 2020 03:09:37 +0900 (JST)
Subject: [ruby-changes:63935] 92b22db6a7 (master): [ruby/reline] Unimplemented vi command should be no-op

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

From 92b22db6a7d943328ef2776fb3b6a6924fc8b496 Mon Sep 17 00:00:00 2001
From: aycabta <aycabta@g...>
Date: Mon, 2 Nov 2020 15:22:11 +0900
Subject: [ruby/reline] Unimplemented vi command should be no-op

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

diff --git a/lib/reline/line_editor.rb b/lib/reline/line_editor.rb
index 17fabd1..f6cf0c5 100644
--- a/lib/reline/line_editor.rb
+++ b/lib/reline/line_editor.rb
@@ -771,7 +771,7 @@ class Reline::LineEditor https://github.com/ruby/ruby/blob/trunk/lib/reline/line_editor.rb#L771
         elsif method_obj
           wrap_method_call(method_symbol, method_obj, key)
         else
-          ed_insert(key)
+          ed_insert(key) unless @config.editing_mode_is?(:vi_command)
         end
         @kill_ring.process
         @vi_arg = nil
@@ -789,7 +789,7 @@ class Reline::LineEditor https://github.com/ruby/ruby/blob/trunk/lib/reline/line_editor.rb#L789
       end
       @kill_ring.process
     else
-      ed_insert(key)
+      ed_insert(key) unless @config.editing_mode_is?(:vi_command)
     end
   end
 
diff --git a/test/reline/test_key_actor_vi.rb b/test/reline/test_key_actor_vi.rb
index c09c936..f5e542f 100644
--- a/test/reline/test_key_actor_vi.rb
+++ b/test/reline/test_key_actor_vi.rb
@@ -1250,4 +1250,17 @@ class Reline::KeyActor::ViInsert::Test < Reline::TestCase https://github.com/ruby/ruby/blob/trunk/test/reline/test_key_actor_vi.rb#L1250
     assert_cursor_max(16)
     assert_line('aaa bbb  ddd eee')
   end
+
+  def test_unimplemented_vi_command_should_be_no_op
+    input_keys("abc\C-[h")
+    assert_byte_pointer_size('a')
+    assert_cursor(1)
+    assert_cursor_max(3)
+    assert_line('abc')
+    input_keys('@')
+    assert_byte_pointer_size('a')
+    assert_cursor(1)
+    assert_cursor_max(3)
+    assert_line('abc')
+  end
 end
-- 
cgit v0.10.2


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

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