about summary refs log tree commit diff stats
path: root/commands
diff options
context:
space:
mode:
authorReto Brunner <reto@labrat.space>2020-11-08 13:39:25 +0100
committerReto Brunner <reto@labrat.space>2020-11-14 15:40:13 +0100
commit256af6322b1c219b56997b37a0c69070b53bcc86 (patch)
tree004ade1b72710394016e13749d9872aa556169dc /commands
parent24f1c575ae7941fa4239ec60bd86aef2f6641364 (diff)
downloadaerc-256af6322b1c219b56997b37a0c69070b53bcc86.tar.gz
allow the loading of existing headers
Diffstat (limited to 'commands')
-rw-r--r--commands/compose/header.go6
1 files changed, 4 insertions, 2 deletions
diff --git a/commands/compose/header.go b/commands/compose/header.go
index dd0adee..e4d7c40 100644
--- a/commands/compose/header.go
+++ b/commands/compose/header.go
@@ -56,18 +56,20 @@ func (Header) Execute(aerc *widgets.Aerc, args []string) error {
 
 	composer, _ := aerc.SelectedTab().(*widgets.Composer)
 
+	value := strings.Join(args[optind+1:], " ")
+
 	if !force {
 		headers, err := composer.PrepareHeader()
 		if err != nil {
 			return err
 		}
 
-		if headers.Has(args[optind]) {
+		if headers.Has(args[optind]) && value != "" {
 			return fmt.Errorf("Header %s already exists", args[optind])
 		}
 	}
 
-	composer.AddEditor(args[optind], strings.Join(args[optind+1:], " "), false)
+	composer.AddEditor(args[optind], value, false)
 
 	return nil
 }