cc/bcc: Append to existing headers if called twice
Signed-off-by: Kevin Kuehler <keur@ocf.berkeley.edu>
This commit is contained in:
parent
0847464da1
commit
0ceea02720
2 changed files with 8 additions and 3 deletions
|
@ -30,9 +30,9 @@ func (_ CC) Execute(aerc *widgets.Aerc, args []string) error {
|
||||||
|
|
||||||
switch args[0] {
|
switch args[0] {
|
||||||
case "cc":
|
case "cc":
|
||||||
composer.AddEditor("Cc", addrs)
|
composer.AddEditor("Cc", addrs, true)
|
||||||
case "bcc":
|
case "bcc":
|
||||||
composer.AddEditor("Bcc", addrs)
|
composer.AddEditor("Bcc", addrs, true)
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
|
|
@ -10,6 +10,7 @@ import (
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/emersion/go-message"
|
"github.com/emersion/go-message"
|
||||||
|
@ -509,8 +510,12 @@ func (c *Composer) NextField() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// AddEditor appends a new header editor to the compose window.
|
// 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 _, ok := c.editors[header]; ok {
|
||||||
|
if appendHeader {
|
||||||
|
header := c.editors[header].input.String()
|
||||||
|
value = strings.TrimSpace(header) + ", " + value
|
||||||
|
}
|
||||||
c.editors[header].input.Set(value)
|
c.editors[header].input.Set(value)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue