mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-05-21 22:43:27 +02:00
Disabled paste when there are no copied commits
This commit is contained in:
parent
8b6766de79
commit
0b13c3ca87
@ -85,6 +85,10 @@ func (self *CherryPickHelper) Paste() error {
|
||||
})
|
||||
}
|
||||
|
||||
func (self *CherryPickHelper) CanPaste() bool {
|
||||
return self.getData().Active()
|
||||
}
|
||||
|
||||
func (self *CherryPickHelper) Reset() error {
|
||||
self.getData().ContextKey = ""
|
||||
self.getData().CherryPickedCommits = nil
|
||||
|
@ -112,6 +112,7 @@ func (self *LocalCommitsController) GetKeybindings(opts types.KeybindingsOpts) [
|
||||
{
|
||||
Key: opts.GetKey(opts.Config.Commits.PasteCommits),
|
||||
Handler: self.paste,
|
||||
GetDisabledReason: self.getDisabledReasonForPaste,
|
||||
Description: self.c.Tr.PasteCommits,
|
||||
},
|
||||
{
|
||||
@ -1001,6 +1002,14 @@ func (self *LocalCommitsController) paste() error {
|
||||
return self.c.Helpers().CherryPick.Paste()
|
||||
}
|
||||
|
||||
func (self *LocalCommitsController) getDisabledReasonForPaste() string {
|
||||
if !self.c.Helpers().CherryPick.CanPaste() {
|
||||
return self.c.Tr.NoCopiedCommits
|
||||
}
|
||||
|
||||
return ""
|
||||
}
|
||||
|
||||
func (self *LocalCommitsController) markAsBaseCommit(commit *models.Commit) error {
|
||||
if commit.Sha == self.c.Modes().MarkedBaseCommit.GetSha() {
|
||||
// Reset when invoking it again on the marked commit
|
||||
|
@ -612,6 +612,7 @@ type TranslationSet struct {
|
||||
PleaseGoToURL string
|
||||
DisabledMenuItemPrefix string
|
||||
NoCommitSelected string
|
||||
NoCopiedCommits string
|
||||
Actions Actions
|
||||
Bisect Bisect
|
||||
Log Log
|
||||
@ -1403,6 +1404,7 @@ func EnglishTranslationSet() TranslationSet {
|
||||
PleaseGoToURL: "Please go to {{.url}}",
|
||||
DisabledMenuItemPrefix: "Disabled: ",
|
||||
NoCommitSelected: "No commit selected",
|
||||
NoCopiedCommits: "No copied commits",
|
||||
Actions: Actions{
|
||||
// TODO: combine this with the original keybinding descriptions (those are all in lowercase atm)
|
||||
CheckoutCommit: "Checkout commit",
|
||||
|
Loading…
x
Reference in New Issue
Block a user