File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -846,7 +846,11 @@ def editing_mode
846846 when CompletionState ::NORMAL
847847 @completion_state = CompletionState ::COMPLETION
848848 when CompletionState ::PERFECT_MATCH
849- @dig_perfect_match_proc &.( @perfect_matched )
849+ if @dig_perfect_match_proc
850+ @dig_perfect_match_proc . ( @perfect_matched )
851+ else
852+ @completion_state = CompletionState ::COMPLETION
853+ end
850854 end
851855 if just_show_list
852856 is_menu = true
Original file line number Diff line number Diff line change @@ -920,6 +920,29 @@ def test_completion_with_perfect_match
920920 assert_equal ( 'foo_bar' , matched )
921921 end
922922
923+ def test_continuous_completion_with_perfect_match
924+ @line_editor . completion_proc = proc { |word |
925+ word == 'f' ? [ 'foo' ] : %w[ foobar foobaz ]
926+ }
927+ input_keys ( 'f' )
928+ input_keys ( "\C -i" , false )
929+ assert_line_around_cursor ( 'foo' , '' )
930+ input_keys ( "\C -i" , false )
931+ assert_line_around_cursor ( 'fooba' , '' )
932+ end
933+
934+ def test_continuous_completion_disabled_with_perfect_match
935+ @line_editor . completion_proc = proc { |word |
936+ word == 'f' ? [ 'foo' ] : %w[ foobar foobaz ]
937+ }
938+ @line_editor . dig_perfect_match_proc = proc { }
939+ input_keys ( 'f' )
940+ input_keys ( "\C -i" , false )
941+ assert_line_around_cursor ( 'foo' , '' )
942+ input_keys ( "\C -i" , false )
943+ assert_line_around_cursor ( 'foo' , '' )
944+ end
945+
923946 def test_completion_with_completion_ignore_case
924947 @line_editor . completion_proc = proc { |word |
925948 %w{
You can’t perform that action at this time.
0 commit comments