1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-01-04 03:48:07 +02:00

reorder patch command options

This commit is contained in:
Jesse Duffield 2019-11-05 12:42:19 +11:00
parent 0046e9c469
commit 61deaaddb7

View File

@ -23,18 +23,25 @@ func (gui *Gui) handleCreatePatchOptionsMenu(g *gocui.Gui, v *gocui.View) error
}
options := []*patchMenuOption{
{displayName: "discard patch", function: gui.handleDeletePatchFromCommit},
{displayName: fmt.Sprintf("remove patch from original commit (%s)", gui.GitCommand.PatchManager.CommitSha), function: gui.handleDeletePatchFromCommit},
{displayName: "pull patch out into index", function: gui.handlePullPatchIntoWorkingTree},
{displayName: "save patch to file"},
{displayName: "clear patch", function: gui.handleClearPatch},
{displayName: "reset patch", function: gui.handleClearPatch},
}
selectedCommit := gui.getSelectedCommit(gui.g)
if selectedCommit != nil && gui.GitCommand.PatchManager.CommitSha != selectedCommit.Sha {
options = append(options, &patchMenuOption{
displayName: fmt.Sprintf("move patch to selected commit (%s)", selectedCommit.Sha),
function: gui.handleMovePatchToSelectedCommit,
})
// adding this option to index 1
options = append(
options[:1],
append(
[]*patchMenuOption{
{
displayName: fmt.Sprintf("move patch to selected commit (%s)", selectedCommit.Sha),
function: gui.handleMovePatchToSelectedCommit,
},
}, options[1:]...,
)...,
)
}
handleMenuPress := func(index int) error {