Skip to content

Commit 496c436

Browse files
committed
Keep operator proc as a local variable in the scope
The proc variable will be used later so the instance variable will be changes.
1 parent 710ca23 commit 496c436

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

lib/reline/line_editor.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -706,12 +706,13 @@ def editing_mode
706706
else
707707
old_waiting_proc = @waiting_proc
708708
old_waiting_operator_proc = @waiting_operator_proc
709+
current_waiting_operator_proc = @waiting_operator_proc
709710
@waiting_proc = proc { |k|
710711
old_cursor, old_byte_pointer = @cursor, @byte_pointer
711712
old_waiting_proc.(k)
712713
cursor_diff, byte_pointer_diff = @cursor - old_cursor, @byte_pointer - old_byte_pointer
713714
@cursor, @byte_pointer = old_cursor, old_byte_pointer
714-
@waiting_operator_proc.(cursor_diff, byte_pointer_diff)
715+
current_waiting_operator_proc.(cursor_diff, byte_pointer_diff)
715716
@waiting_operator_proc = old_waiting_operator_proc
716717
}
717718
end

test/reline/test_key_actor_vi.rb

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1215,6 +1215,19 @@ def test_vi_delete_meta
12151215
assert_line('aaa ddd eee')
12161216
end
12171217

1218+
def test_vi_delete_meta_with_vi_next_char
1219+
input_keys("aaa bbb ccc ___ ddd\C-[02w")
1220+
assert_byte_pointer_size('aaa bbb ')
1221+
assert_cursor(8)
1222+
assert_cursor_max(19)
1223+
assert_line('aaa bbb ccc ___ ddd')
1224+
input_keys('df_')
1225+
assert_byte_pointer_size('aaa bbb ')
1226+
assert_cursor(8)
1227+
assert_cursor_max(15)
1228+
assert_line('aaa bbb ___ ddd')
1229+
end
1230+
12181231
def test_vi_change_meta
12191232
input_keys("aaa bbb ccc ddd eee\C-[02w")
12201233
assert_byte_pointer_size('aaa bbb ')

0 commit comments

Comments
 (0)