Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tea and termenv do not honor WithOutput properly #420

Closed
knz opened this issue Aug 25, 2022 · 4 comments · Fixed by #455
Closed

Tea and termenv do not honor WithOutput properly #420

knz opened this issue Aug 25, 2022 · 4 comments · Fixed by #455

Comments

@knz
Copy link
Contributor

knz commented Aug 25, 2022

There's a mismatch in API semantics:

  • termenv relies on the output going to os.Stdout
  • bubbletea makes this configurable (via WithOutput)

When bubbletea WithOutput is used with a different file, termenv does not recognize color profiles properly any more.

Generally, the mistake being made is the assumption that stdout is the file descriptor connected to the terminal. generally, the terminal is to be found on stdin, not stdout (and neither stderr!)

This mismatch is the cause of the following issues:

I understand that the "next generation termenv" at https://github.com/muesli/termenv/tree/termenv-next would help with this, but I don't seem to see a timeline to get this moving forward?

@knz
Copy link
Contributor Author

knz commented Aug 25, 2022

FWIW, BSD libedit and readline treat the input and output file descriptors separately:

  • the input raw mode is set on the input file descriptor
  • the output escape codes, incl term initialization etc are sent on the output file descriptor

@knz
Copy link
Contributor Author

knz commented Aug 25, 2022

Oh and both query the terminal size using ioctl / TIOCGWINSZ on the input file desc, not output. Unsure why.

@muesli
Copy link
Member

muesli commented Aug 25, 2022

Yep, the termenv-next branch of termenv, as well as the termenv-output branch of bubbletea and the next branch of lipgloss address this issue. No timeline, but it's one of the things I'm currently working on.

@muesli
Copy link
Member

muesli commented Sep 27, 2022

Oh and both query the terminal size using ioctl / TIOCGWINSZ on the input file desc, not output. Unsure why.

We should look into that, I see more apps doing that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants