@@ -531,36 +531,49 @@ end
531531
532532T [' Jumping with f/t/F/T' ][' does nothing if there is no place to jump' ] = function ()
533533 -- Normal mode
534- local validate_normal = function (keys , start_col , ref_mode )
535- set_lines ({ ' abcdefg ' })
534+ local validate_normal = function (keys , start_col , ref_mode , line )
535+ set_lines ({ line })
536536 set_cursor (1 , start_col )
537537
538538 type_keys (keys , ' d' )
539539
540540 -- It shouldn't move anywhere and should not modify text
541541 eq (get_cursor (), { 1 , start_col })
542- eq (get_lines (), { ' abcdefg' })
542+ eq (get_lines (), { line })
543+ eq (child .fn .mode (), ref_mode )
544+
545+ -- The above applies to subsequent dot-repeats as well
546+ type_keys (' .' )
547+ eq (get_cursor (), { 1 , start_col })
548+ eq (get_lines (), { line })
543549 eq (child .fn .mode (), ref_mode )
544550
545551 -- Ensure there is no jumping
546552 child .lua (' MiniJump.stop_jumping()' )
547553 child .ensure_normal_mode ()
548554 end
549555
550- validate_normal (' f' , 4 , ' n' )
551- validate_normal (' t' , 4 , ' n' )
552- validate_normal (' F' , 2 , ' n' )
553- validate_normal (' T' , 2 , ' n' )
554-
555- validate_normal (' vf' , 4 , ' v' )
556- validate_normal (' vt' , 4 , ' v' )
557- validate_normal (' vF' , 2 , ' v' )
558- validate_normal (' vT' , 2 , ' v' )
556+ local validate_by_line = function (line )
557+ validate_normal (' f' , 4 , ' n' , line )
558+ validate_normal (' t' , 4 , ' n' , line )
559+ validate_normal (' F' , 2 , ' n' , line )
560+ validate_normal (' T' , 2 , ' n' , line )
561+
562+ validate_normal (' vf' , 4 , ' v' , line )
563+ validate_normal (' vt' , 4 , ' v' , line )
564+ validate_normal (' vF' , 2 , ' v' , line )
565+ validate_normal (' vT' , 2 , ' v' , line )
566+
567+ validate_normal (' df' , 4 , ' n' , line )
568+ validate_normal (' dt' , 4 , ' n' , line )
569+ validate_normal (' dF' , 2 , ' n' , line )
570+ validate_normal (' dT' , 2 , ' n' , line )
571+ end
559572
560- validate_normal ( ' df ' , 4 , ' n ' )
561- validate_normal ( ' dt ' , 4 , ' n ' )
562- validate_normal ( ' dF ' , 2 , ' n ' )
563- validate_normal ( ' dT ' , 2 , ' n ' )
573+ -- Target d is present but not reachable
574+ validate_by_line ( ' abcdefg ' )
575+ -- Target d is not present
576+ validate_by_line ( ' 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