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

ruby-changes:63926

From: aycabta <ko1@a...>
Date: Sat, 5 Dec 2020 03:09:18 +0900 (JST)
Subject: [ruby-changes:63926] faf8f216be (master): [ruby/reline] Keep operator proc as a local variable in the scope

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

From faf8f216be034a575350c7f3387992930b224bfc Mon Sep 17 00:00:00 2001
From: aycabta <aycabta@g...>
Date: Mon, 2 Nov 2020 14:48:44 +0900
Subject: [ruby/reline] Keep operator proc as a local variable in the scope

The proc variable will be used later so the instance variable will be changes.

https://github.com/ruby/reline/commit/496c4361f6

diff --git a/lib/reline/line_editor.rb b/lib/reline/line_editor.rb
index fde8ad9..17fabd1 100644
--- a/lib/reline/line_editor.rb
+++ b/lib/reline/line_editor.rb
@@ -706,12 +706,13 @@ class Reline::LineEditor https://github.com/ruby/ruby/blob/trunk/lib/reline/line_editor.rb#L706
         else
           old_waiting_proc = @waiting_proc
           old_waiting_operator_proc = @waiting_operator_proc
+          current_waiting_operator_proc = @waiting_operator_proc
           @waiting_proc = proc { |k|
             old_cursor, old_byte_pointer = @cursor, @byte_pointer
             old_waiting_proc.(k)
             cursor_diff, byte_pointer_diff = @cursor - old_cursor, @byte_pointer - old_byte_pointer
             @cursor, @byte_pointer = old_cursor, old_byte_pointer
-            @waiting_operator_proc.(cursor_diff, byte_pointer_diff)
+            current_waiting_operator_proc.(cursor_diff, byte_pointer_diff)
             @waiting_operator_proc = old_waiting_operator_proc
           }
         end
diff --git a/test/reline/test_key_actor_vi.rb b/test/reline/test_key_actor_vi.rb
index c6337ba..c09c936 100644
--- a/test/reline/test_key_actor_vi.rb
+++ b/test/reline/test_key_actor_vi.rb
@@ -1215,6 +1215,19 @@ class Reline::KeyActor::ViInsert::Test < Reline::TestCase https://github.com/ruby/ruby/blob/trunk/test/reline/test_key_actor_vi.rb#L1215
     assert_line('aaa ddd eee')
   end
 
+  def test_vi_delete_meta_with_vi_next_char
+    input_keys("aaa bbb ccc ___ ddd\C-[02w")
+    assert_byte_pointer_size('aaa bbb ')
+    assert_cursor(8)
+    assert_cursor_max(19)
+    assert_line('aaa bbb ccc ___ ddd')
+    input_keys('df_')
+    assert_byte_pointer_size('aaa bbb ')
+    assert_cursor(8)
+    assert_cursor_max(15)
+    assert_line('aaa bbb ___ ddd')
+  end
+
   def test_vi_change_meta
     input_keys("aaa bbb ccc ddd eee\C-[02w")
     assert_byte_pointer_size('aaa bbb ')
-- 
cgit v0.10.2


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

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