mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-04-19 17:02:18 +03:00
As part of making lazygit more discoverable, there are certain keys which you almost certainly need to press when you're in a given mode e.g. 'v' to paste commits when cherry-picking. This commit prominently shows these keybinding suggestions alongside the others in the option view. I'm using the same colours for these keybindings as is associated with the mode elsewhere e.g. yellow for rebasing and cyan for cherry-picking. The cherry-picking one is a bit weird because we also use cyan text to show loaders and app status at the bottom left so it may be confusing, but I haven't personally found it awkward from having tested it out myself. Previously we would render these options whenever a new context was activated, but now that we need to re-render options whenever a mode changes, I'm instead rendering them on each screen re-render (i.e. in the layout function). Given how cheap it is to render this text, I think it's fine performance-wise.
91 lines
2.2 KiB
Go
91 lines
2.2 KiB
Go
package components
|
|
|
|
// for running common actions
|
|
type Common struct {
|
|
t *TestDriver
|
|
}
|
|
|
|
func (self *Common) ContinueMerge() {
|
|
self.t.GlobalPress(self.t.keys.Universal.CreateRebaseOptionsMenu)
|
|
|
|
self.t.ExpectPopup().Menu().
|
|
Title(Equals("Rebase options")).
|
|
Select(Contains("continue")).
|
|
Confirm()
|
|
}
|
|
|
|
func (self *Common) ContinueRebase() {
|
|
self.ContinueMerge()
|
|
}
|
|
|
|
func (self *Common) AbortRebase() {
|
|
self.t.GlobalPress(self.t.keys.Universal.CreateRebaseOptionsMenu)
|
|
|
|
self.t.ExpectPopup().Menu().
|
|
Title(Equals("Rebase options")).
|
|
Select(Contains("abort")).
|
|
Confirm()
|
|
}
|
|
|
|
func (self *Common) AbortMerge() {
|
|
self.t.GlobalPress(self.t.keys.Universal.CreateRebaseOptionsMenu)
|
|
|
|
self.t.ExpectPopup().Menu().
|
|
Title(Equals("Merge options")).
|
|
Select(Contains("abort")).
|
|
Confirm()
|
|
}
|
|
|
|
func (self *Common) AcknowledgeConflicts() {
|
|
self.t.ExpectPopup().Menu().
|
|
Title(Equals("Conflicts!")).
|
|
Select(Contains("View conflicts")).
|
|
Confirm()
|
|
}
|
|
|
|
func (self *Common) ContinueOnConflictsResolved() {
|
|
self.t.ExpectPopup().Confirmation().
|
|
Title(Equals("Continue")).
|
|
Content(Contains("All merge conflicts resolved. Continue?")).
|
|
Confirm()
|
|
}
|
|
|
|
func (self *Common) ConfirmDiscardLines() {
|
|
self.t.ExpectPopup().Confirmation().
|
|
Title(Equals("Discard change")).
|
|
Content(Contains("Are you sure you want to discard this change")).
|
|
Confirm()
|
|
}
|
|
|
|
func (self *Common) SelectPatchOption(matcher *TextMatcher) {
|
|
self.t.GlobalPress(self.t.keys.Universal.CreatePatchOptionsMenu)
|
|
|
|
self.t.ExpectPopup().Menu().Title(Equals("Patch options")).Select(matcher).Confirm()
|
|
}
|
|
|
|
func (self *Common) ResetBisect() {
|
|
self.t.Views().Commits().
|
|
Focus().
|
|
Press(self.t.keys.Commits.ViewBisectOptions).
|
|
Tap(func() {
|
|
self.t.ExpectPopup().Menu().
|
|
Title(Equals("Bisect")).
|
|
Select(Contains("Reset bisect")).
|
|
Confirm()
|
|
|
|
self.t.ExpectPopup().Confirmation().
|
|
Title(Equals("Reset 'git bisect'")).
|
|
Content(Contains("Are you sure you want to reset 'git bisect'?")).
|
|
Confirm()
|
|
})
|
|
}
|
|
|
|
func (self *Common) ResetCustomPatch() {
|
|
self.t.GlobalPress(self.t.keys.Universal.CreatePatchOptionsMenu)
|
|
|
|
self.t.ExpectPopup().Menu().
|
|
Title(Equals("Patch options")).
|
|
Select(Contains("Reset patch")).
|
|
Confirm()
|
|
}
|