File tree Expand file tree Collapse file tree 2 files changed +31
-0
lines changed Expand file tree Collapse file tree 2 files changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -46,6 +46,7 @@ func (self *PatchBuildingController) GetKeybindings(opts types.KeybindingsOpts)
46
46
Key : opts .GetKey (opts .Config .Universal .Return ),
47
47
Handler : self .Escape ,
48
48
Description : self .c .Tr .ExitCustomPatchBuilder ,
49
+ DescriptionFunc : self .EscapeDescription ,
49
50
DisplayOnScreen : true ,
50
51
},
51
52
}
@@ -180,3 +181,18 @@ func (self *PatchBuildingController) Escape() error {
180
181
self .c .Helpers ().PatchBuilding .Escape ()
181
182
return nil
182
183
}
184
+
185
+ func (self * PatchBuildingController ) EscapeDescription () string {
186
+ context := self .c .Contexts ().CustomPatchBuilder
187
+ if state := context .GetState (); state != nil {
188
+ if state .SelectingRange () {
189
+ return self .c .Tr .DismissRangeSelect
190
+ }
191
+
192
+ if state .SelectingHunkEnabledByUser () {
193
+ return self .c .Tr .SelectLineByLine
194
+ }
195
+ }
196
+
197
+ return self .c .Tr .ExitCustomPatchBuilder
198
+ }
Original file line number Diff line number Diff line change @@ -71,6 +71,7 @@ func (self *StagingController) GetKeybindings(opts types.KeybindingsOpts) []*typ
71
71
Key : opts .GetKey (opts .Config .Universal .Return ),
72
72
Handler : self .Escape ,
73
73
Description : self .c .Tr .ReturnToFilesPanel ,
74
+ DescriptionFunc : self .EscapeDescription ,
74
75
DisplayOnScreen : true ,
75
76
},
76
77
{
@@ -179,6 +180,20 @@ func (self *StagingController) Escape() error {
179
180
return nil
180
181
}
181
182
183
+ func (self * StagingController ) EscapeDescription () string {
184
+ if state := self .context .GetState (); state != nil {
185
+ if state .SelectingRange () {
186
+ return self .c .Tr .DismissRangeSelect
187
+ }
188
+
189
+ if state .SelectingHunkEnabledByUser () {
190
+ return self .c .Tr .SelectLineByLine
191
+ }
192
+ }
193
+
194
+ return self .c .Tr .ReturnToFilesPanel
195
+ }
196
+
182
197
func (self * StagingController ) TogglePanel () error {
183
198
if self .otherContext .GetState () != nil {
184
199
self .c .Context ().Push (self .otherContext , types.OnFocusOpts {})
You can’t perform that action at this time.
0 commit comments