From a46dab2aad446912a4a0b118a30cbb5ec1d25a86 Mon Sep 17 00:00:00 2001 From: "Dirk-Jan C. Binnema" Date: Tue, 17 May 2022 22:32:37 +0300 Subject: [PATCH] mu: use locale_workaround for tables The tabulate package triggers some locale exception, let's attempt to work around it. --- mu/mu-cmd-fields.cc | 4 ++++ mu/mu-cmd.cc | 3 +++ 2 files changed, 7 insertions(+) diff --git a/mu/mu-cmd-fields.cc b/mu/mu-cmd-fields.cc index 4f0cabc3..1ad556b7 100644 --- a/mu/mu-cmd-fields.cc +++ b/mu/mu-cmd-fields.cc @@ -137,6 +137,10 @@ Mu::mu_cmd_fields(const MuConfig* opts) { g_return_val_if_fail(opts, Err(Error::Code::Internal, "no opts")); + if (!locale_workaround()) + return Err(Error::Code::User, "failed to find a working locale"); + + std::cout << "#\n# message fields\n#\n"; show_fields(opts); std::cout << "\n#\n# message flags\n#\n"; diff --git a/mu/mu-cmd.cc b/mu/mu-cmd.cc index 7fdd61fd..482a2bca 100644 --- a/mu/mu-cmd.cc +++ b/mu/mu-cmd.cc @@ -406,6 +406,9 @@ cmd_info(const Mu::Store& store, const MuConfig* opts) { using namespace tabulate; + if (!locale_workaround()) + return Err(Error::Code::User, "failed to find a working locale"); + auto colorify = [](Table& table) { for (auto&& row: table) {