diff --git a/doc/manual/rl-next/fix-help.md b/doc/manual/rl-next/fix-help.md new file mode 100644 index 000000000..f531deeb1 --- /dev/null +++ b/doc/manual/rl-next/fix-help.md @@ -0,0 +1,9 @@ +--- +synopsis: "Fix `--help` formatting" +issues: [fj#622] +cls: [2776] +category: "Fixes" +credits: ["lheckemann"] +--- + +The help printed when invoking `nix` or `nix-store` and subcommands with `--help` previously contained garbled terminal escapes. These have been removed. diff --git a/lix/libcmd/markdown.cc b/lix/libcmd/markdown.cc index 0010abedb..7264a9471 100644 --- a/lix/libcmd/markdown.cc +++ b/lix/libcmd/markdown.cc @@ -21,6 +21,9 @@ std::string renderMarkdownToTerminal(std::string_view markdown) .feat = LOWDOWN_COMMONMARK | LOWDOWN_FENCED | LOWDOWN_DEFLIST | LOWDOWN_TABLES, .oflags = LOWDOWN_TERM_NOLINK, }; + if (!shouldANSI()) { + opts.oflags |= LOWDOWN_TERM_NOANSI; + } auto doc = lowdown_doc_new(&opts); if (!doc) @@ -47,7 +50,7 @@ std::string renderMarkdownToTerminal(std::string_view markdown) if (!rndr_res) throw Error("allocation error while rendering Markdown"); - return filterANSIEscapes(std::string(buf->data, buf->size), !shouldANSI()); + return std::string(buf->data, buf->size); } }