From 34c718d72b357b6a64f4273ef72b4415ad721fd2 Mon Sep 17 00:00:00 2001 From: Robin Jarry Date: Tue, 5 Sep 2023 21:51:31 +0200 Subject: 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 Tested-by: Inwit --- widgets/compose.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'widgets/compose.go') 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) } } -- cgit