aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/compose.go
diff options
context:
space:
mode:
authorRobin Jarry <robin@jarry.cc>2023-09-05 21:51:31 +0200
committerRobin Jarry <robin@jarry.cc>2023-09-19 16:49:59 +0200
commit34c718d72b357b6a64f4273ef72b4415ad721fd2 (patch)
tree21d6418cc66ef46aec34c1eaf0c0a8fd944307d6 /widgets/compose.go
parentc2a4fc7fdfae6469e782c5daac6772e3ec4d52cb (diff)
downloadaerc-34c718d72b357b6a64f4273ef72b4415ad721fd2.tar.gz
compose: respect header ordering from text editor
When [compose].edit-headers=true, make sure to respect the order of headers as set in the text editor. Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Inwit <inwit@sindominio.net>
Diffstat (limited to 'widgets/compose.go')
-rw-r--r--widgets/compose.go7
1 files changed, 3 insertions, 4 deletions
diff --git a/widgets/compose.go b/widgets/compose.go
index 5db377be..14fce3ce 100644
--- a/widgets/compose.go
+++ b/widgets/compose.go
@@ -1265,15 +1265,14 @@ func (c *Composer) termClosed(err error) {
}
return
}
+ // delete previous headers first
for _, h := range c.headerOrder() {
- if embedHeader.Get(h) == "" {
- // user deleted header in text editor
- c.delEditor(h)
- }
+ c.delEditor(h)
}
hf := embedHeader.Fields()
for hf.Next() {
if hf.Value() != "" {
+ // add new header values in order
c.addEditor(hf.Key(), hf.Value(), false)
}
}