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)
4545 {
4646 Key : opts .GetKey (opts .Config .Universal .Return ),
4747 Handler : self .Escape ,
48- Description : self .c . Tr . ExitCustomPatchBuilder ,
48+ DescriptionFunc : self .EscapeDescription ,
4949 DisplayOnScreen : true ,
5050 },
5151 }
@@ -180,3 +180,18 @@ func (self *PatchBuildingController) Escape() error {
180180 self .c .Helpers ().PatchBuilding .Escape ()
181181 return nil
182182}
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
7070 {
7171 Key : opts .GetKey (opts .Config .Universal .Return ),
7272 Handler : self .Escape ,
73- Description : self .c . Tr . ReturnToFilesPanel ,
73+ DescriptionFunc : self .EscapeDescription ,
7474 DisplayOnScreen : true ,
7575 },
7676 {
@@ -179,6 +179,20 @@ func (self *StagingController) Escape() error {
179179 return nil
180180}
181181
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+
182196func (self * StagingController ) TogglePanel () error {
183197 if self .otherContext .GetState () != nil {
184198 self .c .Context ().Push (self .otherContext , types.OnFocusOpts {})
You can’t perform that action at this time.
0 commit comments