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 {
|
func (self *CherryPickHelper) Reset() error {
|
||||||
self.getData().ContextKey = ""
|
self.getData().ContextKey = ""
|
||||||
self.getData().CherryPickedCommits = nil
|
self.getData().CherryPickedCommits = nil
|
||||||
|
@ -110,9 +110,10 @@ func (self *LocalCommitsController) GetKeybindings(opts types.KeybindingsOpts) [
|
|||||||
Description: self.c.Tr.MoveUpCommit,
|
Description: self.c.Tr.MoveUpCommit,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Key: opts.GetKey(opts.Config.Commits.PasteCommits),
|
Key: opts.GetKey(opts.Config.Commits.PasteCommits),
|
||||||
Handler: self.paste,
|
Handler: self.paste,
|
||||||
Description: self.c.Tr.PasteCommits,
|
GetDisabledReason: self.getDisabledReasonForPaste,
|
||||||
|
Description: self.c.Tr.PasteCommits,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Key: opts.GetKey(opts.Config.Commits.MarkCommitAsBaseForRebase),
|
Key: opts.GetKey(opts.Config.Commits.MarkCommitAsBaseForRebase),
|
||||||
@ -1001,6 +1002,14 @@ func (self *LocalCommitsController) paste() error {
|
|||||||
return self.c.Helpers().CherryPick.Paste()
|
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 {
|
func (self *LocalCommitsController) markAsBaseCommit(commit *models.Commit) error {
|
||||||
if commit.Sha == self.c.Modes().MarkedBaseCommit.GetSha() {
|
if commit.Sha == self.c.Modes().MarkedBaseCommit.GetSha() {
|
||||||
// Reset when invoking it again on the marked commit
|
// Reset when invoking it again on the marked commit
|
||||||
|
@ -612,6 +612,7 @@ type TranslationSet struct {
|
|||||||
PleaseGoToURL string
|
PleaseGoToURL string
|
||||||
DisabledMenuItemPrefix string
|
DisabledMenuItemPrefix string
|
||||||
NoCommitSelected string
|
NoCommitSelected string
|
||||||
|
NoCopiedCommits string
|
||||||
Actions Actions
|
Actions Actions
|
||||||
Bisect Bisect
|
Bisect Bisect
|
||||||
Log Log
|
Log Log
|
||||||
@ -1403,6 +1404,7 @@ func EnglishTranslationSet() TranslationSet {
|
|||||||
PleaseGoToURL: "Please go to {{.url}}",
|
PleaseGoToURL: "Please go to {{.url}}",
|
||||||
DisabledMenuItemPrefix: "Disabled: ",
|
DisabledMenuItemPrefix: "Disabled: ",
|
||||||
NoCommitSelected: "No commit selected",
|
NoCommitSelected: "No commit selected",
|
||||||
|
NoCopiedCommits: "No copied commits",
|
||||||
Actions: Actions{
|
Actions: Actions{
|
||||||
// TODO: combine this with the original keybinding descriptions (those are all in lowercase atm)
|
// TODO: combine this with the original keybinding descriptions (those are all in lowercase atm)
|
||||||
CheckoutCommit: "Checkout commit",
|
CheckoutCommit: "Checkout commit",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user