about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorReto Brunner <reto@labrat.space>2020-01-04 20:38:59 +0100
committerDrew DeVault <sir@cmpwn.com>2020-01-05 16:02:41 -0500
commitcb168682b3754e57e27d809e41d8c22bb56457af (patch)
tree722f8b9f0aadd1a6215fd7a6237d42665bf8e3d2
parent7a1770f12924fca85869f0568d169ead2c5648f8 (diff)
downloadaerc-cb168682b3754e57e27d809e41d8c22bb56457af.tar.gz
msgviewer: bypass filter for headers
-rw-r--r--widgets/msgviewer.go9
1 files changed, 6 insertions, 3 deletions
diff --git a/widgets/msgviewer.go b/widgets/msgviewer.go
index 426d914..ff3bcb0 100644
--- a/widgets/msgviewer.go
+++ b/widgets/msgviewer.go
@@ -585,18 +585,21 @@ func (pv *PartViewer) attemptCopy() {
 		}
 		go func() {
 			if pv.showHeaders && pv.msg.RFC822Headers != nil {
+				// header need to bypass the filter, else we run into issues
+				// with the filter messing with newlines etc.
+				// hence all writes in this block go directly to the pager
 				fields := pv.msg.RFC822Headers.Fields()
 				for fields.Next() {
 					field := fmt.Sprintf(
 						"%s: %s\n", fields.Key(), fields.Value())
-					pv.sink.Write([]byte(field))
+					pv.pagerin.Write([]byte(field))
 				}
 				// virtual header
 				if len(pv.msg.Labels) != 0 {
 					labels := fmtHeader(pv.msg, "Labels", "")
-					pv.sink.Write([]byte(fmt.Sprintf("Labels: %s\n", labels)))
+					pv.pagerin.Write([]byte(fmt.Sprintf("Labels: %s\n", labels)))
 				}
-				pv.sink.Write([]byte{'\n'})
+				pv.pagerin.Write([]byte{'\n'})
 			}
 
 			entity, err := message.New(header, pv.source)