mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-06-04 23:37:41 +02:00
Remove error return value from functions that always return nil
This commit is contained in:
parent
8dea2dab88
commit
a709caf138
@ -157,7 +157,7 @@ func (self *ConfirmationHelper) getPopupPanelWidth() int {
|
|||||||
|
|
||||||
func (self *ConfirmationHelper) prepareConfirmationPanel(
|
func (self *ConfirmationHelper) prepareConfirmationPanel(
|
||||||
opts types.ConfirmOpts,
|
opts types.ConfirmOpts,
|
||||||
) error {
|
) {
|
||||||
self.c.Views().Confirmation.Title = opts.Title
|
self.c.Views().Confirmation.Title = opts.Title
|
||||||
// for now we do not support wrapping in our editor
|
// for now we do not support wrapping in our editor
|
||||||
self.c.Views().Confirmation.Wrap = !opts.Editable
|
self.c.Views().Confirmation.Wrap = !opts.Editable
|
||||||
@ -176,8 +176,6 @@ func (self *ConfirmationHelper) prepareConfirmationPanel(
|
|||||||
suggestionsView.Title = fmt.Sprintf(self.c.Tr.SuggestionsTitle, self.c.UserConfig().Keybinding.Universal.TogglePanel)
|
suggestionsView.Title = fmt.Sprintf(self.c.Tr.SuggestionsTitle, self.c.UserConfig().Keybinding.Universal.TogglePanel)
|
||||||
suggestionsView.Subtitle = ""
|
suggestionsView.Subtitle = ""
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func runeForMask(mask bool) rune {
|
func runeForMask(mask bool) rune {
|
||||||
@ -207,7 +205,7 @@ func (self *ConfirmationHelper) CreatePopupPanel(ctx goContext.Context, opts typ
|
|||||||
// remove any previous keybindings
|
// remove any previous keybindings
|
||||||
self.clearConfirmationViewKeyBindings()
|
self.clearConfirmationViewKeyBindings()
|
||||||
|
|
||||||
err := self.prepareConfirmationPanel(
|
self.prepareConfirmationPanel(
|
||||||
types.ConfirmOpts{
|
types.ConfirmOpts{
|
||||||
Title: opts.Title,
|
Title: opts.Title,
|
||||||
Prompt: opts.Prompt,
|
Prompt: opts.Prompt,
|
||||||
@ -215,10 +213,6 @@ func (self *ConfirmationHelper) CreatePopupPanel(ctx goContext.Context, opts typ
|
|||||||
Editable: opts.Editable,
|
Editable: opts.Editable,
|
||||||
Mask: opts.Mask,
|
Mask: opts.Mask,
|
||||||
})
|
})
|
||||||
if err != nil {
|
|
||||||
cancel()
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
confirmationView := self.c.Views().Confirmation
|
confirmationView := self.c.Views().Confirmation
|
||||||
confirmationView.Editable = opts.Editable
|
confirmationView.Editable = opts.Editable
|
||||||
|
|
||||||
@ -232,10 +226,7 @@ func (self *ConfirmationHelper) CreatePopupPanel(ctx goContext.Context, opts typ
|
|||||||
self.c.SetViewContent(confirmationView, style.AttrBold.Sprint(underlineLinks(opts.Prompt)))
|
self.c.SetViewContent(confirmationView, style.AttrBold.Sprint(underlineLinks(opts.Prompt)))
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := self.setKeyBindings(cancel, opts); err != nil {
|
self.setKeyBindings(cancel, opts)
|
||||||
cancel()
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
self.c.Contexts().Suggestions.State.AllowEditSuggestion = opts.AllowEditSuggestion
|
self.c.Contexts().Suggestions.State.AllowEditSuggestion = opts.AllowEditSuggestion
|
||||||
|
|
||||||
@ -266,7 +257,7 @@ func underlineLinks(text string) string {
|
|||||||
return result + remaining
|
return result + remaining
|
||||||
}
|
}
|
||||||
|
|
||||||
func (self *ConfirmationHelper) setKeyBindings(cancel goContext.CancelFunc, opts types.CreatePopupPanelOpts) error {
|
func (self *ConfirmationHelper) setKeyBindings(cancel goContext.CancelFunc, opts types.CreatePopupPanelOpts) {
|
||||||
var onConfirm func() error
|
var onConfirm func() error
|
||||||
if opts.HandleConfirmPrompt != nil {
|
if opts.HandleConfirmPrompt != nil {
|
||||||
onConfirm = self.wrappedPromptConfirmationFunction(cancel, opts.HandleConfirmPrompt, func() string { return self.c.Views().Confirmation.TextArea.GetContent() })
|
onConfirm = self.wrappedPromptConfirmationFunction(cancel, opts.HandleConfirmPrompt, func() string { return self.c.Views().Confirmation.TextArea.GetContent() })
|
||||||
@ -296,8 +287,6 @@ func (self *ConfirmationHelper) setKeyBindings(cancel goContext.CancelFunc, opts
|
|||||||
self.c.Contexts().Suggestions.State.OnConfirm = onSuggestionConfirm
|
self.c.Contexts().Suggestions.State.OnConfirm = onSuggestionConfirm
|
||||||
self.c.Contexts().Suggestions.State.OnClose = onClose
|
self.c.Contexts().Suggestions.State.OnClose = onClose
|
||||||
self.c.Contexts().Suggestions.State.OnDeleteSuggestion = onDeleteSuggestion
|
self.c.Contexts().Suggestions.State.OnDeleteSuggestion = onDeleteSuggestion
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (self *ConfirmationHelper) clearConfirmationViewKeyBindings() {
|
func (self *ConfirmationHelper) clearConfirmationViewKeyBindings() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user