crossterm: Don't write on stdout if all commands are queued for stderr

When using the Command API and the alternate screen, I’d like to only use stderr for all displays in order to precisely decide what I write on stdout.

It looks like it’s almost possible but there are still some chars written on stdout even if I only queue on stderr.

I suspect this is related to the few places where there are calls to write_cout without the first argument.

Could we fix this ? Is it already in process ?

It’s possible a few API would have to change, for example for the alternate screen.

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 23 (23 by maintainers)

Most upvoted comments

Entering raw mode should be an operation on the input stream, not the output stream (#188), so I’m not sure it makes sense to shoehorn that into the command API.

I suppose we could have two commands: EnterAlternate and LeaveAlternate to replace the AlternateScreen::to_alternate(true)?.

The lib user would have to manage the drop of the application but that’s not a problem IMO if documented.

That is a valid point, and in fact, there are no ANSI-codes involved and thus Command can’t even be implemented right for raw mode.

As it’s a major concern for my broot, the last point on the road to my 1.0, I’m willing to try make the changes myself.