diff options
author | Eelco Dolstra <edolstra@gmail.com> | 2022-05-06 13:14:49 +0200 |
---|---|---|
committer | Eelco Dolstra <edolstra@gmail.com> | 2022-05-06 13:14:49 +0200 |
commit | b470218d9a89bc29116853260a01af6cab450dae (patch) | |
tree | 9074124839e2aa4011cbe39d198eaa52d2d1aadc | |
parent | 33affa0a02695a40f8adcb4e153c99b6f5ea613b (diff) |
renderMarkdownToTerminal(): Avoid line overflow
Lowdown doesn't respect '.cols' exactly (maybe because of the
whitespace in front of each line), so adjust .cols a bit.
-rw-r--r-- | src/libcmd/markdown.cc | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/libcmd/markdown.cc b/src/libcmd/markdown.cc index 29bb4d31e..71f9c8dff 100644 --- a/src/libcmd/markdown.cc +++ b/src/libcmd/markdown.cc @@ -9,10 +9,12 @@ namespace nix { std::string renderMarkdownToTerminal(std::string_view markdown) { + int windowWidth = getWindowSize().second; + struct lowdown_opts opts { .type = LOWDOWN_TERM, .maxdepth = 20, - .cols = std::max(getWindowSize().second, (unsigned short) 80), + .cols = (size_t) std::max(windowWidth - 5, 60), .hmargin = 0, .vmargin = 0, .feat = LOWDOWN_COMMONMARK | LOWDOWN_FENCED | LOWDOWN_DEFLIST | LOWDOWN_TABLES, |