From 20752df89c3bef0aca23493bfe8a668b93db9947 Mon Sep 17 00:00:00 2001 From: Robin Jarry Date: Fri, 5 Nov 2021 10:34:10 +0100 Subject: [PATCH] viewer: add colon after header names Display them as standard RFC 822 headers. Signed-off-by: Robin Jarry --- widgets/compose.go | 4 ++-- widgets/msgviewer.go | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/widgets/compose.go b/widgets/compose.go index 7233d30..69a2dcc 100644 --- a/widgets/compose.go +++ b/widgets/compose.go @@ -773,11 +773,11 @@ func (he *headerEditor) setValue(val string) { func (he *headerEditor) Draw(ctx *ui.Context) { name := textproto.CanonicalMIMEHeaderKey(he.name) // Extra character to put a blank cell between the header and the input - size := runewidth.StringWidth(name) + 1 + size := runewidth.StringWidth(name+":") + 1 defaultStyle := he.uiConfig.GetStyle(config.STYLE_DEFAULT) headerStyle := he.uiConfig.GetStyle(config.STYLE_HEADER) ctx.Fill(0, 0, size, ctx.Height(), ' ', defaultStyle) - ctx.Printf(0, 0, headerStyle, "%s", name) + ctx.Printf(0, 0, headerStyle, "%s:", name) he.input.Draw(ctx.Subcontext(size, 0, ctx.Width()-size, 1)) } diff --git a/widgets/msgviewer.go b/widgets/msgviewer.go index b1decd5..fc4529c 100644 --- a/widgets/msgviewer.go +++ b/widgets/msgviewer.go @@ -731,7 +731,7 @@ type HeaderView struct { func (hv *HeaderView) Draw(ctx *ui.Context) { name := hv.Name - size := runewidth.StringWidth(name) + size := runewidth.StringWidth(name + ":") lim := ctx.Width() - size - 1 value := runewidth.Truncate(" "+hv.Value, lim, "…") @@ -744,7 +744,7 @@ func (hv *HeaderView) Draw(ctx *ui.Context) { } ctx.Fill(0, 0, ctx.Width(), ctx.Height(), ' ', vstyle) - ctx.Printf(0, 0, hstyle, "%s", name) + ctx.Printf(0, 0, hstyle, "%s:", name) ctx.Printf(size, 0, vstyle, "%s", value) }