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