@@ -530,37 +530,50 @@ T['Jumping with f/t/F/T']['enters jumping mode even if first jump is impossible'
530530end
531531
532532T [' Jumping with f/t/F/T' ][' does nothing if there is no place to jump' ] = function ()
533- -- Normal mode
534- local validate_normal = function (keys , start_col , ref_mode )
535- set_lines ({ ' abcdefg' })
533+ local validate_single = function (keys , start_line , start_col , ref_mode )
534+ set_lines ({ start_line })
536535 set_cursor (1 , start_col )
537536
538537 type_keys (keys , ' d' )
539538
540539 -- It shouldn't move anywhere and should not modify text
541540 eq (get_cursor (), { 1 , start_col })
542- eq (get_lines (), { ' abcdefg' })
541+ eq (get_lines (), { start_line })
542+ eq (child .fn .mode (), ref_mode )
543+
544+ -- The above applies to subsequent dot-repeats as well
545+ type_keys (' .' )
546+ eq (get_cursor (), { 1 , start_col })
547+ eq (get_lines (), { start_line })
543548 eq (child .fn .mode (), ref_mode )
544549
545550 -- Ensure there is no jumping
546551 child .lua (' MiniJump.stop_jumping()' )
547552 child .ensure_normal_mode ()
548553 end
549554
550- validate_normal (' f' , 4 , ' n' )
551- validate_normal (' t' , 4 , ' n' )
552- validate_normal (' F' , 2 , ' n' )
553- validate_normal (' T' , 2 , ' n' )
555+ local validate = function (line )
556+ validate_single (' f' , line , 4 , ' n' )
557+ validate_single (' t' , line , 4 , ' n' )
558+ validate_single (' F' , line , 2 , ' n' )
559+ validate_single (' T' , line , 2 , ' n' )
560+
561+ validate_single (' vf' , line , 4 , ' v' )
562+ validate_single (' vt' , line , 4 , ' v' )
563+ validate_single (' vF' , line , 2 , ' v' )
564+ validate_single (' vT' , line , 2 , ' v' )
565+
566+ validate_single (' df' , line , 4 , ' n' )
567+ validate_single (' dt' , line , 4 , ' n' )
568+ validate_single (' dF' , line , 2 , ' n' )
569+ validate_single (' dT' , line , 2 , ' n' )
570+ end
554571
555- validate_normal (' vf' , 4 , ' v' )
556- validate_normal (' vt' , 4 , ' v' )
557- validate_normal (' vF' , 2 , ' v' )
558- validate_normal (' vT' , 2 , ' v' )
572+ -- Target is present but not reachable
573+ validate (' abcdefg' )
559574
560- validate_normal (' df' , 4 , ' n' )
561- validate_normal (' dt' , 4 , ' n' )
562- validate_normal (' dF' , 2 , ' n' )
563- validate_normal (' dT' , 2 , ' n' )
575+ -- Target is not present
576+ validate (' abcxefg' )
564577end
565578
566579T [' Jumping with f/t/F/T' ][' can be dot-repeated if did not jump at first' ] = function ()
@@ -720,6 +733,7 @@ T['Jumping with f/t/F/T']['stops jumping if no target is found'] = function()
720733 -- General idea: there was a bug which didn't reset jumping state if target
721734 -- was not found by `vim.fn.search()`. In that case, next typing of jumping
722735 -- key wouldn't make effect, but it should.
736+ -- Related test case: 'Enters jumping mode even if first jump is impossible'
723737 for _ , key in ipairs ({ ' f' , ' t' , ' F' , ' T' }) do
724738 local start_col = key == key :lower () and 0 or 3
725739 set_cursor (1 , start_col )
0 commit comments