Skip to content

Commit d00896a

Browse files
authored
Merge pull request #469 from otavioschwanck/master
fix vi-operator-arg
2 parents 33bf80e + f08be5d commit d00896a

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

lib/reline/line_editor.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1430,7 +1430,7 @@ def editing_mode
14301430
if @waiting_operator_proc
14311431
if VI_MOTIONS.include?(method_symbol)
14321432
old_cursor, old_byte_pointer = @cursor, @byte_pointer
1433-
@vi_arg = @waiting_operator_vi_arg if @waiting_operator_vi_arg > 1
1433+
@vi_arg = @waiting_operator_vi_arg if @waiting_operator_vi_arg&.> 1
14341434
block.(true)
14351435
unless @waiting_proc
14361436
cursor_diff, byte_pointer_diff = @cursor - old_cursor, @byte_pointer - old_byte_pointer

test/reline/test_key_actor_vi.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1454,4 +1454,12 @@ def test_vi_kill_line_prev
14541454
assert_cursor_max(1)
14551455
assert_line('c')
14561456
end
1457+
1458+
def test_vi_motion_operators
1459+
assert_instance_of(Reline::KeyActor::ViInsert, @config.editing_mode)
1460+
1461+
assert_nothing_raised do
1462+
input_keys("test = { foo: bar }\C-[BBBldt}b")
1463+
end
1464+
end
14571465
end

0 commit comments

Comments
 (0)