Blame SOURCES/0132-format-table-always-underline-header-line.patch

a3e2b5
From cb35bd029dedf39b7be4945d57176a5b1aa03da9 Mon Sep 17 00:00:00 2001
a3e2b5
From: Lennart Poettering <lennart@poettering.net>
a3e2b5
Date: Thu, 8 Nov 2018 21:39:28 +0100
a3e2b5
Subject: [PATCH] format-table: always underline header line
a3e2b5
a3e2b5
(cherry picked from commit 30d98de00c68440ff4d77d851b4b3323c34027da)
a3e2b5
a3e2b5
Related: #1689832
a3e2b5
---
a3e2b5
 src/basic/format-table.c | 11 +++++++++--
a3e2b5
 1 file changed, 9 insertions(+), 2 deletions(-)
a3e2b5
a3e2b5
diff --git a/src/basic/format-table.c b/src/basic/format-table.c
a3e2b5
index 809a4be284..3fcb97475c 100644
a3e2b5
--- a/src/basic/format-table.c
a3e2b5
+++ b/src/basic/format-table.c
a3e2b5
@@ -1343,15 +1343,22 @@ int table_print(Table *t, FILE *f) {
a3e2b5
                                 field = buffer;
a3e2b5
                         }
a3e2b5
 
a3e2b5
+                        if (row == t->data) /* underline header line fully, including the column separator */
a3e2b5
+                                fputs(ansi_underline(), f);
a3e2b5
+
a3e2b5
                         if (j > 0)
a3e2b5
                                 fputc(' ', f); /* column separator */
a3e2b5
 
a3e2b5
-                        if (d->color && colors_enabled())
a3e2b5
+                        if (d->color && colors_enabled()) {
a3e2b5
+                                if (row == t->data) /* first undo header underliner */
a3e2b5
+                                        fputs(ANSI_NORMAL, f);
a3e2b5
+
a3e2b5
                                 fputs(d->color, f);
a3e2b5
+                        }
a3e2b5
 
a3e2b5
                         fputs(field, f);
a3e2b5
 
a3e2b5
-                        if (d->color && colors_enabled())
a3e2b5
+                        if (colors_enabled() && (d->color || row == t->data))
a3e2b5
                                 fputs(ANSI_NORMAL, f);
a3e2b5
                 }
a3e2b5