@@ -98,7 +98,7 @@ func (self *BranchesController) GetKeybindings(opts types.KeybindingsOpts) []*ty
9898 },
9999 {
100100 Key : opts .GetKey (opts .Config .Universal .Remove ),
101- Handler : self .withItems (self .delete ),
101+ Handler : self .withItemsRange (self .delete ),
102102 GetDisabledReason : self .require (self .itemRangeSelected (self .branchesAreReal )),
103103 Description : self .c .Tr .Delete ,
104104 Tooltip : self .c .Tr .BranchDeleteTooltip ,
@@ -544,7 +544,7 @@ func (self *BranchesController) localAndRemoteDelete(branches []*models.Branch)
544544 return self .c .Helpers ().BranchesHelper .ConfirmLocalAndRemoteDelete (branches )
545545}
546546
547- func (self * BranchesController ) delete (branches []* models.Branch ) error {
547+ func (self * BranchesController ) delete (branches []* models.Branch , startIdx int , endIdx int ) error {
548548 checkedOutBranch := self .c .Helpers ().Refs .GetCheckedOutRef ()
549549 isBranchCheckedOut := lo .SomeBy (branches , func (branch * models.Branch ) bool {
550550 return checkedOutBranch .Name == branch .Name
@@ -557,6 +557,7 @@ func (self *BranchesController) delete(branches []*models.Branch) error {
557557 Label : lo .Ternary (len (branches ) > 1 , self .c .Tr .DeleteLocalBranches , self .c .Tr .DeleteLocalBranch ),
558558 Key : 'c' ,
559559 OnPress : func () error {
560+ self .context ().SetSelection (startIdx )
560561 return self .localDelete (branches )
561562 },
562563 }
@@ -568,6 +569,7 @@ func (self *BranchesController) delete(branches []*models.Branch) error {
568569 Label : lo .Ternary (len (branches ) > 1 , self .c .Tr .DeleteRemoteBranches , self .c .Tr .DeleteRemoteBranch ),
569570 Key : 'r' ,
570571 OnPress : func () error {
572+ self .context ().SetSelection (startIdx )
571573 return self .remoteDelete (branches )
572574 },
573575 }
@@ -581,6 +583,7 @@ func (self *BranchesController) delete(branches []*models.Branch) error {
581583 Label : lo .Ternary (len (branches ) > 1 , self .c .Tr .DeleteLocalAndRemoteBranches , self .c .Tr .DeleteLocalAndRemoteBranch ),
582584 Key : 'b' ,
583585 OnPress : func () error {
586+ self .context ().SetSelection (startIdx )
584587 return self .localAndRemoteDelete (branches )
585588 },
586589 }
0 commit comments