about summary refs log tree commit diff stats
path: root/widgets/compose.go
diff options
context:
space:
mode:
authorKevin Kuehler <keur@ocf.berkeley.edu>2019-08-03 17:23:08 -0700
committerDrew DeVault <sir@cmpwn.com>2019-08-07 14:07:22 +0900
commit0ceea02720bcebb7e672b42cc72b2e8ce117ada8 (patch)
tree1bbda14485fe65eef2ce1d8f2ef8ccbdd726fc99 /widgets/compose.go
parent0847464da1da5c2df19e107ee3884ab7996c1756 (diff)
downloadaerc-0ceea02720bcebb7e672b42cc72b2e8ce117ada8.tar.gz
cc/bcc: Append to existing headers if called twice
Signed-off-by: Kevin Kuehler <keur@ocf.berkeley.edu>
Diffstat (limited to 'widgets/compose.go')
-rw-r--r--widgets/compose.go7
1 files changed, 6 insertions, 1 deletions
diff --git a/widgets/compose.go b/widgets/compose.go
index e2615ed..936da14 100644
--- a/widgets/compose.go
+++ b/widgets/compose.go
@@ -10,6 +10,7 @@ import (
 	"os"
 	"os/exec"
 	"path/filepath"
+	"strings"
 	"time"
 
 	"github.com/emersion/go-message"
@@ -509,8 +510,12 @@ func (c *Composer) NextField() {
 }
 
 // AddEditor appends a new header editor to the compose window.
-func (c *Composer) AddEditor(header string, value string) {
+func (c *Composer) AddEditor(header string, value string, appendHeader bool) {
 	if _, ok := c.editors[header]; ok {
+		if appendHeader {
+			header := c.editors[header].input.String()
+			value = strings.TrimSpace(header) + ", " + value
+		}
 		c.editors[header].input.Set(value)
 		return
 	}