1 Star 0 Fork 48

geliwei/systemd

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0132-format-table-always-underline-header-line.patch 1.57 KB
一键复制 编辑 原始数据 按行查看 历史
张彬琛 提交于 2021-01-20 13:59 . import systemd-239-29.el8.src.rpm
From cb35bd029dedf39b7be4945d57176a5b1aa03da9 Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Thu, 8 Nov 2018 21:39:28 +0100
Subject: [PATCH] format-table: always underline header line
(cherry picked from commit 30d98de00c68440ff4d77d851b4b3323c34027da)
Related: #1689832
---
src/basic/format-table.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/src/basic/format-table.c b/src/basic/format-table.c
index 809a4be284..3fcb97475c 100644
--- a/src/basic/format-table.c
+++ b/src/basic/format-table.c
@@ -1343,15 +1343,22 @@ int table_print(Table *t, FILE *f) {
field = buffer;
}
+ if (row == t->data) /* underline header line fully, including the column separator */
+ fputs(ansi_underline(), f);
+
if (j > 0)
fputc(' ', f); /* column separator */
- if (d->color && colors_enabled())
+ if (d->color && colors_enabled()) {
+ if (row == t->data) /* first undo header underliner */
+ fputs(ANSI_NORMAL, f);
+
fputs(d->color, f);
+ }
fputs(field, f);
- if (d->color && colors_enabled())
+ if (colors_enabled() && (d->color || row == t->data))
fputs(ANSI_NORMAL, f);
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/geliwei/systemd.git
git@gitee.com:geliwei/systemd.git
geliwei
systemd
systemd
a8

搜索帮助