support unsized terminals#886
Conversation
|
This what the configurable export siz is for. Does that not work for you? |
|
The size config works, but needing it is confusing on first use. You run an export locally, and it works fine, but the same code fails in CI with "render: screen is too small" because you don't have a size. And you think, what screen, I'm doing an export. Then you have to hunt in the docs. I think it makes sense to have a default for exports in headless environments. In the spirit of "batteries included, but replaceable". |
|
Sounds like the problem is the error message should say something like "no TTY detected, use |
|
I think that makes sense. If the terminal junk wasn't visible, and you got the clear message: That would point me in the right direction. But then the next question I'd have is... What should the export dimensions be?
How should a user work it out? |
|
That is fair but I think that's:
|
In CI environments or container builds, there's not always a full terminal. I use presenterm to build HTML / PDF files as part of a CI process.
However, by default, it fails! Running
presenterm -Einside a nix or Docker build produces:Note:
render: screen is too small.This is because:
termbg::theme()writes a terminal probe to stdout, producing the Gf=32,... outputWindowSize::current()returns 0x0 without a real terminal - that causes "render: screen is too small"I worked around the issue by building slides inside
tmux:But it's quite complex and requires the extra
tmuxdependency in the build.This PR adds a function (
terminal::has_sized_terminal()) which checks bothis_terminal()and that terminal dimensions are non-zero.If the terminal is not sized:
termbg::theme()and use the dark variantprintln!instead of crossterm cursor movement in export loggingeprintln!for error output