From: Arvin Schnell Date: Fri, 16 Feb 2024 07:28:31 +0000 (+0100) Subject: - select table style based on codeset X-Git-Tag: v0.11.0~46^2 X-Git-Url: http://git.ipfire.org/gitweb/index.cgi?a=commitdiff_plain;h=1636dc3c2f69745877e95fc80cfcba4efda89978;p=thirdparty%2Fsnapper.git - select table style based on codeset --- diff --git a/client/GlobalOptions.cc b/client/GlobalOptions.cc index eee8dc63..0c1d544b 100644 --- a/client/GlobalOptions.cc +++ b/client/GlobalOptions.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) [2019-2023] SUSE LLC + * Copyright (c) [2019-2024] SUSE LLC * * All Rights Reserved. * @@ -122,7 +122,7 @@ namespace snapper { ParsedOpts::const_iterator it = opts.find("table-style"); if (it == opts.end()) - return TableFormatter::default_style; + return TableFormatter::default_style(); try { @@ -141,7 +141,7 @@ namespace snapper SN_THROW(OptionsException(error)); } - return TableFormatter::default_style; + return TableFormatter::default_style(); } diff --git a/client/utils/TableFormatter.cc b/client/utils/TableFormatter.cc index 1f61431d..a89032ff 100644 --- a/client/utils/TableFormatter.cc +++ b/client/utils/TableFormatter.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) [2019-2020] SUSE LLC + * Copyright (c) [2019-2024] SUSE LLC * * All Rights Reserved. * @@ -20,6 +20,9 @@ */ +#include +#include + #include "client/utils/TableFormatter.h" @@ -29,7 +32,11 @@ namespace snapper using namespace std; - const TableStyle TableFormatter::default_style = Ascii; + TableStyle + TableFormatter::default_style() + { + return strcmp(nl_langinfo(CODESET), "UTF-8") == 0 ? TableStyle::Light : TableStyle::Ascii; + } ostream& diff --git a/client/utils/TableFormatter.h b/client/utils/TableFormatter.h index 16c07973..251bde89 100644 --- a/client/utils/TableFormatter.h +++ b/client/utils/TableFormatter.h @@ -1,5 +1,5 @@ /* - * Copyright (c) [2019-2020] SUSE LLC + * Copyright (c) [2019-2024] SUSE LLC * * All Rights Reserved. * @@ -41,7 +41,7 @@ namespace snapper public: - static const TableStyle default_style; + static TableStyle default_style(); TableFormatter(TableStyle style) : style(style) {} diff --git a/package/snapper.changes b/package/snapper.changes index 03a848c4..3f926863 100644 --- a/package/snapper.changes +++ b/package/snapper.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Fri Feb 16 08:26:41 CET 2024 - aschnell@suse.com + +- select table style based on codeset + ------------------------------------------------------------------- Wed Feb 14 09:14:32 CET 2024 - aschnell@suse.com