@@ -55,10 +55,10 @@ func NewLocalCommitsController(
55
55
func (self * LocalCommitsController ) GetKeybindings (opts types.KeybindingsOpts ) []* types.Binding {
56
56
editCommitKey := opts .Config .Universal .Edit
57
57
58
- outsideFilterModeBindings := []* types.Binding {
58
+ bindings := []* types.Binding {
59
59
{
60
60
Key : opts .GetKey (opts .Config .Commits .SquashDown ),
61
- Handler : self .withItemsRange (self .squashDown ),
61
+ Handler : opts . Guards . OutsideFilterMode ( self .withItemsRange (self .squashDown ) ),
62
62
GetDisabledReason : self .require (
63
63
self .itemRangeSelected (
64
64
self .midRebaseCommandEnabled ,
@@ -71,7 +71,7 @@ func (self *LocalCommitsController) GetKeybindings(opts types.KeybindingsOpts) [
71
71
},
72
72
{
73
73
Key : opts .GetKey (opts .Config .Commits .MarkCommitAsFixup ),
74
- Handler : self .withItemsRange (self .fixup ),
74
+ Handler : opts . Guards . OutsideFilterMode ( self .withItemsRange (self .fixup ) ),
75
75
GetDisabledReason : self .require (
76
76
self .itemRangeSelected (
77
77
self .midRebaseCommandEnabled ,
@@ -115,7 +115,7 @@ func (self *LocalCommitsController) GetKeybindings(opts types.KeybindingsOpts) [
115
115
},
116
116
{
117
117
Key : opts .GetKey (editCommitKey ),
118
- Handler : self .withItemsRange (self .edit ),
118
+ Handler : opts . Guards . OutsideFilterMode ( self .withItemsRange (self .edit ) ),
119
119
GetDisabledReason : self .require (
120
120
self .itemRangeSelected (self .midRebaseCommandEnabled ),
121
121
),
@@ -129,7 +129,7 @@ func (self *LocalCommitsController) GetKeybindings(opts types.KeybindingsOpts) [
129
129
// we're calling it 'quick-start interactive rebase' to differentiate it from
130
130
// when you manually select the base commit.
131
131
Key : opts .GetKey (opts .Config .Commits .StartInteractiveRebase ),
132
- Handler : self .quickStartInteractiveRebase ,
132
+ Handler : opts . Guards . OutsideFilterMode ( self .quickStartInteractiveRebase ) ,
133
133
GetDisabledReason : self .require (self .notMidRebase (self .c .Tr .AlreadyRebasing ), self .canFindCommitForQuickStart ),
134
134
Description : self .c .Tr .QuickStartInteractiveRebase ,
135
135
Tooltip : utils .ResolvePlaceholderString (self .c .Tr .QuickStartInteractiveRebaseTooltip , map [string ]string {
@@ -138,7 +138,7 @@ func (self *LocalCommitsController) GetKeybindings(opts types.KeybindingsOpts) [
138
138
},
139
139
{
140
140
Key : opts .GetKey (opts .Config .Commits .PickCommit ),
141
- Handler : self .withItems (self .pick ),
141
+ Handler : opts . Guards . OutsideFilterMode ( self .withItems (self .pick ) ),
142
142
GetDisabledReason : self .require (
143
143
self .itemRangeSelected (self .pickEnabled ),
144
144
),
@@ -147,7 +147,7 @@ func (self *LocalCommitsController) GetKeybindings(opts types.KeybindingsOpts) [
147
147
},
148
148
{
149
149
Key : opts .GetKey (opts .Config .Commits .CreateFixupCommit ),
150
- Handler : self .withItem (self .createFixupCommit ),
150
+ Handler : opts . Guards . OutsideFilterMode ( self .withItem (self .createFixupCommit ) ),
151
151
GetDisabledReason : self .require (self .singleItemSelected ()),
152
152
Description : self .c .Tr .CreateFixupCommit ,
153
153
Tooltip : utils .ResolvePlaceholderString (
@@ -159,7 +159,7 @@ func (self *LocalCommitsController) GetKeybindings(opts types.KeybindingsOpts) [
159
159
},
160
160
{
161
161
Key : opts .GetKey (opts .Config .Commits .SquashAboveCommits ),
162
- Handler : self .squashFixupCommits ,
162
+ Handler : opts . Guards . OutsideFilterMode ( self .squashFixupCommits ) ,
163
163
GetDisabledReason : self .require (
164
164
self .notMidRebase (self .c .Tr .AlreadyRebasing ),
165
165
),
@@ -169,7 +169,7 @@ func (self *LocalCommitsController) GetKeybindings(opts types.KeybindingsOpts) [
169
169
},
170
170
{
171
171
Key : opts .GetKey (opts .Config .Commits .MoveDownCommit ),
172
- Handler : self .withItemsRange (self .moveDown ),
172
+ Handler : opts . Guards . OutsideFilterMode ( self .withItemsRange (self .moveDown ) ),
173
173
GetDisabledReason : self .require (self .itemRangeSelected (
174
174
self .midRebaseMoveCommandEnabled ,
175
175
self .canMoveDown ,
@@ -178,7 +178,7 @@ func (self *LocalCommitsController) GetKeybindings(opts types.KeybindingsOpts) [
178
178
},
179
179
{
180
180
Key : opts .GetKey (opts .Config .Commits .MoveUpCommit ),
181
- Handler : self .withItemsRange (self .moveUp ),
181
+ Handler : opts . Guards . OutsideFilterMode ( self .withItemsRange (self .moveUp ) ),
182
182
GetDisabledReason : self .require (self .itemRangeSelected (
183
183
self .midRebaseMoveCommandEnabled ,
184
184
self .canMoveUp ,
@@ -187,25 +187,18 @@ func (self *LocalCommitsController) GetKeybindings(opts types.KeybindingsOpts) [
187
187
},
188
188
{
189
189
Key : opts .GetKey (opts .Config .Commits .PasteCommits ),
190
- Handler : self .paste ,
190
+ Handler : opts . Guards . OutsideFilterMode ( self .paste ) ,
191
191
GetDisabledReason : self .require (self .canPaste ),
192
192
Description : self .c .Tr .PasteCommits ,
193
193
DisplayStyle : & style .FgCyan ,
194
194
},
195
195
{
196
196
Key : opts .GetKey (opts .Config .Commits .MarkCommitAsBaseForRebase ),
197
- Handler : self .withItem (self .markAsBaseCommit ),
197
+ Handler : opts . Guards . OutsideFilterMode ( self .withItem (self .markAsBaseCommit ) ),
198
198
GetDisabledReason : self .require (self .singleItemSelected ()),
199
199
Description : self .c .Tr .MarkAsBaseCommit ,
200
200
Tooltip : self .c .Tr .MarkAsBaseCommitTooltip ,
201
201
},
202
- }
203
-
204
- for _ , binding := range outsideFilterModeBindings {
205
- binding .Handler = opts .Guards .OutsideFilterMode (binding .Handler )
206
- }
207
-
208
- bindings := append (outsideFilterModeBindings , []* types.Binding {
209
202
// overriding this navigation keybinding because we might need to load
210
203
// more commits on demand
211
204
{
@@ -251,7 +244,7 @@ func (self *LocalCommitsController) GetKeybindings(opts types.KeybindingsOpts) [
251
244
Tooltip : self .c .Tr .OpenLogMenuTooltip ,
252
245
OpensMenu : true ,
253
246
},
254
- }... )
247
+ }
255
248
256
249
return bindings
257
250
}
0 commit comments