Get rid of the aerc.PushError(" " + $string) idiom

The individual callers should not be responsible for padding
This commit is contained in:
Reto Brunner 2021-01-30 13:51:32 +01:00
parent 949781fa0a
commit 8ea86cea41
18 changed files with 29 additions and 29 deletions

View file

@ -428,7 +428,7 @@ func (wizard *AccountWizard) ConfigureTemporaryAccount(temporary bool) {
func (wizard *AccountWizard) errorFor(d ui.Interactive, err error) {
if d == nil {
wizard.aerc.PushError(" " + err.Error())
wizard.aerc.PushError(err.Error())
wizard.Invalidate()
return
}
@ -443,7 +443,7 @@ func (wizard *AccountWizard) errorFor(d ui.Interactive, err error) {
wizard.step = step
wizard.focus = focus
wizard.Focus(true)
wizard.aerc.PushError(" " + err.Error())
wizard.aerc.PushError(err.Error())
wizard.Invalidate()
return
}
@ -559,7 +559,7 @@ func (wizard *AccountWizard) finish(tutorial bool) {
term.OnClose = func(err error) {
wizard.aerc.RemoveTab(term)
if err != nil {
wizard.aerc.PushError(" " + err.Error())
wizard.aerc.PushError(err.Error())
}
}
}

View file

@ -429,11 +429,11 @@ func (aerc *Aerc) BeginExCommand(cmd string) {
exline := NewExLine(aerc.conf, cmd, func(cmd string) {
parts, err := shlex.Split(cmd)
if err != nil {
aerc.PushError(" " + err.Error())
aerc.PushError(err.Error())
}
err = aerc.cmd(parts)
if err != nil {
aerc.PushError(" " + err.Error())
aerc.PushError(err.Error())
}
// only add to history if this is an unsimulated command,
// ie one not executed from a keybinding
@ -457,7 +457,7 @@ func (aerc *Aerc) RegisterPrompt(prompt string, cmd []string) {
}
err := aerc.cmd(cmd)
if err != nil {
aerc.PushError(" " + err.Error())
aerc.PushError(err.Error())
}
}, func(cmd string) []string {
return nil // TODO: completions
@ -484,7 +484,7 @@ func (aerc *Aerc) RegisterChoices(choices []Choice) {
}
err := aerc.cmd(cmd)
if err != nil {
aerc.PushError(" " + err.Error())
aerc.PushError(err.Error())
}
}, func(cmd string) []string {
return nil // TODO: completions