diff --git a/pkg/gui/files_panel.go b/pkg/gui/files_panel.go index c2f3b9206..a92561a50 100644 --- a/pkg/gui/files_panel.go +++ b/pkg/gui/files_panel.go @@ -548,43 +548,23 @@ func (gui *Gui) handleCustomCommand(g *gocui.Gui, v *gocui.View) error { }) } -type stashOption struct { - description string - handler func() error -} - -// GetDisplayStrings is a function. -func (o *stashOption) GetDisplayStrings(isFocused bool) []string { - return []string{o.description} -} - func (gui *Gui) handleCreateStashMenu(g *gocui.Gui, v *gocui.View) error { - options := []*stashOption{ + menuItems := []*menuItem{ { - description: gui.Tr.SLocalize("stashAllChanges"), - handler: func() error { + displayString: gui.Tr.SLocalize("stashAllChanges"), + onPress: func() error { return gui.handleStashSave(gui.GitCommand.StashSave) }, }, { - description: gui.Tr.SLocalize("stashStagedChanges"), - handler: func() error { + displayString: gui.Tr.SLocalize("stashStagedChanges"), + onPress: func() error { return gui.handleStashSave(gui.GitCommand.StashSaveStagedChanges) }, }, - { - description: gui.Tr.SLocalize("cancel"), - handler: func() error { - return nil - }, - }, } - handleMenuPress := func(index int) error { - return options[index].handler() - } - - return gui.createMenu(gui.Tr.SLocalize("stashOptions"), options, len(options), handleMenuPress) + return gui.createMenuNew(gui.Tr.SLocalize("stashOptions"), menuItems, createMenuOptions{showCancel: true}) } func (gui *Gui) handleStashChanges(g *gocui.Gui, v *gocui.View) error {